mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
funding auto renew
This commit is contained in:
@@ -191,6 +191,13 @@ class _RestAuthenticatedEndpoints(_Requests):
|
||||
*self._POST("auth/w/funding/close", data={ "id": id })
|
||||
)
|
||||
|
||||
def submit_funding_toggle_auto_renew(self, status: bool, currency: str, amount: Optional[str] = None, rate: Optional[int] = None, period: Optional[int] = None) -> Notification[FundingAutoRenew]:
|
||||
return serializers._Notification[FundingAutoRenew](serializer=serializers.FundingAutoRenew).parse(*self._POST("auth/w/funding/auto", data={
|
||||
"status": int(status),
|
||||
"currency": currency, "amount": amount,
|
||||
"rate": rate, "period": period
|
||||
}))
|
||||
|
||||
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,
|
||||
|
||||
@@ -431,6 +431,13 @@ FundingCredit = generate_labeler_serializer("FundingCredit", klass=types.Funding
|
||||
"position_pair"
|
||||
])
|
||||
|
||||
FundingAutoRenew = generate_labeler_serializer("FundingAutoRenew", klass=types.FundingAutoRenew, labels=[
|
||||
"currency",
|
||||
"period",
|
||||
"rate",
|
||||
"threshold"
|
||||
])
|
||||
|
||||
Transfer = generate_labeler_serializer("Transfer", klass=types.Transfer, labels=[
|
||||
"mts",
|
||||
"wallet_from",
|
||||
|
||||
@@ -347,6 +347,13 @@ class FundingCredit(_Type):
|
||||
no_close: int
|
||||
position_pair: str
|
||||
|
||||
@dataclass
|
||||
class FundingAutoRenew(_Type):
|
||||
currency: str
|
||||
period: int
|
||||
rate: float
|
||||
threshold: float
|
||||
|
||||
@dataclass
|
||||
class Transfer(_Type):
|
||||
mts: int
|
||||
|
||||
21
examples/rest/funding_auto_renew.py
Normal file
21
examples/rest/funding_auto_renew.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# python -c "import examples.rest.funding_auto_renew"
|
||||
|
||||
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")
|
||||
)
|
||||
|
||||
notification = bfx.rest.auth.submit_funding_toggle_auto_renew(
|
||||
status=True,
|
||||
currency="USD",
|
||||
amount="150",
|
||||
rate="0",
|
||||
period=2
|
||||
)
|
||||
|
||||
print("Renew toggle notification:", notification)
|
||||
Reference in New Issue
Block a user