Alok Choudhary Profile picture
Programmer | Java | Python | R | Algorithmic | Trading | Nifty Banknifty | AI | ML | Financial/Trading System Development | Data Science | Options Greek

Aug 16, 2019, 17 tweets

How to build Algo Trading System - Roadmap

1) Installation of Spyder
2) Importing data from different data sources
3) Pandas
4) Matplotlib
5) Technical Analysis in python
6) Building trading models
7) Backtest, optimize & automate, performance
8) Options analysis and strategies

1) Installation of Spyder
drive.google.com/file/d/1XlOdgM…

2) Importing data from different data sources
We can download from NSE and read from local system
Can get data from NSE by nsetools library
Can be fetched through web services
Data vendors can be used to get the data

3) Pandas | Python Data Analysis Library
Pandas is an open source library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.
It enables to carry out entire data analysis workflow in Python without using R.

How to read Nifty data and plot basic chart.


Nifty ohlc chart 2006 to current


How to get Banknifty Index quote in python


Get ^NSEI data from web by yahoo finance

Pandas and the DataFrame

DataFrame = pythonic analog of R's data frame

Manipulating pandas DataFrames
Exploratory data analysis
Data wrangling
Data preprocessing
Building models
Visualization

Importing using pandas

4) Matplotlib
Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK+

5) TA in Python
Technical analysis packages are used for performing numerical and statistical operations, reading or downloading data, charting data and performing stock technical analysis operations.

Below python packages to use
• numpy
• pandas
• matplotlib
• ta

Technical Analysis
• Volume Indicators
• Volatility Indicators
• Trend Indicators
• Momentum Indicators
• Others Indicators

github.com/alokchoudhary0…
en.wikipedia.org/wiki/Technical…

Volatility Indicators
Bollinger Bands (BB) 30 day Facebook Python Code

github.com/alokchoudhary0…

Now make this plot more readable by shading the critical areas between the upper and lower bands. Matplotlib can handle plot shading as well. Let’s tweak our basic plot with the help of Matplotlib’s fill_between method.

6) Building Trading Algorithms with Python
Here comes lot of coding and debugging. Now will be.

•Implementing stock market analysis
•Designing a trading algorithm for selling and buying
•Structuring a trading bot
•Run trial trades

Implementing Stock Market Analysis in Python includes
• Financial analysis on stock market data
• Learning about returns and moving averages
• Coding the strategy

7) Design, Backtest, optimize & automate, performance

Preliminary Research:
• Develop a strategy that suits personal needs
• Example - risk profile, time commitment, trading capital
• Identify persistent marketing efficiency

Backtesting:
• Focus on validating the trading bot
• Check code
• Understand performance over different time frame and asset classes

Optimization:
• Maximize performance by minimizing the overfitting price
• Select good performance measures
• Avoid overfitting bias

Live Execution
• Select the appropriate broker
• Implement mechanism to manage market and operation risk
• Verify the bot's performance
• Continuous monitoring

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling