A system for training and backtesting RL algorithms on financial assets.
- Node >= 17.3.0
- Python >= 3.8.1
- pip >= 22.0.3
$ pip install --upgrade pip
$ pip install uvicorn
$ python -m venv vnev
$ source venv/bin/activate
$ (venv) pip install -r requirements.txtMacOS:
$ brew update
$ brew install redis postgres
$ psql postgres
postgres-# CREATE ROLE postgres WITH LOGIN PASSWORD 'postgres'Postgres username, password and name should be postgres.
Hostname: localhost, Port: 5432
$ cd client
$ npm install- Start the Postgres server.
MacOS:
$ brew services start poostgresql
$ brew services start redis- Initialize the DB structure using alembic [OPTIONAL Only when changing DB models and testing]
If running for the first time do inside the api folder
$ alembic init alembic-
If necessary(when changing models) drop the current tables in the DB by manual cascade drop (can be done in pgAdmin). This is only for testing phases.
-
Run the init revision for alembic. This is the init file which is found in the api/alembic/versions folder. If it doesn't exist run 'alembic revision -m "init" '
$ alembic upgrade <init revision number>The init revision file should contain the following:
from api.db.models import Agent, Trade, Balance
def upgrade():
cols = [c for c in Agent.__table__.columns]
op.create_table(Agent.__tablename__, *cols)
cols = [c for c in Balance.__table__.columns]
op.create_table(Balance.__tablename__, *cols)
cols = [c for c in Trade.__table__.columns]
op.create_table(Trade.__tablename__, *cols)- Run the API server:
$ export PYTHONPATH="${PYTHONPATH}:${PWD}"
$ cd api
$ uvicorn app:app --reload --host 0.0.0.0
$ redis-cli monitor
$ celery -A worker.app worker --loglevel=info --pool=soloThis will load a web server with hot reload on http://localhost:8000
Swagger API is available at: http://localhost:8000/docs
- Run client server:
$ cd client
$ npm run start
The website will be loaded on http://localhost:3000