return taken funding

This commit is contained in:
itsdeka
2023-01-30 14:51:57 +01:00
committed by Davide Casale
parent 0dd23b3ba5
commit 374739b656
4 changed files with 34 additions and 7 deletions

View File

@@ -186,6 +186,11 @@ class _RestAuthenticatedEndpoints(_Requests):
return [ serializers.FundingCredit.parse(*sub_data) for sub_data in self._POST(endpoint, data=data) ]
def submit_funding_close(self, id: int) -> Notification[Literal[None]]:
return serializers._Notification[Literal[None]]().parse(
*self._POST("auth/w/funding/close", data={ "id": id })
)
def submit_wallet_transfer(self, from_wallet: str, to_wallet: str, currency: str, currency_to: str, amount: Union[Decimal, float, str]) -> Notification[Transfer]:
data = {
"from": from_wallet, "to": to_wallet,

View File

@@ -319,8 +319,8 @@ Position = generate_labeler_serializer("Position", klass=types.Position, labels=
FundingOffer = generate_labeler_serializer("FundingOffer", klass=types.FundingOffer, labels=[
"id",
"symbol",
"mts_created",
"mts_updated",
"mts_create",
"mts_update",
"amount",
"amount_orig",
"offer_type",
@@ -477,8 +477,8 @@ Movement = generate_labeler_serializer("Movement", klass=types.Movement, labels=
"currency_name",
"_PLACEHOLDER",
"_PLACEHOLDER",
"mts_started",
"mts_updated",
"mts_start",
"mts_update",
"_PLACEHOLDER",
"_PLACEHOLDER",
"status",

View File

@@ -268,7 +268,7 @@ class FundingOffer(_Type):
notify: bool
hidden: int
renew: bool
@dataclass
class Trade(_Type):
id: int
@@ -383,8 +383,8 @@ class Movement(_Type):
id: str
currency: str
currency_name: str
mts_started: int
mts_updated: int
mts_start: int
mts_update: int
status: str
amount: int
fees: int

View File

@@ -0,0 +1,22 @@
# python -c "import examples.rest.return_taken_funding"
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")
)
loans = bfx.rest.auth.get_funding_loans(symbol="fUSD")
for loan in loans:
print(f"Loan {loan}")
notification = bfx.rest.auth.submit_funding_close(
id=loan.id
)
print("Funding close notification:", notification)