mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
return taken funding
This commit is contained in:
@@ -186,6 +186,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 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]:
|
def submit_wallet_transfer(self, from_wallet: str, to_wallet: str, currency: str, currency_to: str, amount: Union[Decimal, float, str]) -> Notification[Transfer]:
|
||||||
data = {
|
data = {
|
||||||
"from": from_wallet, "to": to_wallet,
|
"from": from_wallet, "to": to_wallet,
|
||||||
|
|||||||
@@ -319,8 +319,8 @@ Position = generate_labeler_serializer("Position", klass=types.Position, labels=
|
|||||||
FundingOffer = generate_labeler_serializer("FundingOffer", klass=types.FundingOffer, labels=[
|
FundingOffer = generate_labeler_serializer("FundingOffer", klass=types.FundingOffer, labels=[
|
||||||
"id",
|
"id",
|
||||||
"symbol",
|
"symbol",
|
||||||
"mts_created",
|
"mts_create",
|
||||||
"mts_updated",
|
"mts_update",
|
||||||
"amount",
|
"amount",
|
||||||
"amount_orig",
|
"amount_orig",
|
||||||
"offer_type",
|
"offer_type",
|
||||||
@@ -477,8 +477,8 @@ Movement = generate_labeler_serializer("Movement", klass=types.Movement, labels=
|
|||||||
"currency_name",
|
"currency_name",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"mts_started",
|
"mts_start",
|
||||||
"mts_updated",
|
"mts_update",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"status",
|
"status",
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ class FundingOffer(_Type):
|
|||||||
notify: bool
|
notify: bool
|
||||||
hidden: int
|
hidden: int
|
||||||
renew: bool
|
renew: bool
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Trade(_Type):
|
class Trade(_Type):
|
||||||
id: int
|
id: int
|
||||||
@@ -383,8 +383,8 @@ class Movement(_Type):
|
|||||||
id: str
|
id: str
|
||||||
currency: str
|
currency: str
|
||||||
currency_name: str
|
currency_name: str
|
||||||
mts_started: int
|
mts_start: int
|
||||||
mts_updated: int
|
mts_update: int
|
||||||
status: str
|
status: str
|
||||||
amount: int
|
amount: int
|
||||||
fees: int
|
fees: int
|
||||||
|
|||||||
22
examples/rest/return_taken_funding.py
Normal file
22
examples/rest/return_taken_funding.py
Normal 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)
|
||||||
Reference in New Issue
Block a user