Giter VIP home page Giter VIP logo

sdoosa-algo-trade-python's People

Contributors

sreenivasdoosa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdoosa-algo-trade-python's Issues

Strategy is not executed if I change start time to 9:16

@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..._

Documentation

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.

Error in Fetch instruments

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

  • Serving Flask app 'main' (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: on
    Deploy Directory = D:/temp/python-deploy
    LogFile Directory = D:/temp/python-deploy/logs
    Exception in thread Thread-8:
    Traceback (most recent call last):
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\threading.py", line 910, in run
    self._target(*self._args, **self.kwargs)
    File "D:\aaa\sdoosa-algo-trade-python-master\src\core\Algo.py", line 26, in startAlgo
    Instruments.fetchInstruments()
    File "D:\aaa\sdoosa-algo-trade-python-master\src\instruments\Instruments.py", line 75, in fetchInstruments
    instrumentsList = Instruments.loadInstruments()
    File "D:\aaa\sdoosa-algo-trade-python-master\src\instruments\Instruments.py", line 41, in loadInstruments
    instruments = json.loads(isdFile.read())
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\json_init
    .py", line 346, in loads
    return _default_decoder.decode(s)
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 866003 column 5 (char 20569415)

Process finished with exit code 0

Hai bro

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

Great work!!

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

#AttributeError: 'NoneType' object has no attribute

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 -

NameError: name 'getTimeOfDay' is not defined

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,

Multi-broker config

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!

Starting reverse trade from Stoploss

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.

List of libraries

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

Multiple instance of Zerodha Order Manager

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.

Error: ModuleNotFoundError: No module named 'config.Config'

Please suggest on how to correct this error.
I added pythonpath ':\sdoosa-algo-trade-python-master\sdoosa-algo-trade-python-master\config but still getting the same error

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

dynamically passing stocklist to samplestrategy: Not picking updated list

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)

Logic for TrailingSL for Sample strategy

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

Can you add technical indicator support please

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.

youtube link not working

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]

AliceBlue Broker Integration

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.

Fyers integration

Has anyone done integration with Fyers V2? It has ticker-wise order update included recently.
Please share if done. Thanks in advance.

Fetching open positions

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)

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.