Skip to content

結算

用於查詢交割款,需要先登錄

Settlements

In

api.settlements?

Out

Signature:
api.settlements(
    account: shioaji.account.Account = None,
    timeout: int = 5000,
    cb: Callable[[List[shioaji.position.Settlement]], NoneType] = None,
) -> List[shioaji.position.Settlement]
Docstring: query stock account of settlements 

In

settlement = api.settlements(api.stock_account)   
settlement

Out

[
    SettlementV1(
        date=datetime.date(2022, 10, 13), 
        amount=0.0, 
        T=0
    ),
    SettlementV1(
        date=datetime.date(2022, 10, 14), 
        amount=0.0, 
        T=1
    ),
    SettlementV1(
        date=datetime.date(2022, 10, 17), 
        amount=0.0, 
        T=2
    )
]

In

pd.DataFrame(s.__dict__ for s in settlement).set_index("T")

out

T date amount
0 2022-10-13 0
1 2022-10-14 0
2 2022-10-17 0

SettlementV1

date (datetime.date): 交割日期
amount (float): 交割金額
T (int): Tday

List settlements

注意

V1.0版本將移除該功能,建議使用結算新功能Settlements.

In

api.list_settlements?

Out

Signature:
api.list_settlements(
    account: shioaji.account.Account = None,
    timeout: int = 5000,
    cb: Callable[[List[shioaji.position.Settlement]], NoneType] = None,
) -> List[shioaji.position.Settlement]
Docstring: query stock account of settlements 

In

settlement = api.list_settlements(api.stock_account)   
df = pd.DataFrame(settlement)     
df     

Out

tmoney t1_money t2_money t_day t1_day t2_day
120523.0 0.0 0.0 '2020-06-03' '2020-06-04' '2020-06-05'

Settlements

t_money (float): T日交割款
t1_money (float): T + 1 日交割款
t2_money (float): T + 2 日交割款
t_day (str): T 日期
t1_day (str): T + 1 日期
t2_day (str): T + 2 日期