Tracking Last Price,Profit and Loss fetching Everything from JSON KiteConnect Requests in Python




import requests,time,json


def main():
    r = requests.get('https://api.kite.trade/portfolio/positions/api_key=your_api_key&access_token=your_tok')
##    r = requests.get('https://api.kite.trade/instruments/MCX/GOLD17OCTFUT?api_key=xxx&access_token=yy')
    rjson=r.json()
##    print(rjson)
    r1=rjson['data']['last_price']
    r1=rjson['data']['last_time']

    
    
    print(r1)
##

while True:
    main()
    time.sleep(5)