mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-18 22:34:21 +01:00
user info + fixs
This commit is contained in:
@@ -11,6 +11,9 @@ from datetime import datetime
|
||||
from ..middleware import Middleware
|
||||
|
||||
class RestAuthenticatedEndpoints(Middleware):
|
||||
def get_user_info(self) -> UserInfo:
|
||||
return serializers.UserInfo.parse(*self._POST(f"auth/r/info/user"))
|
||||
|
||||
def get_wallets(self) -> List[Wallet]:
|
||||
return [ serializers.Wallet.parse(*sub_data) for sub_data in self._POST("auth/r/wallets") ]
|
||||
|
||||
|
||||
@@ -268,6 +268,64 @@ FxRate = generate_labeler_serializer("FxRate", klass=types.FxRate, labels=[
|
||||
|
||||
#region Serializers definition for Rest Authenticated Endpoints
|
||||
|
||||
UserInfo = generate_labeler_serializer("UserInfo", klass=types.UserInfo, labels=[
|
||||
"id",
|
||||
"email",
|
||||
"username",
|
||||
"mts_account_create",
|
||||
"verified",
|
||||
"verification_level",
|
||||
"_PLACEHOLDER",
|
||||
"timezone",
|
||||
"locale",
|
||||
"company",
|
||||
"email_verified",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"mts_master_account_create",
|
||||
"group_id",
|
||||
"master_account_id",
|
||||
"inherit_master_account_verification",
|
||||
"is_group_master",
|
||||
"group_withdraw_enabled",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"ppt_enabled",
|
||||
"merchant_enabled",
|
||||
"competition_enabled",
|
||||
"two_factors_authentication_modes",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"is_securities_master",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"securities_enabled",
|
||||
"allow_disable_ctxswitch",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"time_last_login",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"ctxtswitch_disabled",
|
||||
"_PLACEHOLDER",
|
||||
"comp_countries",
|
||||
"compl_countries_resid",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"is_merchant_enterprise"
|
||||
])
|
||||
|
||||
Order = generate_labeler_serializer("Order", klass=types.Order, labels=[
|
||||
"id",
|
||||
"gid",
|
||||
|
||||
@@ -197,6 +197,37 @@ class FxRate(_Type):
|
||||
|
||||
#region Type hinting for Rest Authenticated Endpoints
|
||||
|
||||
@dataclass
|
||||
class UserInfo(_Type):
|
||||
id: int
|
||||
email: str
|
||||
username: str
|
||||
mts_account_create: int
|
||||
verified: int
|
||||
verification_level: int
|
||||
timezone: str
|
||||
locale: str
|
||||
company: str
|
||||
email_verified: int
|
||||
mts_master_account_create: int
|
||||
group_id: int
|
||||
master_account_id: int
|
||||
inherit_master_account_verification: int
|
||||
is_group_master: int
|
||||
group_withdraw_enabled: int
|
||||
ppt_enabled: int
|
||||
merchant_enabled: int
|
||||
competition_enabled: int
|
||||
two_factors_authentication_modes: List[str]
|
||||
is_securities_master: int
|
||||
securities_enabled: int
|
||||
allow_disable_ctxswitch: int
|
||||
ctxtswitch_disabled: int
|
||||
time_last_login: int
|
||||
comp_countries: List[str]
|
||||
compl_countries_resid: List[str]
|
||||
is_merchant_enterprise: int
|
||||
|
||||
@dataclass
|
||||
class Order(_Type):
|
||||
id: int
|
||||
|
||||
@@ -14,7 +14,7 @@ notification = bfx.rest.auth.toggle_auto_renew(
|
||||
status=True,
|
||||
currency="USD",
|
||||
amount="150",
|
||||
rate="0",
|
||||
rate="0", # FRR
|
||||
period=2
|
||||
)
|
||||
|
||||
|
||||
@@ -13,6 +13,12 @@ bfx = Client(
|
||||
|
||||
now = int(round(time.time() * 1000))
|
||||
|
||||
|
||||
def log_user_info():
|
||||
user_info = bfx.rest.auth.get_user_info()
|
||||
print(user_info)
|
||||
|
||||
|
||||
def log_wallets():
|
||||
wallets = bfx.rest.auth.get_wallets()
|
||||
print("Wallets:")
|
||||
@@ -38,14 +44,14 @@ def log_positions():
|
||||
|
||||
|
||||
def log_trades():
|
||||
trades = bfx.rest.auth.get_trades(symbol='tBTCUSD', start=0, end=now)
|
||||
trades = bfx.rest.auth.get_trades_history(symbol='tBTCUSD', start=0, end=now)
|
||||
print("Trades:")
|
||||
[print(t) for t in trades]
|
||||
|
||||
|
||||
def log_order_trades():
|
||||
order_id = 82406909127
|
||||
trades = bfx.rest.auth.get_order_trades(symbol='tBTCUSD', order_id=order_id)
|
||||
trades = bfx.rest.auth.get_order_trades(symbol='tBTCUSD', id=order_id)
|
||||
print("Trade orders:")
|
||||
[print(t) for t in trades]
|
||||
|
||||
@@ -96,6 +102,7 @@ def log_margin_info():
|
||||
print(f"Base margin info {base_margin_info}")
|
||||
|
||||
def run():
|
||||
log_user_info()
|
||||
log_wallets()
|
||||
log_orders()
|
||||
log_orders_history()
|
||||
|
||||
Reference in New Issue
Block a user