mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
login history + balance available
This commit is contained in:
@@ -14,6 +14,15 @@ class RestAuthenticatedEndpoints(Middleware):
|
|||||||
def get_user_info(self) -> UserInfo:
|
def get_user_info(self) -> UserInfo:
|
||||||
return serializers.UserInfo.parse(*self._POST(f"auth/r/info/user"))
|
return serializers.UserInfo.parse(*self._POST(f"auth/r/info/user"))
|
||||||
|
|
||||||
|
def get_login_history(self) -> LoginHistory:
|
||||||
|
return [ serializers.LoginHistory.parse(*sub_data) for sub_data in self._POST("auth/r/logins/hist") ]
|
||||||
|
|
||||||
|
def get_balance_available_for_orders_or_offers(self, symbol: str, type: str, dir: Optional[int] = None, rate: Optional[str] = None, lev: Optional[str] = None) -> BalanceAvailable:
|
||||||
|
return serializers.BalanceAvailable.parse(*self._POST("auth/calc/order/avail", body={
|
||||||
|
"symbol": symbol, "type": type, "dir": dir,
|
||||||
|
"rate": rate, "lev": lev
|
||||||
|
}))
|
||||||
|
|
||||||
def get_wallets(self) -> List[Wallet]:
|
def get_wallets(self) -> List[Wallet]:
|
||||||
return [ serializers.Wallet.parse(*sub_data) for sub_data in self._POST("auth/r/wallets") ]
|
return [ serializers.Wallet.parse(*sub_data) for sub_data in self._POST("auth/r/wallets") ]
|
||||||
|
|
||||||
|
|||||||
@@ -326,6 +326,21 @@ UserInfo = generate_labeler_serializer("UserInfo", klass=types.UserInfo, labels=
|
|||||||
"is_merchant_enterprise"
|
"is_merchant_enterprise"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
LoginHistory = generate_labeler_serializer("LoginHistory", klass=types.LoginHistory, labels=[
|
||||||
|
"id",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"time",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"ip",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"_PLACEHOLDER",
|
||||||
|
"extra_info"
|
||||||
|
])
|
||||||
|
|
||||||
|
BalanceAvailable = generate_labeler_serializer("BalanceAvailable", klass=types.BalanceAvailable, labels=[
|
||||||
|
"amount"
|
||||||
|
])
|
||||||
|
|
||||||
Order = generate_labeler_serializer("Order", klass=types.Order, labels=[
|
Order = generate_labeler_serializer("Order", klass=types.Order, labels=[
|
||||||
"id",
|
"id",
|
||||||
"gid",
|
"gid",
|
||||||
|
|||||||
@@ -228,6 +228,17 @@ class UserInfo(_Type):
|
|||||||
compl_countries_resid: List[str]
|
compl_countries_resid: List[str]
|
||||||
is_merchant_enterprise: int
|
is_merchant_enterprise: int
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class LoginHistory(_Type):
|
||||||
|
id: int
|
||||||
|
time: int
|
||||||
|
ip: str
|
||||||
|
extra_info: JSON
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class BalanceAvailable(_Type):
|
||||||
|
amount: float
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Order(_Type):
|
class Order(_Type):
|
||||||
id: int
|
id: int
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ def log_user_info():
|
|||||||
print(user_info)
|
print(user_info)
|
||||||
|
|
||||||
|
|
||||||
|
def log_login_history():
|
||||||
|
login_history = bfx.rest.auth.get_login_history()
|
||||||
|
print(login_history)
|
||||||
|
|
||||||
|
|
||||||
def log_wallets():
|
def log_wallets():
|
||||||
wallets = bfx.rest.auth.get_wallets()
|
wallets = bfx.rest.auth.get_wallets()
|
||||||
print("Wallets:")
|
print("Wallets:")
|
||||||
|
|||||||
Reference in New Issue
Block a user