Giter Site home page Giter Site logo

algorithmic-trading's Introduction

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

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

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.