Skip to content

Commit 18ea1ef

Browse files
authored
Fix ASX market status check and cash available trade settlement type (#180)
* fix: treat ASX ACTIVE status as open and allow float trade settlement * fix: allow fractional values for pending buys, withdrawals and settlement hold
1 parent a37dedf commit 18ea1ef

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎stake/asx/funding.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ class CashAvailable(BaseModel):
109109
cash_available_for_withdrawal_hold: Optional[float] = None
110110
cash_available_for_withdrawal: Optional[float] = None
111111
clearing_cash: Optional[float] = None
112-
pending_buys: Optional[int] = None
113-
pending_withdrawals: Optional[int] = None
112+
pending_buys: Optional[float] = None
113+
pending_withdrawals: Optional[float] = None
114114
settled_cash: Optional[float] = None
115-
settlement_hold: Optional[int] = None
116-
trade_settlement: Optional[int] = None
115+
settlement_hold: Optional[float] = None
116+
trade_settlement: Optional[float] = None
117117
model_config = ConfigDict(alias_generator=camelcase)
118118

119119

‎stake/asx/market.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ async def get(self) -> MarketStatus:
3131

3232
async def is_open(self) -> bool:
3333
status = await self.get()
34-
return status.status.current == "open"
34+
current = status.status.current.lower()
35+
# ASX returns "ACTIVE" when market is open, "CLOSED" when closed
36+
return current in ("open", "active")

‎stake/market.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ async def get(self) -> MarketStatus:
2828

2929
async def is_open(self) -> bool:
3030
status = await self.get()
31-
return status.status.current == "open"
31+
return status.status.current.lower() == "open"

0 commit comments

Comments
 (0)