Skip to main content

Python 3.x module to render financial results in tensorboard

Project description

8 MILE RENDER

Python 3.x module to treat time series data espacially financial ones.

Actual version : 0.2.1

Installation 🔥

Pre-requisites:

  • python3
  • pip3

Install the talib library:

wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/ && ./configure --prefix=/usr && make && make install
pip3 install ta-lib pandas-ta

Install the package with pip3

pip3 install git+https://github.com/theophane-droid/8miles-render

Usage 🚀

Simple example do download yahoo data and apply all ta features to it.

PAIR = "BTCUSD"
START = "2021-12-01"
END = "2022-05-24"
INTERVAL = "hour"

PATH = 'output/csvdataexporter'


yf_dp = YahooDataProvider(PAIR, START, END, interval=INTERVAL)
data = TaFeaturesTransformer(yf_dp).transform()
print(data.tail(10))

Using tensorboard plotting with RabbitRenderer

from datetime import datetime
import pandas as pd
from Hmilerender.RabbitRenderer import RabbitRenderer

def fill_renderer(data, renderer):
 # we fill the renderer with data rows
   for index, row in data.iterrows():
      date = datetime.strptime(row["Date"], "%Y-%m-%d")
      renderer.append("open", row["open"], date)
      renderer.append("close", row["close"], date)
      renderer.append("high", row["high"], date)
      renderer.append("low", row["low"], date)
      renderer.append("volume", row["volume"], date)
      renderer.append("exit", row["exit"], date)
      renderer.append("long", row["long"], date)
      renderer.append("short", row["short"], date)
      renderer.append("money", row["money"], date)

# we create a renderer object
renderer = RabbitRenderer('logs/')
# we read data
data = pd.read_csv('data/data.csv')
# we fill renderer
fill_renderer(data, renderer)
# we launch renderer
renderer.render()
# then we increment tensorboard step
renderer.next_step()
# we refill the renderer
fill_renderer(data, renderer)
# we launch renderer
renderer.render()

Build doc 🛠️

You can rebuild the doc with the following commands:

make html
rm -r docs
mv _build/html docs
rm -rf _build

Documentation 📚

Find doc here

Launch tests 🧪

Please ensure you have installed docker and docker-compose.

First build the docker image:

docker compose build

Then start the containers :

docker compose up -d

Then run the tests :

docker compose run --rm tester python3 /app/test/test_dataexporter.py
docker compose run --rm tester python3 /app/test/test_dataprovider.py
docker compose run --rm tester python3 /app/test/test_datatransformer.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hmile-0.2.1.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distributions

hmile-0.2.1-py3.9.egg (27.4 kB view hashes)

Uploaded Source

hmile-0.2.1-py3-none-any.whl (12.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page