I am using below code and I am getting "two pnl" for two different stocks, I am not sure how to get difference for these "two pnl" to determine net profit.I also attached output screen for your knowledge
import requests,time,json,sys def main():
holding1 = requests.get("https://api.kite.trade/portfolio/positions/?api_key=myapi key&access_token=my token") holdjson =holding1.json() print(holdjson) ##hold1 = holdjson['data']['net'][0]['buy_pnl'] ##not sure ,its not working ##hold2 = holdjson['data']['net'][0]['sell_pnl'] ##not sure ,its not working
import requests,time,json,sys
def main():
holding1 = requests.get("https://api.kite.trade/portfolio/positions/?api_key=myapi key&access_token=my token")
holdjson =holding1.json()
print(holdjson)
##hold1 = holdjson['data']['net'][0]['buy_pnl'] ##not sure ,its not working
##hold2 = holdjson['data']['net'][0]['sell_pnl'] ##not sure ,its not working
hold1 = holdjson['data']['net'][0]['pnl']
hold2 = holdjson['data']['net'][1]['pnl']