funding info

Co-Authored-By: itsdeka <dario.moceri@bitfinex.com>
This commit is contained in:
Davide Casale
2023-01-30 17:31:07 +01:00
parent 01d638cf9c
commit b9850fa451
4 changed files with 34 additions and 0 deletions

View File

@@ -188,6 +188,11 @@ class _RestAuthenticatedEndpoints(_Requests):
return [ serializers.FundingCredit.parse(*sub_data) for sub_data in self._POST(endpoint, data=data) ] return [ serializers.FundingCredit.parse(*sub_data) for sub_data in self._POST(endpoint, data=data) ]
def get_funding_info(self, key: str) -> FundingInfo:
response = self._POST(f"auth/r/info/funding/{key}")
return serializers.FundingInfo.parse(*([response[1]] + response[2]))
def submit_funding_close(self, id: int) -> Notification[Literal[None]]: def submit_funding_close(self, id: int) -> Notification[Literal[None]]:
return serializers._Notification[Literal[None]](serializer=None).parse( return serializers._Notification[Literal[None]](serializer=None).parse(
*self._POST("auth/w/funding/close", data={ "id": id }) *self._POST("auth/w/funding/close", data={ "id": id })

View File

@@ -438,6 +438,14 @@ FundingAutoRenew = generate_labeler_serializer("FundingAutoRenew", klass=types.F
"threshold" "threshold"
]) ])
FundingInfo = generate_labeler_serializer("FundingInfo", klass=types.FundingInfo, labels=[
"symbol",
"yield_loan",
"yield_lend",
"duration_loan",
"duration_lend"
])
Transfer = generate_labeler_serializer("Transfer", klass=types.Transfer, labels=[ Transfer = generate_labeler_serializer("Transfer", klass=types.Transfer, labels=[
"mts", "mts",
"wallet_from", "wallet_from",

View File

@@ -354,6 +354,14 @@ class FundingAutoRenew(_Type):
rate: float rate: float
threshold: float threshold: float
@dataclass()
class FundingInfo(_Type):
symbol: str
yield_loan: float
yield_lend: float
duration_loan: float
duration_lend: float
@dataclass @dataclass
class Transfer(_Type): class Transfer(_Type):
mts: int mts: int

View File

@@ -0,0 +1,13 @@
# python -c "import examples.rest.get_funding_info"
import os
from bfxapi.client import Client, Constants
bfx = Client(
REST_HOST=Constants.REST_HOST,
API_KEY=os.getenv("BFX_API_KEY"),
API_SECRET=os.getenv("BFX_API_SECRET")
)
print(bfx.rest.auth.get_funding_info(key="fUSD"))