Add support for event funding_info_update.

This commit is contained in:
Davide Casale
2024-04-24 17:20:00 +02:00
parent a72a9475c0
commit 847d887bab
5 changed files with 14 additions and 2 deletions

View File

@@ -551,7 +551,7 @@ class RestAuthEndpoints(Interface):
def get_funding_info(self, key: str) -> FundingInfo:
return serializers.FundingInfo.parse(
*(self._m.post(f"auth/r/info/funding/{key}")[2])
*self._m.post(f"auth/r/info/funding/{key}")
)
def transfer_between_wallets(

View File

@@ -428,6 +428,7 @@ class FundingAutoRenew(_Type):
@dataclass()
class FundingInfo(_Type):
symbol: str
yield_loan: float
yield_lend: float
duration_loan: float

View File

@@ -632,7 +632,15 @@ FundingAutoRenew = generate_labeler_serializer(
FundingInfo = generate_labeler_serializer(
name="FundingInfo",
klass=dataclasses.FundingInfo,
labels=["yield_loan", "yield_lend", "duration_loan", "duration_lend"],
labels=[
"_PLACEHOLDER",
"symbol",
"yield_loan",
"yield_lend",
"duration_loan",
"duration_lend",
],
flat=True,
)
Wallet = generate_labeler_serializer(

View File

@@ -66,6 +66,7 @@ _COMMON = [
"wallet_update",
"base_margin_info",
"symbol_margin_info",
"funding_info_update",
"notification",
"on-req-notification",
"ou-req-notification",

View File

@@ -33,6 +33,7 @@ class AuthEventsHandler:
"flc": "funding_loan_close",
"ws": "wallet_snapshot",
"wu": "wallet_update",
"fiu": "funding_info_update",
}
__SERIALIZERS: Dict[Tuple[str, ...], serializers._Serializer] = {
@@ -43,6 +44,7 @@ class AuthEventsHandler:
("fcs", "fcn", "fcu", "fcc"): serializers.FundingCredit,
("fls", "fln", "flu", "flc"): serializers.FundingLoan,
("ws", "wu"): serializers.Wallet,
("fiu",): serializers.FundingInfo,
}
def __init__(self, event_emitter: EventEmitter) -> None: