All Projects → SC4RECOIN → Lstm Crypto Price Prediction

SC4RECOIN / Lstm Crypto Price Prediction

Licence: mit
Predicting price trends in cryptomarkets using an lstm-RNN for the use of a trading bot

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Lstm Crypto Price Prediction

Tensorflow Bitcoin Robot
A Bitcoin trade robot based on Tensorflow LSTM model.Just for fun.
Stars: ✭ 155 (+13.97%)
Mutual labels:  trading-bot, bitcoin, lstm, rnn
Jesse
An advanced crypto trading bot written in Python
Stars: ✭ 1,038 (+663.24%)
Mutual labels:  bot, trading-bot, bitcoin, algorithmic-trading
Algotrading
Algorithmic trading framework for cryptocurrencies.
Stars: ✭ 249 (+83.09%)
Mutual labels:  bot, trading-bot, algorithmic-trading, algotrading
Cbpro Trader
Automated cryptocurrency trading on Coinbase Pro (formerly gdax-trader)
Stars: ✭ 171 (+25.74%)
Mutual labels:  bitcoin, btc, technical-analysis, algotrading
Socktrader
🚀 Websocket based trading bot for 💰cryptocurrencies 📈
Stars: ✭ 152 (+11.76%)
Mutual labels:  bot, trading-bot, bitcoin, algorithmic-trading
Crypto Signal
Github.com/CryptoSignal - #1 Quant Trading & Technical Analysis Bot - 3,100+ stars, 900+ forks
Stars: ✭ 3,690 (+2613.24%)
Mutual labels:  trading-bot, bitcoin, technical-analysis, algorithmic-trading
Phptrader
A simple php powered Bitcoin and Ethereum trading bot
Stars: ✭ 131 (-3.68%)
Mutual labels:  bot, trading-bot, bitcoin, btc
Octobot
Cryptocurrency trading bot: high frequency, daily trading, social trading, ...
Stars: ✭ 706 (+419.12%)
Mutual labels:  trading-bot, bitcoin, technical-analysis
Awesome Quant
A curated list of insanely awesome libraries, packages and resources for Quants (Quantitative Finance)
Stars: ✭ 8,205 (+5933.09%)
Mutual labels:  trading-bot, technical-analysis, algotrading
Finta
Common financial technical indicators implemented in Pandas.
Stars: ✭ 901 (+562.5%)
Mutual labels:  algorithmic-trading, technical-analysis, algotrading
Bitvision
Terminal dashboard for trading Bitcoin, predicting price movements, and losing all your money
Stars: ✭ 957 (+603.68%)
Mutual labels:  trading-bot, bitcoin, technical-analysis
Siis
Trading bot including terminal, for crypto and traditionals markets. Assisted or fully automated strategy.
Stars: ✭ 45 (-66.91%)
Mutual labels:  trading-bot, bitcoin, algotrading
Binance grid trader
A grid trading strategy and trading-bot for Binance Exchange. 币安交易所的网格交易
Stars: ✭ 132 (-2.94%)
Mutual labels:  trading-bot, bitcoin, btc
Peregrine
Detects arbitrage opportunities across 131 cryptocurrency exchanges in 50 countries
Stars: ✭ 638 (+369.12%)
Mutual labels:  trading-bot, algorithmic-trading, algotrading
Techan
Technical Analysis Library for Golang
Stars: ✭ 404 (+197.06%)
Mutual labels:  trading-bot, bitcoin, technical-analysis
Seq2seq Chatbot
Chatbot in 200 lines of code using TensorLayer
Stars: ✭ 777 (+471.32%)
Mutual labels:  bot, lstm, rnn
Ccxt
A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
Stars: ✭ 22,501 (+16444.85%)
Mutual labels:  bot, bitcoin, btc
Example Scalping
A working example algorithm for scalping strategy trading multiple stocks concurrently using python asyncio
Stars: ✭ 267 (+96.32%)
Mutual labels:  trading-bot, algorithmic-trading, algotrading
Cointrol
฿ Bitcoin trading bot with a real-time dashboard for Bitstamp.
Stars: ✭ 1,351 (+893.38%)
Mutual labels:  bot, trading-bot, bitcoin
Gtrader
a trading strategy trainer, back-tester and bot
Stars: ✭ 71 (-47.79%)
Mutual labels:  trading-bot, bitcoin, algorithmic-trading

LSTM Crypto Price Prediction 🎯

The goal of this project is predicting the price trend of Bitcoin using an lstm-RNN. Technical analysis is applied to historical BTC data in attempt to extract price action for automated trading. The output of the network will indicate and upward or downward trend regarding the next period and will be used to trade Bitcoin throught the Binance API.

requirements

  • python-binance
  • Keras (RNN)
  • Scikit (polynomial interpolation)
  • numpy
  • scipy (savgol filter)
  • plotly and matplotlib (if designated graphing flag is set)

Label

The price of Bitcoin tends to be very volatile and sporadic making it difficult to find underlying trends and predict price reversals. In order to smooth the historical price data without introducing latency, a Savitzky-Golay filter is applied. The purpose of this filter is to smooth the data without greatly distorting the signal. This is done by fitting sub-sets of adjacent data points with a low-degree polynomial by the method of linear least squares. This filter looks forward into the data so it can only be used to generate labels on historic data. The first-order derivative is then taken to find the slope of the filtered data to indicate upwards and downwards movements about the zero axis. This can be seen in the following figure:

alt text

Features

The following features will be used for the lstm-RNN

  • MACD histogram
  • Stochastic RSI
  • Detrended Price Oscillator
  • Coppock Curve
  • Interpolation of price

alt text

An approximation of the next price is performed using ridge regression from Scikit-learn. Through polynomial interpolation, the price can be treated as a continuous function and the next value in a series can be approximated. Instead of taking the next predicted value in the set, the slope of the last value is found to indicate onward price direction. This approximated value will be fed into the network along with the other features to predict the output label.

alt text

Results

The results so far are somewhat promising. The validation accuracy of the network is just above 70% almost 80% after adding a couple more indicators and ensuring an equal amount of training labels. This can be helpful in market analysis but cannot be used for automated trading due to false positives and network error. Adding features and have better training data should improve the model.

Update: trading test

Data from the Binance exchange was pulled from April 17 - May 12 as the model was trained prior to this and has not seen this data. The data within this period has a good balance of price action and should be a good simulation for the trading bot. This was done by applying the saved model to the data and tracking fake trades in a wallet.

fee = 0.001  # Binance trading fee
for idx, buy in enumerate(action):

    if holding:
        if not buy:
            holding = False
            wallet = btc * prices[idx] * (1 - fee)
            print('$ {0:.2f}'.format(wallet))
    
    else:
        if buy:
            holding = True
            btc = wallet / prices[idx] * (1 - fee)

print('\nWallet: {0:.2f}%'.format((wallet/100-1)*100))
print('Holding: {0:.2f}%'.format((prices[-1]/prices[0]-1)*100))

The results are as expected. The model makes good predictions for the most part but is a bit too laggard in trading decisions. This leads to late trades which can be very costly in crypto markets as the price can swing so quickly. The bot does makes a little money initially but slowly loses it through late trades. When the trading fee is introduced the bot performs very poorly.

The final results of the test period are as follows (with trading fee):

Wallet: -11.26%
Holding: 6.51%

Retraining the network and testing it on new data shows more promise

Wallet: -7.45%
Holding: -22.15%

New iterations of the model should include better output as limiting the model to buy and sell predictions does not make for a very dynamic model. Also, creating a more dynamic loss function could improve the model as it should not get penalized for missing a buy signal just before the price is about to reverse as much as missing a buy signal at the bottom of a dip. Reinforcement learning should also be explored.

All code developed by Kurtis Streutker

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].