Skip to content

bad3p/DeepScalp

Repository files navigation

DeepScalp

MOEX scalping trade bot based on deep learning model.

Uses adopted variant of LSHASH to speed up similarity measurement of trading data samples.

Prerequisites

Installation

  • pip install numpy
  • pip install tinkoff-investments
  • pip install dearpygui
  • pip install joblib
  • pip install win10toast
  • pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Access token

  • The scripts requires T-Bank access token in order to integrate with its API.
  • The token should be provided in environment variable TK_TOKEN on the local machine.

Gathering trading data

  • To train the models you will need to gather enough of the trading data using TkDataGatherLoop.bat
  • The script feeding from the live stock market exchange (MOEX) and outputs a set of files representing streams of trading orders and operations relevant to certain shares.

An example of the gathered tading data:

python_ogQfLvLvfv

Training autoencoders

  • The forecasting model uses compressed representation of orderbooks and last trades distribution samples.

  • The aforementioned compressed representation is a learnable models based on autoencoders.

  • To train those autoencoders you need to preprocess the gathered trading data using TkPreprocessAutoencoderData.py

  • Upon completion of preprocessing data, you can launch TkTrainAutoencoders. It will display feedback regarding the training process, so you can decide for yourself when it should be stopped.

    python_6Lbg4oOwMS

Training time series forecasting model

  • With trained autoencoder models we can prepare training data for time series prediction model using TkPreprocessTimeSeriesData.py.
  • Upon completion of preprocessing data, it is all ready for launching TkTrainTimeSeries.py and training of the forecasting model. The training script will display feedback regarding the training process as well, it is just take significantly more time than training of the autoencoders.

The time series model trained and reinforced with novel data. The time series model trained and reinforced with novel data.

Using forecasting service

In trading mode it is required to run both:

  • TkDataGatherLoop.bat - to gather realtime trading data
  • and TkForecastingService.py - to predict the price movement based on the gathered realtime trading data

Depending on the model parameters TkForecastingService.py would need for the trading data to accumulate for some time before starting predicting price movement.

python_tRv9psg1xF.mp4

About

MOEX scalping trade bot based on deep learning model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •