osparamatrix / ks-orderapi-python

47 stars 59 forks source link

@osparamatrix how do we use the portfolio api to get pnl statement #35

Closed kalilinux-png closed 3 years ago

kalilinux-png commented 3 years ago

hello @osparamatrix sir would you please tell us how to use portfolio api's get method it will be a great help by your side if you clear this doubt

kalilinux-png commented 3 years ago

we can do it using a for loop in orders

nishu88 commented 3 years ago

@kalilinux-png Hey, can you share the script?

kalilinux-png commented 3 years ago

@nishu88 first of all there is two kind of pnl first one is realized ( pnl from open positions) and the second one is actual pnl (which is from your today's position which are closed or open) `net_profit=0 for k in client.positions('OPEN')['Success']: net_profit=k['realizedPL'] print(net_profit)' try this is out let me know if it does not work