Deep Reinforcement Learning based Trading Agent for Bitcoin using DeepSense Network for Q function approximation.
For complete details of the dataset, preprocessing, network architecture and implementation, refer to the Wiki of this repository.
To setup a ubuntu virtual machine with all the dependencies to run the code, refer to assets/vm
.
Pull the prebuilt docker image directly from docker hub and run it as
docker pull samre12/deep-trading-agent:latest
docker run -p 6006:6006 -it samre12/deep-trading-agent:latest
OR
Build the docker image locally by executing the command and the run the image as
docker build -t deep-trading-agent .
docker run -p 6006:6006 -it deep-trading-agent
This will setup the repository for training the agent and
mount the current directory into /deep-trading-agent
in the container
during image build, the latest transactions history from the exchange is pulled and sampled to create per-minute scale dataset of Bitcoin prices. This dataset is placed at /deep-trading-agent/data/btc.csv
to initiate training of the agent, specify suitable parameters in a config file (an example config file is provided at /deep-trading-agent/code/config/config.cfg
) and run the code using /deep-trading-agent/code/main.py
training supports logging and monitoring through Tensorboard
vim
and screen
are installed in the container to edit the configuration files and run tensorboard
bind port 6006 of container to 6006 of host machine to monitor training using Tensorboard
Please give a
Preprocessor
is inspired by Deep Q-Trading where they solve a simplified trading problem for a single asset.
For each trading unit, only one of the three actions: neutral(1), long(2) and short(3) are allowed and a reward is obtained depending upon the current position of agent. Deep Q-Learning agent is trained to maximize the total accumulated rewards.
Current Deep Q-Trading model is modified by using the Deep Sense architecture for Q function approximation.
Per minute Bitcoin series is obtained by modifying the procedure mentioned in this repository. Transactions in the Coinbase exchange are sampled to generate the Bitcoin price series.
Refer to assets/dataset
to download the dataset.
Basic Preprocessing
Completely ignore missing values and remove them from the dataset and accumulate blocks of continuous values using the timestamps of the prices.
All the accumulated blocks with number of timestamps lesser than the combined history length of the state and horizon of the agent are then filtered out since they cannot be used for training of the agent.
In the current implementation, past 3 hours (180 minutes) of per minute Bitcoin prices are used to generate the representation of the current state of the agent.
With the existing dataset (at the time of writing), following are the logs generated while preprocessing the dataset:
INFO:root:Number of blocks of continuous prices found are 58863
INFO:root:Number of usable blocks obtained from the dataset are 887
INFO:root:Number of distinct episodes for the current configuration are 558471
Advanced Preprocessing
Process missing values and concatenate smaller blocks to increase the sizes of continuous price blocks.
Standard technique in literature to fill the missing values in a way that does not much affect the performance of the model is using exponential filling with no decay.
(To be implemented)
Tensorflow "1.1.0" version is used for the implementation of the Deep Sense network.
Implementation is adapted from this Github repository with a few simplifications in the network architecture to incorporate learning over a single time series of the Bitcoin data.
Implementation and preprocessing is inspired from this Medium post. The actual implementation of the Deep Q Network is adapted from DQN-tensorflow.
this blog from: https://github.com/LantaoYu/MARL-Papers Paper Collection of Multi-Agent Reinforcement Learning (MARL) This is a collection of research and review papers of multi-agent reinforcement le
Crypto Trading Bot Deprecation Notice Firstly, I'd like to thank everyone who's shown an interest in this repo. I'd also like to apologize for my lack of support overthe last few years - I received no
self reminder: patience is the mother of science *** REFUGEES WELCOME! *** *** FATAL ROUTES? *** K is a very low latency market making trading bot with a fully featured web interface. It can pla
TradingVue.js TradingVue.js was a hackable charting lib for traders. You could draw literally ANYTHING on top of candlestick charts. [Not Maintained] Why If you create trading software - this lib is p
Binance Trading Bot Automated Binance trading bot with trailing buy/sell strategy This is a test project. I am just testing my code. Warnings I cannot guarantee whether you can make money or not. So u
DEEP(Digital Enterprise End-to-end Platform)是由 AWS 支持的成本低,维护成本低的数字化平台。帮助企业开发人员提高工作效率。 使用DEEP Framework,开发人员可以立即使用: 简化的“类似于生产”的开发环境 使用微服务架构的企业级平台 零发展几乎无限的可扩展性(又名无服务器计算) 来自云提供商(例如AWS,GCP等)的Web服务的抽象使用
Machine-Learning-and-AI-in-Trading Here is some of codes generated in Python using Machine Learning and AI for generating prediction in Stock Prices. Packages Used: Talib Scikit Learn TensorFlow Keras