Git Product home page Git Product logo

momentum-fund's Introduction

momentum-fund

  1. Introduction
  2. Installation
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Disclaimer
  8. References
  9. Appendix
  10. Changelog

Introduction

  1. This repository is an implementation of the ideas mentioned in the book 'stocks on the move'. The book is written by Andreas Clenow.
  2. The book is about momentum investing

Installation

  1. Clone the repository
  2. Install the requirements (pip install -r requirements.txt)
  3. Copy the file app.properties.sample to app.properties
    1. We leverage Zerodha to pull OHLCV data and you need to have a Zerodha account. Log into your Zerodha account at https://kite.zerodha.com/ and copy the enctoken from the cookies to app.properties file
    2. I was initially relying on kite.trade to fetch the date, but I don't want to spend 4k every month for it when I can get it for free.
    3. Look at the other properties and change them as per your needs
  4. Run the code by executing the main.py file (python main.py)
  5. To get the current portfolio run http://localhost:7999/api/portfolio. This makes calls to Zerodha to get last closing price, So expect some time to get the response. Zerodha calls are cached, so subsequent calls become faster.
  6. To rebalance the portfolio run http://localhost:7999/api/rebalance. This will take a while. If your stock universe is NIFTY_200, then it will take 4-5 minutes. Response will be visible on the screen. This will generate few files along with way, who's contents are mentioned below
  7. Enjoy!

Usage

The code is written in python. The code is written in a modular way.

Details about the properties mentioned in app.properties file:

  1. app.host=localhost (This is the host on which the code will run)
  2. app.port=7999 (This is the port on which the code will run)
  3. app.debug=True (This is the debug flag. If set to True, the code will run in debug mode)
  4. kite.ui.base_url=https://kite.zerodha.com (This is the base url of the kite website)
  5. kite.ui.client_id=KWxxxx (This is the client id of your Zerodha account)
  6. kite.ui.enctoken=xxxxxxx (This is the enctoken of your Zerodha account)
  7. portfolio.file=portfolio.csv (This is the file where the initial portfolio will be stored)
  8. trade_day=SUNDAY (This is the day on which all the trades will be executed)
  9. stock_universe_index=NIFTY 50 (Stocks from this index will be considered for the portfolio)
  10. num_historical_lookup_days=365 (Number of days to look back for historical data)

Files generated by the code:

  1. ranking.csv - This file contains the ranking of all the stocks in the stock universe. The stocks are ranked based on their volatility adjusted momentum.
  2. portfolio.csv - This file contains the initial portfolio.
  3. portfolio_self_momentum_**.csv - These files are created when the code is run. These files contain the portfolio after each rebalancing.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Contact

You can contact me at LinkedIn Or email me at [email protected]

Disclaimer

  1. I am not a financial advisor.
  2. This is not a financial advice.
  3. I am not responsible for any losses incurred by you.
  4. Please do your own research before investing in any stocks.

References

Please refer to the book 'Stocks on the move' by Andreas Clenow for more details.

https://www.amazon.in/Stocks-Move-Beating-Momentum-Strategies-ebook/dp/B00YPHZO3W

Appendix

Changelog

momentum-fund's People

Contributors

adityazagade avatar adityazagadect avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

joshiga

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.