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) ]
|
||||
|
||||
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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
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