Export data from financial markets directly to prometheus
2.3K
Export market data to prometheus with
** Classic
** Market
** Corporate
#+begin_src python :results output :exports both import pandas as pd from tabulate import tabulate
hist = pd.read_csv('./dump/AAPL.csv') hist['Datetime'] = hist['Datetime'].astype('datetime64[ns]') hist = hist.reset_index(drop=True).set_index('Datetime') print(tabulate(hist.tail(), headers='keys', tablefmt='orgtbl')) #+end_src
#+RESULTS: : | Datetime | Open | High | Low | Close | Volume | Dividends | Stock Splits | : |---------------------+---------+---------+---------+---------+----------+-------------+----------------| : | 2020-12-22 19:58:00 | 132.075 | 132.14 | 132.05 | 132.055 | 133850 | 0 | 0 | : | 2020-12-22 19:59:00 | 132.055 | 132.13 | 132.02 | 132.04 | 140877 | 0 | 0 | : | 2020-12-22 20:00:00 | 132.05 | 132.101 | 131.88 | 132 | 270197 | 0 | 0 | : | 2020-12-22 20:01:00 | 131.995 | 132.026 | 131.99 | 132.026 | 234065 | 0 | 0 | : | 2020-12-22 20:01:03 | 132.026 | 132.026 | 132.026 | 132.026 | 0 | 0 | 0 |
#+begin_src bash :results output docker build -t strm/finance-exporter . #+end_src
#+RESULTS: #+begin_example Sending build context to Docker daemon 102.3MB
Step 1/10 : FROM python:3.7-slim ---> ea12296513d7 Step 2/10 : LABEL maintainer='[email protected]' ---> Using cache ---> 8297965ddb38 Step 3/10 : RUN pip install "poetry==1.0.10" ---> Using cache ---> b59686f5685c Step 4/10 : WORKDIR /src ---> Using cache ---> 52b1dc4b388e Step 5/10 : COPY poetry.lock pyproject.toml /src/ ---> Using cache ---> e45bb251b0a7 Step 6/10 : RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi ---> Using cache ---> c75519670f51 Step 7/10 : COPY finance_exporter . ---> Using cache ---> a484e028b4ac Step 8/10 : RUN mkdir dump ---> Using cache ---> 75ffb7873ef8 Step 9/10 : EXPOSE 9101 ---> Using cache ---> ee22d53063db Step 10/10 : ENTRYPOINT ["python3", "finance_exporter.py"] ---> Using cache ---> a3a3b7538933 Successfully built a3a3b7538933 Successfully tagged strm/finance-exporter:latest #+end_example
Testing your build with
#+begin_src bash docker run --rm -it -p 9101:9101 strm/finance-exporter #+end_src
The container uses the port 9101 to expose data
Content type
Image
Digest
Size
128 MB
Last updated
over 5 years ago
docker pull strm/prometheus-exporter-market