position 每日持倉

Example

input
rp.position
output
date id direction qty entry_date entry_price CLOSE entry_cost market_value pnl
0 2022-04-15 TXF long 1 2022-04-15 17102 16983 -17106 16928 -178
1 2022-04-18 TXF long 1 2022-04-15 17102 16881 -17106 16826 -280
2 2022-04-19 TXF long 1 2022-04-15 17102 17000 -17106 16945 -161
3 2022-05-12 TXF long 1 2022-05-12 15801 15632 -15805 15581 -224
4 2022-05-13 TXF long 1 2022-05-12 15801 15851 -15805 15799 -6
... ... ... ... ... ... ... ... ... ... ...
595 2026-05-05 TXF long 1 2026-04-17 37145 41035 -37154 40902 3748
596 2026-05-06 TXF long 1 2026-04-17 37145 41503 -37154 41368 4214
597 2026-05-07 TXF long 1 2026-04-17 37145 42340 -37154 42202 5048
598 2026-05-08 TXF long 1 2026-04-17 37145 41937 -37154 41801 4647
599 2026-05-11 TXF long 1 2026-04-17 37145 41945 -37154 41809 4655

Return Attribute

Return type: Object DataFrame

參數 資料型態 說明
date datetime 日期
id object 交易標的代碼
direction object 交易方向,'long' or 'short'
long:代表"多"
short:代表"空"
qty float 交易股數
entry_date datetime 進場時間
entry_price float 進場價格
CLOSE float 在對應日期的收盤價
entry_cost float 進場時付出費用
market_value float 在對應日期的倉位市值
pnl float 在對應日期時的預估收益