Skip to content

MABYY/Backtesting_using_OOP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Backtesting_using_OOP

Development setup

Tensorflow and Keras frameworks are adopted for the implementation.

pip install tensorflow

The historical data can be accessed by installing yfinance library (https://pypi.org/project/yfinance/).

pip install yfinance

Libraries used to create visualizations

pip install matplotlib

pip install seaborn

The Model

With the help of an LSTM network, we previously estimated a model the predictis the future price of BTC for the day after. We created the class Data that downloads the historical data available for BTC and splits the dataset and imports the estimated model mentioned before to obtain the predicted prices fot BTC. We can see below the results of running the model with new data.

Screen Shot 2021-05-02 at 1 48 29 PM

Results

After extracting the predicted prices, we passed onto defining the trading rule. Instead of looking at the actual price predicted we decided to identify as a buying opportunity (1) each time the predicted price is higher than the previous closing price. Otherwise, the trading rule will output the number zero, which indicates the investor should sell. After rulling this loop we plotted the results the investor would have had if he had followed this trading rule.

Screen Shot 2021-05-02 at 1 48 39 PM

Articles

Contributing

  • Fork this project
  • Create your feature branch
  • Commit your changes
  • Push to the branch
  • Create a new Pull Request

About

Based on our LSTM model, we create a trading rule and backtest the investment strategy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published