cannot get margin.

sanket_one
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /user/margins HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /quote/ohlc?i=NSE%3AAMARAJABAT HTTP/1.1" 200 None
for_ltp {'NSE:AMARAJABAT': {'instrument_token': 25601, 'last_price': 615.25, 'ohlc': {'open': 612.4, 'high': 623.95, 'low': 603, 'close': 614.4}}}
ltp 615.25
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (None)
inside theeeee error block
connection was closed uncleanly (None)
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (None)

############################
i was trying to fetch my margin before placing order.
def buy(name):
account = kite.margins()
balance = account['equity']['available']['live_balance']
name_of_ohlc = "NSE:"+name
for_ltp = kite.ohlc(name_of_ohlc)
ltp = for_ltp[name_of_ohlc]['last_price']
#buy

def ohlc_maker():
#code
buy(name)

def on_ticks():
ohlc_maker()

can someone help me. i am new to python and concept of threading, according to one post i tried to not do calculations in on_ticks(). is there anything more i need to do?
Sign In or Register to comment.