sreenivasdoosa / sdoosa-algo-trade-python Goto Github PK
View Code? Open in Web Editor NEWAlgo trade project in python
Algo trade project in python
Is there any hook in the code for strategy level exit based on profit or SL?… if not can you give some pointers on which files to be looked into….thanks.
Hi Getting Name error Can you please check?
File ".....\src\utils\Utils.py", line 80, in getTimeOfToDay
return getTimeOfDay(hours, minutes, seconds, datetime.now())
NameError: name 'getTimeOfDay' is not defined
I am using Pycharm. though 'getTimeOfDay' is already defined, throwing above error..
Thanks,
I tried to start reverse trade from Stop loss by creating new Trade manager and calling it From main Trade manager but its not working any help or suggestion would be appreciated.
Bro still I can't access ur videos plz allow to see ur videos my email address [email protected]
Has anyone done integration with Fyers V2? It has ticker-wise order update included recently.
Please share if done. Thanks in advance.
Hi Srini, Could you help with a function to fetch the open position (qty) by passing the 'tradingsymbol'? Similar to below. Many Thanks!
def fetchPrice(orderId):
logging.info('Fetching order price %s', orderId)
kite = getKite()
try:
price = kite.order_history(order_id=orderId)[(len(kite.order_history(order_id=orderId)))-1]['average_price']
logging.info('Order status fetched for orderId = %s price = %s', orderId, price)
return price
except Exception as e:
logging.info('Order status fetch failed: %s', e.message)
Can anyone help me out with IIFL Intergration
Hi Friend,
We are beginners to Python and Flask. We are tiring to execute your code. We are facing some technical problems. Please help us to resolve it.
Please refer to the error.
2020-12-22 20:40:55: * Detected change in 'C:\xampp\htdocs\flask-intro\sdoosa-algo-trade-python-master\src\zerodha.py', reloading
2020-12-22 20:40:55: * Restarting with stat
2020-12-22 20:40:58: serverConfig => {'port': 5000, 'enableSSL': False, 'sslPort': 8443}
2020-12-22 20:40:58: userConfig => {'clientID': 'MG4332', 'apiKey': 'hcdi8tyn1i01dnqe', 'apiSecret': 'nmkabafrwt7zylg5a0q9ehyi4gkaj6s8', 'redirectUrl': 'http://localhost:5000/apis/broker/login/zerodha'}
2020-12-22 20:40:58: * Debugger is active!
2020-12-22 20:40:58: * Debugger PIN: 120-108-093
2020-12-22 20:40:58: * Running on http://localhost:5000/ (Press CTRL+C to quit)
2020-12-22 20:41:06: 127.0.0.1 - - [22/Dec/2020 20:41:06] "←[37mGET /?algoStarted=true HTTP/1.1←[0m" 200 -
2020-12-22 20:41:35: 127.0.0.1 - - [22/Dec/2020 20:41:35] "←[37mGET /?algoStarted=true HTTP/1.1←[0m" 200 -
2020-12-22 20:41:53: Algo started...
2020-12-22 20:41:53: Going to fetch instruments...
2020-12-22 20:41:53: Sending redirect url http://127.0.0.1:5000?algoStarted=true in response
2020-12-22 20:41:53: 127.0.0.1 - - [22/Dec/2020 20:41:53] "←[37mPOST /apis/algo/start HTTP/1.1←[0m" 200 -
Exception in thread Thread-6:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Program Files\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\xampp\htdocs\flask-intro\sdoosa-algo-trade-python-master\src\algo.py", line 15, in startAlgo
fetchInstruments(kite)
File "C:\xampp\htdocs\flask-intro\sdoosa-algo-trade-python-master\src\instruments.py", line 17, in fetchInstruments
instrumentsList = kite.instruments('NSE')
AttributeError: 'NoneType' object has no attribute 'instruments'
2020-12-22 20:41:53: 127.0.0.1 - - [22/Dec/2020 20:41:53] "←[37mGET /?algoStarted=true HTTP/1.1←[0m" 200 -
Hi Sreeni..
Can you add another tutorial on how to integrate webhook alerts from another site like chartink scanner in the algo.
thanks !
C:\Users\vin\AppData\Local\Microsoft\WindowsApps\python3.9.exe D:/aaa/sdoosa-algo-trade-python-master/src/main.py
Deploy Directory = D:/temp/python-deploy
LogFile Directory = D:/temp/python-deploy/logs
Process finished with exit code 0
For the strategies, we mostly depend on indicators. And we have this ta-lib library to compute all the required indicators with ease. So if we subscribe to kite historical data, for the given strategy, we should be able to pull the data from the historical data/data stored from OHLC created with ticker and compute technical indicators and integrate the exit or entry strategies.
Please mention steps to run locally i am new to this area
Hey it is such an amazing project. Can you please add some documentation to it so that people like me can understand how the project is working, like flow chart, diagrams representing various components, a good readme file, etc. Thanks in advance.
In the trade manager, everytime when get order manager method called, its creating new instance. Similar to strategy, Zerodha order manager also should follow singleton pattern to avoid creating multiple instance.
dear Srinivas,
thank you for such a great project. can you add a requirements.txt file mentioning all the libraries required for the code to run smoothly.
I hope you can do it as soon as possible.
Thank you
Dear Sir,
i have seen your codes they are well planned but as i am a newbie there are some spots where i need details..and your youtube videos are not working please revoke the link or allow me to see the private videos if any to [email protected]
WE HAVE INSTALLED ANACONDA JUPITER NOTEBOOK. NOW WE NEED YOUR HELP TO SETUP THIS STRATEGY IN IT AND HOW TO CONNECT THIS WITH ZERODHA KITE FOR AUTO TRADING.
I have one doubt. Please can you tell whether can we replace the "/apis/broker/login/zerodha" in html document with "https://kite.trade/connect/login?api_key=xx" or REST API is necessary there? I was watching this video - https://www.youtube.com/watch?v=3OuIO5wMkaU&t=2823s.
Can you give some pointers on what all needs to be added/changed to implement integration with AliceBlue. I have already started looking at your code, but directions from you will help develop it faster.
Hi Sreenivas,
This is excellent work. Would love to get in touch with you. Was trying to get to you through Twitter but somehow it is locked.
Meanwhile, can you check the access to your YouTube playlist. Many are not able to find it.
Regards
@sreenivasdoosa
Hi Srini,
I want to execute straddle strategy at 9:16, so I changed self.startTimestamp = Utils.getTimeOfToDay(9, 16, 0) BUT strategy is not executed.
From below logs i see wait time is applying to strategy as well...
2021-05-26 09:06:37: Algo started.
2021-05-26 09:06:37: ShortStraddleNF: Waiting for 503 seconds till market opens...
2021-05-26 09:15:00: ShortStraddleNF: Waiting for 563 seconds till startegy start timestamp reaches..._
Hi srini,
I am trying to pass cash stock list through a function in the samplestrategy.py but it picks up only the list which is available at start after that it does not update the list. i believe the strategy loops every 30 secs and therefore should update the stocks when its get updated during later executions ..
def init(self):
if SampleStrategy.__instance != None:
raise Exception("This class is a singleton!")
else:
SampleStrategy.__instance = self
# Call Base class constructor
super().init("SAMPLE")
# Initialize all the properties specific to this strategy
self.productType = ProductType.MIS
/*******here i have replaced the earlier hard coded list with a class function stocks.scripname thats picks up stocks and keeps on changing during the day/
****self.symbols = stocks.scripname()
self.slPercentage = 2
self.targetPercentage = 4
self.startTimestamp = Utils.getTimeOfToDay(9, 45, 0) # When to start the strategy. Default is Market start time
self.stopTimestamp = Utils.getTimeOfToDay(14, 0, 0) # This is not square off timestamp. This is the timestamp after which no new trades will be placed under this strategy but existing trades continue to be active.
self.squareOffTimestamp = Utils.getTimeOfToDay(14, 50, 0) # Square off time
self.capital = 5000 # Capital to trade (This is the margin you allocate from your broker account for this strategy)
self.leverage = 2 # 2x, 3x Etc
self.maxTradesPerDay = 6 # Max number of trades per day under this strategy
self.isFnO = False # Does this strategy trade in FnO or not
self.capitalPerSet = 0 # Applicable if isFnO is True (1 set means 1CE/1PE or 2CE/2PE etc based on your strategy logic)
Thanks for this wonderful framework. Appreciate your hardwork and sharing this with us.
Quick question. I would like to use multiple brokers (each strategy could use a different broker). How do I implement this.
Studied the Brokerapp and login mgmt config logic but its not clear how to set the broker specific to a strategy and how do I manage the flow accordingly. Any help in this direction would be much appreciated.
Thanks again!
Amazing articulation of the project and its working fine in real time.
Can a quick logic be provided for Trailing SL for sample strategy?
The TrailingSL logic in Shortstraddle seems working only for Short trades and not for Long trades
Usage of LTP of spot price instead of future price to select the near ATM strike. Most of retail uses stockmock to do backtest which is based on spot price.
import os
import logging
from flask import Flask
import sys
sys.path.append('D:\sdoosa-algo-trade-python-master\sdoosa-algo-trade-python-master\config')
from config.Config import getBrokerAppConfig, getServerConfig, getSystemConfig
Hello Sir,
The YouTube playlist is not available. Request you to upload it again.
https://www.youtube.com/playlist?list=PL-yBsBIJqqBn6oMMgLjvhCTNT-zLXYmoW
Hai bro, i'm new to algo trading I'm interested to learn my email [email protected] plz allow me to see ur videos bro that's my humble request I think bro u r accept me thank u bro
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.