mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Add get_funding_loans and get_funding_loans_history endpoints to _RestAuthenticatedEndpoints.py.
This commit is contained in:
@@ -148,6 +148,25 @@ class _RestAuthenticatedEndpoints(_Requests):
|
|||||||
|
|
||||||
return [ serializers.FundingOffer.parse(*sub_data) for sub_data in self._POST(endpoint, data=data) ]
|
return [ serializers.FundingOffer.parse(*sub_data) for sub_data in self._POST(endpoint, data=data) ]
|
||||||
|
|
||||||
|
def get_funding_loans(self, symbol: Optional[str] = None) -> List[FundingLoan]:
|
||||||
|
if symbol == None:
|
||||||
|
endpoint = "auth/r/funding/loans"
|
||||||
|
else: endpoint = f"auth/r/funding/loans/{symbol}"
|
||||||
|
|
||||||
|
return [ serializers.FundingLoan.parse(*sub_data) for sub_data in self._POST(endpoint) ]
|
||||||
|
|
||||||
|
def get_funding_loans_history(self, symbol: Optional[str] = None, start: Optional[str] = None, end: Optional[str] = None, limit: Optional[int] = None) -> List[FundingLoan]:
|
||||||
|
if symbol == None:
|
||||||
|
endpoint = "auth/r/funding/loans/hist"
|
||||||
|
else: endpoint = f"auth/r/funding/loans/{symbol}/hist"
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"start": start, "end": end,
|
||||||
|
"limit": limit
|
||||||
|
}
|
||||||
|
|
||||||
|
return [ serializers.FundingLoan.parse(*sub_data) for sub_data in self._POST(endpoint, data=data) ]
|
||||||
|
|
||||||
def get_funding_credits(self, symbol: Optional[str] = None) -> List[FundingCredit]:
|
def get_funding_credits(self, symbol: Optional[str] = None) -> List[FundingCredit]:
|
||||||
if symbol == None:
|
if symbol == None:
|
||||||
endpoint = "auth/r/funding/credits"
|
endpoint = "auth/r/funding/credits"
|
||||||
|
|||||||
@@ -382,6 +382,31 @@ Ledger = generate_labeler_serializer("Ledger", klass=types.Ledger, labels=[
|
|||||||
"description"
|
"description"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
FundingLoan = generate_labeler_serializer("FundingLoan", klass=types.FundingLoan, labels=[
|
||||||
|
"id",
|
||||||
|
"symbol",
|
||||||
|
"side",
|
||||||
|
"mts_create",
|
||||||
|
"mts_update",
|
||||||
|
"amount",
|
||||||
|
"flags",
|
||||||
|
"status",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"rate",
|
||||||
|
"period",
|
||||||
|
"mts_opening",
|
||||||
|
"mts_last_payout",
|
||||||
|
"notify",
|
||||||
|
"hidden",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"renew",
|
||||||
|
"rate_real",
|
||||||
|
"no_close"
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
FundingCredit = generate_labeler_serializer("FundingCredit", klass=types.FundingCredit, labels=[
|
FundingCredit = generate_labeler_serializer("FundingCredit", klass=types.FundingCredit, labels=[
|
||||||
"id",
|
"id",
|
||||||
"symbol",
|
"symbol",
|
||||||
|
|||||||
@@ -306,6 +306,26 @@ class Ledger(_Type):
|
|||||||
balance: float
|
balance: float
|
||||||
description: str
|
description: str
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class FundingLoan(_Type):
|
||||||
|
id: int
|
||||||
|
symbol: str
|
||||||
|
side: int
|
||||||
|
mts_create: int
|
||||||
|
mts_update: int
|
||||||
|
amount: float
|
||||||
|
flags: int
|
||||||
|
status: str
|
||||||
|
rate: float
|
||||||
|
period: int
|
||||||
|
mts_opening: int
|
||||||
|
mts_last_payout: int
|
||||||
|
notify: int
|
||||||
|
hidden: int
|
||||||
|
renew: int
|
||||||
|
rate_real: float
|
||||||
|
no_close: int
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class FundingCredit(_Type):
|
class FundingCredit(_Type):
|
||||||
id: int
|
id: int
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ def log_funding_loans():
|
|||||||
|
|
||||||
|
|
||||||
def log_funding_loans_history():
|
def log_funding_loans_history():
|
||||||
loans = bfx.rest.auth.get_funding_loan_history(symbol='fUSD', start=0, end=now)
|
loans = bfx.rest.auth.get_funding_loans_history(symbol='fUSD', start=0, end=now)
|
||||||
print("Funding loan history:")
|
print("Funding loan history:")
|
||||||
[print(l) for l in loans]
|
[print(l) for l in loans]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user