funding auto renew

This commit is contained in:
itsdeka
2023-01-30 15:16:48 +01:00
committed by Davide Casale
parent 374739b656
commit 0ac14dfeb5
4 changed files with 42 additions and 0 deletions

View File

@@ -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,

View File

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

View File

@@ -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

View 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)