Code Monkey home page Code Monkey logo

kite_zerodha's People

Contributors

tradeviapython 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

kite_zerodha's Issues

Not able to place order

When i execute place order, Getting below error:

File "C:\Users\Shivani\AppData\Local\Temp\ipykernel_42316\2603481076.py", line 1, in
order = kite.place_order(variety=kite.VARIETY_REGULAR,

File "E:\tradingincome\kite_trade.py", line 135, in place_order
order_id = self.session.post(f"{self.root_url}/orders/{variety}",

TypeError: 'NoneType' object is not subscriptable

I am getting exchange value not given although I have given the value

URL: https://api.kite.trade/orders/regular
HTTP METHOD USED : POST
Authorization: enctype RXh5wUmztLGjGbrGSN/92Gd
PayLoad:
{
"variety": "regular",
"exchange": "NSE",
"tradingsymbol": "NIFTY23SEP19300PE",
"transaction_type": "BUY",
"quantity": 1,
"product": "NRML",
"order_type": "MARKET",
"price": null,
"validity": null,
"disclosed_quantity": null,
"trigger_price": null,
"squareoff": null,
"stoploss": null,
"trailing_stoploss": null
}

Response received:

{
"status": "error",
"message": "Missing or empty field exchange",
"data": null,
"error_type": "InputException"
}

Can someone help?

GotThis Error Today

Traceback (most recent call last):
File "/home/ubuntu/Kite_Zerodha/main.py", line 21, in
data = kite.quote(["NSE:BANKBARODA"])
File "/home/ubuntu/Kite_Zerodha/kite_trade.py", line 89, in quote
data = self.session.get(f"{self.root_url}/quote", params={"i": instruments}, headers=self.headers).json()["data"]
KeyError: 'data'

Weekly Option Place Order Issue

Hello,

Getting below error while placing order for Weekly Option (Bank Nifty) : Able to fetch stream data for every one minute but placing order is creating error.

Is it because of no subscribe Kite API

Code :
kite = KiteApp(enctoken=enctoken) # Using from kite_trade import * to access Kite.

Symbol = kite.quote(["NFO:BANKNIFTY23D0644500PE"])

order = kite.place_order(variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NFO,
tradingsymbol= Symbol,
transaction_type=kite.TRANSACTION_TYPE_BUY,
quantity=1,
product=kite.PRODUCT_MIS,
order_type=kite.ORDER_TYPE_MARKET,
price=None,
validity=None,
disclosed_quantity=None,
trigger_price=None,
squareoff=None,
stoploss=None,
trailing_stoploss=None,
tag="RVS")
print(order)

Error:
Request failed with status code: 400
b'{"status":"error","message":"The instrument you are placing an order for has either expired or does not exist.","data":null,"error_type":"InputException"}'
None

Basket order

How can we place a basket orders with stop loss?

After some time I get connection error

Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\urllib3\connectionpool.py", line 790, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\urllib3\connectionpool.py", line 536, in _make_request
response = conn.getresponse()
^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\urllib3\connection.py", line 454, in getresponse
httplib_response = super().getresponse()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 1378, in getresponse
response.begin()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 318, in begin
version, status, reason = self._read_status()
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\http\client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Holdings function

Please merge this in master branch

def holdings(self):
    holdings = self.session.get(f"{self.root_url}/portfolio/holdings", headers=self.headers).json()["data"]
    return holdings

print(kite.holdings())

It seem its no more working.

getting bad request error . {'status': 'error', 'message': 'Bad Request', 'error_type': 'InputException'}
kite.ltp("NSE:INFY")

it used to work.
not any more for me.

place_order API is not working, tried many times

Dear TradeViaPython Team,

Thank you so much for your content on youtube and github, I am your follower and learning a lot from you. Keep up good work!

I am having trouble while testing place_order API described in the github description, I just copied the example and test it without modifying anything, but it is throwing error. Kindly suggest

  1. How can we avoid this error ?
  2. If this error is unavoidable, how can we handle inside the code ?

Error description is below:
API Triggered:

Place Order

order = kite.place_order(variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NSE,
tradingsymbol="ACC",
transaction_type=kite.TRANSACTION_TYPE_BUY,
quantity=1,
product=kite.PRODUCT_MIS,
order_type=kite.ORDER_TYPE_MARKET,
price=None,
validity=None,
disclosed_quantity=None,
trigger_price=None,
squareoff=None,
stoploss=None,
trailing_stoploss=None,
tag="TradeViaPython")

Error received:
Traceback (most recent call last):
File "D:\INVESTMENTS\ALGO\code _v7.5\main\swing_trade_nifty.py", line 42, in
order = kite.place_order(variety=kite.VARIETY_REGULAR,
File "D:\INVESTMENTS\ALGO\code _v7.5\main\kite_trade.py", line 134, in place_order
order_id = self.session.post(f"{self.root_url}/orders/{variety}",
TypeError: 'NoneType' object is not subscriptable

Not able to place order

I have used the exact same code as given in GITHUB to place the order

Traceback (most recent call last):
File "C:\Users\HP\KiteTrading.py", line 25, in
order = kite.place_order(variety=kite.VARIETY_REGULAR,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HP\kite_trade.py", line 134, in place_order
order_id = self.session.post(f"{self.root_url}/orders/{variety}",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

issue while fetching historic data

all the fuctions working for me except fetching historic data. The error:-

  • Traceback (most recent call last):
  • File "C:\Users\admin\Downloads\kite\main.py", line 11, in
  • print(kite.historical_data(instrument_token, from_datetime, to_datetime, interval, continuous=False, oi=False))
    
  • File "C:\Users\admin\Downloads\kite\kite_trade.py", line 102, in historical_data
  • lst = self.session.get(
    
  • TypeError: 'NoneType' object is not subscriptable

Order Margins

Can you give code to be added to kite_trade.py file so that order margins can be fetched to check how much margin is required for a particular order?

Connection error

Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (400 - BadRequest))
Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (400 - BadRequest))
Connection error: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (400 - BadRequest))
Connection closed: 1006 - connection was closed uncleanly (WebSocket connection upgrade failed (400 - BadRequest))

Quote Query

Hi I had ran below code to get quote detail of NIFTY SEP future,

print(kite.quote(["NFO:NIFTY29SEPFUT"]))

I am getting empty dictionary, But if i run for option strike i am getting quote details.

Get Historical Data not update in while loop... every time same json output ...

for Ex.
instrument_token = 9604354
from_datetime = datetime.datetime.now() - datetime.timedelta(days=7) # From last & days
to_datetime = datetime.datetime.now()
interval = "5minute"
while True:
t.sleep(1)
if datetime.now().minute % 5 == 0 and datetime.now().second == 10:
get_data = kite.historical_data(instrument_token, from_datetime, to_datetime, interval, continuous=False, oi=False)
print(get_data)

Ability to fetch OHLC data for a given instrument

Please introduce ohlc method in the KiteApp with the below implementation
def ohlc(self, instruments):
data = self.session.get(f"{self.root_url}/quote/ohlc", params={"i": instruments}, headers=self.headers).json()["data"]
return data

basket order

How can we modify 'kite_trade.py' file for placing basket order with any number of legs?

Not able to place order

HI,
getting this error while placing order.

ERROR:"TypeError: KiteApp.place_order() got an unexpected keyword argument 'squareoff'"

using this code :
order = kite.place_order(variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NSE,
tradingsymbol="ACC",
transaction_type=kite.TRANSACTION_TYPE_BUY,
quantity=1,
product=kite.PRODUCT_MIS,
order_type=kite.ORDER_TYPE_MARKET,
price=None,
validity=None,
disclosed_quantity=None,
trigger_price=None,
squareoff=None,
stoploss=None,
trailing_stoploss=None,
tag="TradeViaPython")

print(order)

thanks in advance

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.