Skip to content

Profit Loss

First, you need login.

In

api.list_profit_loss(api.stock_account,'2020-05-05','2020-05-30')

Out

[ProfitLoss(id=0, code='2890', seqno='14816', dseq='ID111', quantity=1, price=10.1, pnl=1234.0, pr_ratio=0.1237, cond='Cash', date='2020-05-22')]

In

profitloss = api.list_profit_loss(api.stock_account,'2020-05-05','2020-05-30')   
df = pd.DataFrame(profitloss)     
df     

Out

id code cond date pnl pr_ratio price quantity seqno dseq
0 2890 StockOrderCond.Cash 2020-05-22 1000.0 0.1237 10.1 1 14816 ID111

Attributes:

id (int): use to find detail.
code (str): contract id.
seqno (str): seqno no.
dseq (str): seqno no.
quantity (int): quantity.
price (float): price.
pnl (float): profit and loss.
pr_ratio (float): profit rate.
cond (StockOrderCond): {Cash, Netting, MarginTrading, ShortSelling}
date (str): trade date.