Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sravb/algorithmic-trading
Algorithmic trading using machine learning.
https://github.com/sravb/algorithmic-trading
algorithmic-trading data-mining data-science decision-tree google-finance machine-learning matplotlib pandas python scikit-learn scipy stock
Last synced: about 2 months ago
JSON representation
Algorithmic trading using machine learning.
- Host: GitHub
- URL: https://github.com/sravb/algorithmic-trading
- Owner: SravB
- License: gpl-3.0
- Created: 2017-08-02T03:31:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-27T04:22:07.000Z (almost 7 years ago)
- Last Synced: 2024-10-31T08:42:03.677Z (about 2 months ago)
- Topics: algorithmic-trading, data-mining, data-science, decision-tree, google-finance, machine-learning, matplotlib, pandas, python, scikit-learn, scipy, stock
- Language: Python
- Homepage:
- Size: 407 KB
- Stars: 113
- Watchers: 14
- Forks: 74
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Algorithmic Trading
This machine learning algorithm was built using Python 3 and scikit-learn with a Decision Tree Classifier. The program gathers stock data using the Google Finance API and pandas. The data is illustrated using matplotlib.
![Screenshot](algo.jpg)
The red lines illustrate the stock price movements when we are not holding the stock while the green lines show these movements when we are holding the stock. The blue lines illustrate cash levels over time, where we start with $100 (so in this case, we can also interpret this as the percentage return on the stock). The expected cash value is the return we would have received if we simply held onto the stock for the entire period. The performance is the ratio between the cash value over the expected cash value and is expressed as a percentage.
Below is a screenshot of the algorithm's results on a large sample of stocks where changes in price are generated randomly:
![Screenshot](results.jpg)
Overall, this algorithm predicts whether the stock price will rise or fall with approximately a 75% accuracy. This is far better than the 50% produced when randomly guessing. Additionally, the performance value of 204% indicates that applying this algorithm returns 204% of the amount that would have been returned if we simply held on to the stock for the entire time period. This illustrates that it is more profitable to apply this algorithm than to simply invest in a stock for a long duration. Furthermore, this applies to both cases where the stock price rises or falls in the long run since this performance figure was generated by a large sample.