Skip to content

Settlements

Settlements

The feature of settlements is used to query settlements of stock account and you need to login first.

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

Attributes:

date (datetime.date): date of Tday
amount (float): settlement amount
T (int): Tday

List settlements

⚠️ Warning: The feature will be removed in the V1.0 and suggest using the new feature of 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'

Attributes:

t_money (float): T settlement
t1_money (float): T + 1 settlement
t2_money (float): T + 2 settlement
t_day (str): T
t1_day (str): T + 1
t2_day (str): T + 2