Apply black to all python files (bfxapi/**/*.py).

This commit is contained in:
Davide Casale
2024-02-26 19:43:14 +01:00
parent 2b7dfc5b8a
commit 38dbff1141
33 changed files with 1843 additions and 1335 deletions

View File

@@ -3,12 +3,14 @@ from typing import Any, Dict, List, Literal, Optional
from .labeler import _Type, compose, partial
#region Dataclass definitions for types of public use
# region Dataclass definitions for types of public use
@dataclass
class PlatformStatus(_Type):
status: int
@dataclass
class TradingPairTicker(_Type):
bid: float
@@ -22,6 +24,7 @@ class TradingPairTicker(_Type):
high: float
low: float
@dataclass
class FundingCurrencyTicker(_Type):
frr: float
@@ -39,6 +42,7 @@ class FundingCurrencyTicker(_Type):
low: float
frr_amount_available: float
@dataclass
class TickersHistory(_Type):
symbol: str
@@ -46,6 +50,7 @@ class TickersHistory(_Type):
ask: float
mts: int
@dataclass
class TradingPairTrade(_Type):
id: int
@@ -53,6 +58,7 @@ class TradingPairTrade(_Type):
amount: float
price: float
@dataclass
class FundingCurrencyTrade(_Type):
id: int
@@ -61,12 +67,14 @@ class FundingCurrencyTrade(_Type):
rate: float
period: int
@dataclass
class TradingPairBook(_Type):
price: float
count: int
amount: float
@dataclass
class FundingCurrencyBook(_Type):
rate: float
@@ -74,12 +82,14 @@ class FundingCurrencyBook(_Type):
count: int
amount: float
@dataclass
class TradingPairRawBook(_Type):
order_id: int
price: float
amount: float
@dataclass
class FundingCurrencyRawBook(_Type):
offer_id: int
@@ -87,11 +97,13 @@ class FundingCurrencyRawBook(_Type):
rate: float
amount: float
@dataclass
class Statistic(_Type):
mts: int
value: float
@dataclass
class Candle(_Type):
mts: int
@@ -101,6 +113,7 @@ class Candle(_Type):
low: int
volume: float
@dataclass
class DerivativesStatus(_Type):
mts: int
@@ -116,6 +129,7 @@ class DerivativesStatus(_Type):
clamp_min: float
clamp_max: float
@dataclass
class Liquidation(_Type):
pos_id: int
@@ -127,6 +141,7 @@ class Liquidation(_Type):
is_market_sold: int
liquidation_price: float
@dataclass
class Leaderboard(_Type):
mts: int
@@ -135,6 +150,7 @@ class Leaderboard(_Type):
value: float
twitter_handle: Optional[str]
@dataclass
class FundingStatistic(_Type):
mts: int
@@ -144,6 +160,7 @@ class FundingStatistic(_Type):
funding_amount_used: float
funding_below_threshold: float
@dataclass
class PulseProfile(_Type):
puid: str
@@ -156,6 +173,7 @@ class PulseProfile(_Type):
following: int
tipping_status: int
@dataclass
class PulseMessage(_Type):
pid: str
@@ -173,23 +191,28 @@ class PulseMessage(_Type):
profile: PulseProfile
comments: int
@dataclass
class TradingMarketAveragePrice(_Type):
price_avg: float
amount: float
@dataclass
class FundingMarketAveragePrice(_Type):
rate_avg: float
amount: float
@dataclass
class FxRate(_Type):
current_rate: float
#endregion
#region Dataclass definitions for types of auth use
# endregion
# region Dataclass definitions for types of auth use
@dataclass
class UserInfo(_Type):
@@ -222,6 +245,7 @@ class UserInfo(_Type):
compl_countries_resid: List[str]
is_merchant_enterprise: int
@dataclass
class LoginHistory(_Type):
id: int
@@ -229,10 +253,12 @@ class LoginHistory(_Type):
ip: str
extra_info: Dict[str, Any]
@dataclass
class BalanceAvailable(_Type):
amount: float
@dataclass
class Order(_Type):
id: int
@@ -258,6 +284,7 @@ class Order(_Type):
routing: str
meta: Dict[str, Any]
@dataclass
class Position(_Type):
symbol: str
@@ -278,6 +305,7 @@ class Position(_Type):
collateral_min: float
meta: Dict[str, Any]
@dataclass
class Trade(_Type):
id: int
@@ -288,11 +316,12 @@ class Trade(_Type):
exec_price: float
order_type: str
order_price: float
maker:int
maker: int
fee: float
fee_currency: str
cid: int
@dataclass()
class FundingTrade(_Type):
id: int
@@ -303,6 +332,7 @@ class FundingTrade(_Type):
rate: float
period: int
@dataclass
class OrderTrade(_Type):
id: int
@@ -311,11 +341,12 @@ class OrderTrade(_Type):
order_id: int
exec_amount: float
exec_price: float
maker:int
maker: int
fee: float
fee_currency: str
cid: int
@dataclass
class Ledger(_Type):
id: int
@@ -325,6 +356,7 @@ class Ledger(_Type):
balance: float
description: str
@dataclass
class FundingOffer(_Type):
id: int
@@ -342,6 +374,7 @@ class FundingOffer(_Type):
hidden: int
renew: int
@dataclass
class FundingCredit(_Type):
id: int
@@ -363,6 +396,7 @@ class FundingCredit(_Type):
no_close: int
position_pair: str
@dataclass
class FundingLoan(_Type):
id: int
@@ -383,6 +417,7 @@ class FundingLoan(_Type):
renew: int
no_close: int
@dataclass
class FundingAutoRenew(_Type):
currency: str
@@ -390,6 +425,7 @@ class FundingAutoRenew(_Type):
rate: float
threshold: float
@dataclass()
class FundingInfo(_Type):
yield_loan: float
@@ -397,6 +433,7 @@ class FundingInfo(_Type):
duration_loan: float
duration_lend: float
@dataclass
class Wallet(_Type):
wallet_type: str
@@ -407,6 +444,7 @@ class Wallet(_Type):
last_change: str
trade_details: Dict[str, Any]
@dataclass
class Transfer(_Type):
mts: int
@@ -416,6 +454,7 @@ class Transfer(_Type):
currency_to: str
amount: int
@dataclass
class Withdrawal(_Type):
withdrawal_id: int
@@ -425,6 +464,7 @@ class Withdrawal(_Type):
amount: float
withdrawal_fee: float
@dataclass
class DepositAddress(_Type):
method: str
@@ -432,12 +472,14 @@ class DepositAddress(_Type):
address: str
pool_address: str
@dataclass
class LightningNetworkInvoice(_Type):
invoice_hash: str
invoice: str
amount: str
@dataclass
class Movement(_Type):
id: str
@@ -452,6 +494,7 @@ class Movement(_Type):
transaction_id: str
withdraw_transaction_note: str
@dataclass
class SymbolMarginInfo(_Type):
symbol: str
@@ -460,6 +503,7 @@ class SymbolMarginInfo(_Type):
buy: float
sell: float
@dataclass
class BaseMarginInfo(_Type):
user_pl: float
@@ -468,6 +512,7 @@ class BaseMarginInfo(_Type):
margin_net: float
margin_min: float
@dataclass
class PositionClaim(_Type):
symbol: str
@@ -484,6 +529,7 @@ class PositionClaim(_Type):
min_collateral: str
meta: Dict[str, Any]
@dataclass
class PositionIncreaseInfo(_Type):
max_pos: int
@@ -499,12 +545,14 @@ class PositionIncreaseInfo(_Type):
funding_value_currency: str
funding_required_currency: str
@dataclass
class PositionIncrease(_Type):
symbol: str
amount: float
base_price: float
@dataclass
class PositionHistory(_Type):
symbol: str
@@ -517,6 +565,7 @@ class PositionHistory(_Type):
mts_create: int
mts_update: int
@dataclass
class PositionSnapshot(_Type):
symbol: str
@@ -529,6 +578,7 @@ class PositionSnapshot(_Type):
mts_create: int
mts_update: int
@dataclass
class PositionAudit(_Type):
symbol: str
@@ -545,18 +595,22 @@ class PositionAudit(_Type):
collateral_min: float
meta: Dict[str, Any]
@dataclass
class DerivativePositionCollateral(_Type):
status: int
@dataclass
class DerivativePositionCollateralLimits(_Type):
min_collateral: float
max_collateral: float
#endregion
#region Dataclass definitions for types of merchant use
# endregion
# region Dataclass definitions for types of merchant use
@compose(dataclass, partial)
class InvoiceSubmission(_Type):
@@ -580,7 +634,9 @@ class InvoiceSubmission(_Type):
@classmethod
def parse(cls, data: Dict[str, Any]) -> "InvoiceSubmission":
if "customer_info" in data and data["customer_info"] is not None:
data["customer_info"] = InvoiceSubmission.CustomerInfo(**data["customer_info"])
data["customer_info"] = InvoiceSubmission.CustomerInfo(
**data["customer_info"]
)
for index, invoice in enumerate(data["invoices"]):
data["invoices"][index] = InvoiceSubmission.Invoice(**invoice)
@@ -590,7 +646,9 @@ class InvoiceSubmission(_Type):
if "additional_payments" in data and data["additional_payments"] is not None:
for index, additional_payment in enumerate(data["additional_payments"]):
data["additional_payments"][index] = InvoiceSubmission.Payment(**additional_payment)
data["additional_payments"][index] = InvoiceSubmission.Payment(
**additional_payment
)
return InvoiceSubmission(**data)
@@ -631,6 +689,7 @@ class InvoiceSubmission(_Type):
force_completed: bool
amount_diff: str
@dataclass
class InvoicePage(_Type):
page: int
@@ -648,17 +707,20 @@ class InvoicePage(_Type):
return InvoicePage(**data)
@dataclass
class InvoiceStats(_Type):
time: str
count: float
@dataclass
class CurrencyConversion(_Type):
base_ccy: str
convert_ccy: str
created: int
@dataclass
class MerchantDeposit(_Type):
id: int
@@ -672,6 +734,7 @@ class MerchantDeposit(_Type):
method: str
pay_method: str
@dataclass
class MerchantUnlinkedDeposit(_Type):
id: int
@@ -687,4 +750,5 @@ class MerchantUnlinkedDeposit(_Type):
status: str
note: Optional[str]
#endregion
# endregion

View File

@@ -2,6 +2,7 @@ from typing import Any, Dict, Generic, Iterable, List, Tuple, Type, TypeVar, cas
T = TypeVar("T", bound="_Type")
def compose(*decorators):
def wrapper(function):
for decorator in reversed(decorators):
@@ -10,30 +11,37 @@ def compose(*decorators):
return wrapper
def partial(cls):
def __init__(self, **kwargs):
for annotation in self.__annotations__.keys():
if annotation not in kwargs:
self.__setattr__(annotation, None)
else: self.__setattr__(annotation, kwargs[annotation])
else:
self.__setattr__(annotation, kwargs[annotation])
kwargs.pop(annotation, None)
if len(kwargs) != 0:
raise TypeError(f"{cls.__name__}.__init__() got an unexpected keyword argument '{list(kwargs.keys())[0]}'")
raise TypeError(
f"{cls.__name__}.__init__() got an unexpected keyword argument '{list(kwargs.keys())[0]}'"
)
cls.__init__ = __init__
return cls
class _Type:
"""
Base class for any dataclass serializable by the _Serializer generic class.
"""
class _Serializer(Generic[T]):
def __init__(self, name: str, klass: Type[_Type], labels: List[str],
*, flat: bool = False):
def __init__(
self, name: str, klass: Type[_Type], labels: List[str], *, flat: bool = False
):
self.name, self.klass, self.__labels, self.__flat = name, klass, labels, flat
def _serialize(self, *args: Any) -> Iterable[Tuple[str, Any]]:
@@ -41,8 +49,10 @@ class _Serializer(Generic[T]):
args = tuple(_Serializer.__flatten(list(args)))
if len(self.__labels) > len(args):
raise AssertionError(f"{self.name} -> <labels> and <*args> " \
"arguments should contain the same amount of elements.")
raise AssertionError(
f"{self.name} -> <labels> and <*args> "
"arguments should contain the same amount of elements."
)
for index, label in enumerate(self.__labels):
if label != "_PLACEHOLDER":
@@ -52,7 +62,7 @@ class _Serializer(Generic[T]):
return cast(T, self.klass(**dict(self._serialize(*values))))
def get_labels(self) -> List[str]:
return [ label for label in self.__labels if label != "_PLACEHOLDER" ]
return [label for label in self.__labels if label != "_PLACEHOLDER"]
@classmethod
def __flatten(cls, array: List[Any]) -> List[Any]:
@@ -64,10 +74,17 @@ class _Serializer(Generic[T]):
return array[:1] + cls.__flatten(array[1:])
class _RecursiveSerializer(_Serializer, Generic[T]):
def __init__(self, name: str, klass: Type[_Type], labels: List[str],
*, serializers: Dict[str, _Serializer[Any]],
flat: bool = False):
def __init__(
self,
name: str,
klass: Type[_Type],
labels: List[str],
*,
serializers: Dict[str, _Serializer[Any]],
flat: bool = False,
):
super().__init__(name, klass, labels, flat=flat)
self.serializers = serializers
@@ -81,15 +98,21 @@ class _RecursiveSerializer(_Serializer, Generic[T]):
return cast(T, self.klass(**serialization))
def generate_labeler_serializer(name: str, klass: Type[T], labels: List[str],
*, flat: bool = False
) -> _Serializer[T]:
return _Serializer[T](name, klass, labels, \
flat=flat)
def generate_recursive_serializer(name: str, klass: Type[T], labels: List[str],
*, serializers: Dict[str, _Serializer[Any]],
flat: bool = False
) -> _RecursiveSerializer[T]:
return _RecursiveSerializer[T](name, klass, labels, \
serializers=serializers, flat=flat)
def generate_labeler_serializer(
name: str, klass: Type[T], labels: List[str], *, flat: bool = False
) -> _Serializer[T]:
return _Serializer[T](name, klass, labels, flat=flat)
def generate_recursive_serializer(
name: str,
klass: Type[T],
labels: List[str],
*,
serializers: Dict[str, _Serializer[Any]],
flat: bool = False,
) -> _RecursiveSerializer[T]:
return _RecursiveSerializer[T](
name, klass, labels, serializers=serializers, flat=flat
)

View File

@@ -5,6 +5,7 @@ from .labeler import _Serializer, _Type
T = TypeVar("T")
@dataclass
class Notification(_Type, Generic[T]):
mts: int
@@ -15,16 +16,30 @@ class Notification(_Type, Generic[T]):
status: str
text: str
class _Notification(_Serializer, Generic[T]):
__LABELS = [ "mts", "type", "message_id", "_PLACEHOLDER", "data", "code", "status", "text" ]
def __init__(self, serializer: Optional[_Serializer] = None, is_iterable: bool = False):
class _Notification(_Serializer, Generic[T]):
__LABELS = [
"mts",
"type",
"message_id",
"_PLACEHOLDER",
"data",
"code",
"status",
"text",
]
def __init__(
self, serializer: Optional[_Serializer] = None, is_iterable: bool = False
):
super().__init__("Notification", Notification, _Notification.__LABELS)
self.serializer, self.is_iterable = serializer, is_iterable
def parse(self, *values: Any) -> Notification[T]:
notification = cast(Notification[T], Notification(**dict(self._serialize(*values))))
notification = cast(
Notification[T], Notification(**dict(self._serialize(*values)))
)
if isinstance(self.serializer, _Serializer):
data = cast(List[Any], notification.data)
@@ -34,6 +49,9 @@ class _Notification(_Serializer, Generic[T]):
data = data[0]
notification.data = self.serializer.parse(*data)
else: notification.data = cast(T, [ self.serializer.parse(*sub_data) for sub_data in data ])
else:
notification.data = cast(
T, [self.serializer.parse(*sub_data) for sub_data in data]
)
return notification

View File

@@ -1,44 +1,73 @@
from . import dataclasses
#pylint: disable-next=unused-import
# pylint: disable-next=unused-import
from .labeler import (
_Serializer,
generate_labeler_serializer,
generate_recursive_serializer,
)
#pylint: disable-next=unused-import
# pylint: disable-next=unused-import
from .notification import _Notification
__serializers__ = [
"PlatformStatus", "TradingPairTicker", "FundingCurrencyTicker",
"TickersHistory", "TradingPairTrade", "FundingCurrencyTrade",
"TradingPairBook", "FundingCurrencyBook", "TradingPairRawBook",
"FundingCurrencyRawBook", "Statistic", "Candle",
"DerivativesStatus", "Liquidation", "Leaderboard",
"FundingStatistic", "PulseProfile", "PulseMessage",
"TradingMarketAveragePrice", "FundingMarketAveragePrice", "FxRate",
"UserInfo", "LoginHistory", "BalanceAvailable",
"Order", "Position", "Trade",
"FundingTrade", "OrderTrade", "Ledger",
"FundingOffer", "FundingCredit", "FundingLoan",
"FundingAutoRenew", "FundingInfo", "Wallet",
"Transfer", "Withdrawal", "DepositAddress",
"LightningNetworkInvoice", "Movement", "SymbolMarginInfo",
"BaseMarginInfo", "PositionClaim", "PositionIncreaseInfo",
"PositionIncrease", "PositionHistory", "PositionSnapshot",
"PositionAudit", "DerivativePositionCollateral", "DerivativePositionCollateralLimits",
"PlatformStatus",
"TradingPairTicker",
"FundingCurrencyTicker",
"TickersHistory",
"TradingPairTrade",
"FundingCurrencyTrade",
"TradingPairBook",
"FundingCurrencyBook",
"TradingPairRawBook",
"FundingCurrencyRawBook",
"Statistic",
"Candle",
"DerivativesStatus",
"Liquidation",
"Leaderboard",
"FundingStatistic",
"PulseProfile",
"PulseMessage",
"TradingMarketAveragePrice",
"FundingMarketAveragePrice",
"FxRate",
"UserInfo",
"LoginHistory",
"BalanceAvailable",
"Order",
"Position",
"Trade",
"FundingTrade",
"OrderTrade",
"Ledger",
"FundingOffer",
"FundingCredit",
"FundingLoan",
"FundingAutoRenew",
"FundingInfo",
"Wallet",
"Transfer",
"Withdrawal",
"DepositAddress",
"LightningNetworkInvoice",
"Movement",
"SymbolMarginInfo",
"BaseMarginInfo",
"PositionClaim",
"PositionIncreaseInfo",
"PositionIncrease",
"PositionHistory",
"PositionSnapshot",
"PositionAudit",
"DerivativePositionCollateral",
"DerivativePositionCollateralLimits",
]
#region Serializer definitions for types of public use
# region Serializer definitions for types of public use
PlatformStatus = generate_labeler_serializer(
name="PlatformStatus",
klass=dataclasses.PlatformStatus,
labels=[
"status"
]
name="PlatformStatus", klass=dataclasses.PlatformStatus, labels=["status"]
)
TradingPairTicker = generate_labeler_serializer(
@@ -54,8 +83,8 @@ TradingPairTicker = generate_labeler_serializer(
"last_price",
"volume",
"high",
"low"
]
"low",
],
)
FundingCurrencyTicker = generate_labeler_serializer(
@@ -77,8 +106,8 @@ FundingCurrencyTicker = generate_labeler_serializer(
"low",
"_PLACEHOLDER",
"_PLACEHOLDER",
"frr_amount_available"
]
"frr_amount_available",
],
)
TickersHistory = generate_labeler_serializer(
@@ -97,95 +126,54 @@ TickersHistory = generate_labeler_serializer(
"_PLACEHOLDER",
"_PLACEHOLDER",
"_PLACEHOLDER",
"mts"
]
"mts",
],
)
TradingPairTrade = generate_labeler_serializer(
name="TradingPairTrade",
klass=dataclasses.TradingPairTrade,
labels=[
"id",
"mts",
"amount",
"price"
]
labels=["id", "mts", "amount", "price"],
)
FundingCurrencyTrade = generate_labeler_serializer(
name="FundingCurrencyTrade",
klass=dataclasses.FundingCurrencyTrade,
labels=[
"id",
"mts",
"amount",
"rate",
"period"
]
labels=["id", "mts", "amount", "rate", "period"],
)
TradingPairBook = generate_labeler_serializer(
name="TradingPairBook",
klass=dataclasses.TradingPairBook,
labels=[
"price",
"count",
"amount"
]
labels=["price", "count", "amount"],
)
FundingCurrencyBook = generate_labeler_serializer(
name="FundingCurrencyBook",
klass=dataclasses.FundingCurrencyBook,
labels=[
"rate",
"period",
"count",
"amount"
]
labels=["rate", "period", "count", "amount"],
)
TradingPairRawBook = generate_labeler_serializer(
name="TradingPairRawBook",
klass=dataclasses.TradingPairRawBook,
labels=[
"order_id",
"price",
"amount"
]
labels=["order_id", "price", "amount"],
)
FundingCurrencyRawBook = generate_labeler_serializer(
name="FundingCurrencyRawBook",
klass=dataclasses.FundingCurrencyRawBook,
labels=[
"offer_id",
"period",
"rate",
"amount"
]
labels=["offer_id", "period", "rate", "amount"],
)
Statistic = generate_labeler_serializer(
name="Statistic",
klass=dataclasses.Statistic,
labels=[
"mts",
"value"
]
name="Statistic", klass=dataclasses.Statistic, labels=["mts", "value"]
)
Candle = generate_labeler_serializer(
name="Candle",
klass=dataclasses.Candle,
labels=[
"mts",
"open",
"close",
"high",
"low",
"volume"
]
labels=["mts", "open", "close", "high", "low", "volume"],
)
DerivativesStatus = generate_labeler_serializer(
@@ -193,7 +181,7 @@ DerivativesStatus = generate_labeler_serializer(
klass=dataclasses.DerivativesStatus,
labels=[
"mts",
"_PLACEHOLDER",
"_PLACEHOLDER",
"deriv_price",
"spot_price",
"_PLACEHOLDER",
@@ -214,8 +202,8 @@ DerivativesStatus = generate_labeler_serializer(
"_PLACEHOLDER",
"_PLACEHOLDER",
"clamp_min",
"clamp_max"
]
"clamp_max",
],
)
Liquidation = generate_labeler_serializer(
@@ -233,8 +221,8 @@ Liquidation = generate_labeler_serializer(
"is_match",
"is_market_sold",
"_PLACEHOLDER",
"liquidation_price"
]
"liquidation_price",
],
)
Leaderboard = generate_labeler_serializer(
@@ -250,8 +238,8 @@ Leaderboard = generate_labeler_serializer(
"value",
"_PLACEHOLDER",
"_PLACEHOLDER",
"twitter_handle"
]
"twitter_handle",
],
)
FundingStatistic = generate_labeler_serializer(
@@ -269,8 +257,8 @@ FundingStatistic = generate_labeler_serializer(
"funding_amount_used",
"_PLACEHOLDER",
"_PLACEHOLDER",
"funding_below_threshold"
]
"funding_below_threshold",
],
)
PulseProfile = generate_labeler_serializer(
@@ -293,14 +281,14 @@ PulseProfile = generate_labeler_serializer(
"_PLACEHOLDER",
"_PLACEHOLDER",
"_PLACEHOLDER",
"tipping_status"
]
"tipping_status",
],
)
PulseMessage = generate_recursive_serializer(
name="PulseMessage",
klass=dataclasses.PulseMessage,
serializers={ "profile": PulseProfile },
serializers={"profile": PulseProfile},
labels=[
"pid",
"mts",
@@ -314,7 +302,7 @@ PulseMessage = generate_recursive_serializer(
"is_pin",
"is_public",
"comments_disabled",
"tags",
"tags",
"attachments",
"meta",
"likes",
@@ -323,39 +311,29 @@ PulseMessage = generate_recursive_serializer(
"profile",
"comments",
"_PLACEHOLDER",
"_PLACEHOLDER"
]
"_PLACEHOLDER",
],
)
TradingMarketAveragePrice = generate_labeler_serializer(
name="TradingMarketAveragePrice",
klass=dataclasses.TradingMarketAveragePrice,
labels=[
"price_avg",
"amount"
]
labels=["price_avg", "amount"],
)
FundingMarketAveragePrice = generate_labeler_serializer(
name="FundingMarketAveragePrice",
klass=dataclasses.FundingMarketAveragePrice,
labels=[
"rate_avg",
"amount"
]
labels=["rate_avg", "amount"],
)
FxRate = generate_labeler_serializer(
name="FxRate",
klass=dataclasses.FxRate,
labels=[
"current_rate"
]
name="FxRate", klass=dataclasses.FxRate, labels=["current_rate"]
)
#endregion
# endregion
#region Serializer definitions for types of auth use
# region Serializer definitions for types of auth use
UserInfo = generate_labeler_serializer(
name="UserInfo",
@@ -415,8 +393,8 @@ UserInfo = generate_labeler_serializer(
"_PLACEHOLDER",
"_PLACEHOLDER",
"_PLACEHOLDER",
"is_merchant_enterprise"
]
"is_merchant_enterprise",
],
)
LoginHistory = generate_labeler_serializer(
@@ -430,16 +408,12 @@ LoginHistory = generate_labeler_serializer(
"ip",
"_PLACEHOLDER",
"_PLACEHOLDER",
"extra_info"
]
"extra_info",
],
)
BalanceAvailable = generate_labeler_serializer(
name="BalanceAvailable",
klass=dataclasses.BalanceAvailable,
labels=[
"amount"
]
name="BalanceAvailable", klass=dataclasses.BalanceAvailable, labels=["amount"]
)
Order = generate_labeler_serializer(
@@ -450,10 +424,10 @@ Order = generate_labeler_serializer(
"gid",
"cid",
"symbol",
"mts_create",
"mts_update",
"amount",
"amount_orig",
"mts_create",
"mts_update",
"amount",
"amount_orig",
"order_type",
"type_prev",
"mts_tif",
@@ -470,26 +444,26 @@ Order = generate_labeler_serializer(
"_PLACEHOLDER",
"_PLACEHOLDER",
"notify",
"hidden",
"hidden",
"placed_id",
"_PLACEHOLDER",
"_PLACEHOLDER",
"routing",
"_PLACEHOLDER",
"_PLACEHOLDER",
"meta"
]
"meta",
],
)
Position = generate_labeler_serializer(
name="Position",
klass=dataclasses.Position,
labels=[
"symbol",
"status",
"amount",
"base_price",
"margin_funding",
"symbol",
"status",
"amount",
"base_price",
"margin_funding",
"margin_funding_type",
"pl",
"pl_perc",
@@ -504,41 +478,33 @@ Position = generate_labeler_serializer(
"_PLACEHOLDER",
"collateral",
"collateral_min",
"meta"
]
"meta",
],
)
Trade = generate_labeler_serializer(
name="Trade",
klass=dataclasses.Trade,
labels=[
"id",
"symbol",
"mts_create",
"order_id",
"exec_amount",
"exec_price",
"order_type",
"order_price",
"maker",
"fee",
"id",
"symbol",
"mts_create",
"order_id",
"exec_amount",
"exec_price",
"order_type",
"order_price",
"maker",
"fee",
"fee_currency",
"cid"
]
"cid",
],
)
FundingTrade = generate_labeler_serializer(
name="FundingTrade",
klass=dataclasses.FundingTrade,
labels=[
"id",
"currency",
"mts_create",
"offer_id",
"amount",
"rate",
"period"
]
labels=["id", "currency", "mts_create", "offer_id", "amount", "rate", "period"],
)
OrderTrade = generate_labeler_serializer(
@@ -556,8 +522,8 @@ OrderTrade = generate_labeler_serializer(
"maker",
"fee",
"fee_currency",
"cid"
]
"cid",
],
)
Ledger = generate_labeler_serializer(
@@ -572,8 +538,8 @@ Ledger = generate_labeler_serializer(
"amount",
"balance",
"_PLACEHOLDER",
"description"
]
"description",
],
)
FundingOffer = generate_labeler_serializer(
@@ -600,8 +566,8 @@ FundingOffer = generate_labeler_serializer(
"hidden",
"_PLACEHOLDER",
"renew",
"_PLACEHOLDER"
]
"_PLACEHOLDER",
],
)
FundingCredit = generate_labeler_serializer(
@@ -629,8 +595,8 @@ FundingCredit = generate_labeler_serializer(
"renew",
"_PLACEHOLDER",
"no_close",
"position_pair"
]
"position_pair",
],
)
FundingLoan = generate_labeler_serializer(
@@ -657,44 +623,34 @@ FundingLoan = generate_labeler_serializer(
"_PLACEHOLDER",
"renew",
"_PLACEHOLDER",
"no_close"
]
"no_close",
],
)
FundingAutoRenew = generate_labeler_serializer(
name="FundingAutoRenew",
klass=dataclasses.FundingAutoRenew,
labels=[
"currency",
"period",
"rate",
"threshold"
]
labels=["currency", "period", "rate", "threshold"],
)
FundingInfo = generate_labeler_serializer(
name="FundingInfo",
klass=dataclasses.FundingInfo,
labels=[
"yield_loan",
"yield_lend",
"duration_loan",
"duration_lend"
]
labels=["yield_loan", "yield_lend", "duration_loan", "duration_lend"],
)
Wallet = generate_labeler_serializer(
name="Wallet",
klass=dataclasses.Wallet,
labels=[
"wallet_type",
"currency",
"balance",
"wallet_type",
"currency",
"balance",
"unsettled_interest",
"available_balance",
"last_change",
"trade_details"
]
"trade_details",
],
)
Transfer = generate_labeler_serializer(
@@ -708,8 +664,8 @@ Transfer = generate_labeler_serializer(
"currency",
"currency_to",
"_PLACEHOLDER",
"amount"
]
"amount",
],
)
Withdrawal = generate_labeler_serializer(
@@ -724,8 +680,8 @@ Withdrawal = generate_labeler_serializer(
"amount",
"_PLACEHOLDER",
"_PLACEHOLDER",
"withdrawal_fee"
]
"withdrawal_fee",
],
)
DepositAddress = generate_labeler_serializer(
@@ -737,20 +693,14 @@ DepositAddress = generate_labeler_serializer(
"currency_code",
"_PLACEHOLDER",
"address",
"pool_address"
]
"pool_address",
],
)
LightningNetworkInvoice = generate_labeler_serializer(
name="LightningNetworkInvoice",
klass=dataclasses.LightningNetworkInvoice,
labels=[
"invoice_hash",
"invoice",
"_PLACEHOLDER",
"_PLACEHOLDER",
"amount"
]
labels=["invoice_hash", "invoice", "_PLACEHOLDER", "_PLACEHOLDER", "amount"],
)
Movement = generate_labeler_serializer(
@@ -778,8 +728,8 @@ Movement = generate_labeler_serializer(
"_PLACEHOLDER",
"_PLACEHOLDER",
"transaction_id",
"withdraw_transaction_note"
]
"withdraw_transaction_note",
],
)
SymbolMarginInfo = generate_labeler_serializer(
@@ -791,22 +741,15 @@ SymbolMarginInfo = generate_labeler_serializer(
"tradable_balance",
"gross_balance",
"buy",
"sell"
"sell",
],
flat=True
flat=True,
)
BaseMarginInfo = generate_labeler_serializer(
name="BaseMarginInfo",
klass=dataclasses.BaseMarginInfo,
labels=[
"user_pl",
"user_swaps",
"margin_balance",
"margin_net",
"margin_min"
]
labels=["user_pl", "user_swaps", "margin_balance", "margin_net", "margin_min"],
)
PositionClaim = generate_labeler_serializer(
@@ -832,8 +775,8 @@ PositionClaim = generate_labeler_serializer(
"_PLACEHOLDER",
"collateral",
"min_collateral",
"meta"
]
"meta",
],
)
PositionIncreaseInfo = generate_labeler_serializer(
@@ -857,21 +800,15 @@ PositionIncreaseInfo = generate_labeler_serializer(
"funding_value",
"funding_required",
"funding_value_currency",
"funding_required_currency"
"funding_required_currency",
],
flat=True
flat=True,
)
PositionIncrease = generate_labeler_serializer(
name="PositionIncrease",
klass=dataclasses.PositionIncrease,
labels=[
"symbol",
"_PLACEHOLDER",
"amount",
"base_price"
]
labels=["symbol", "_PLACEHOLDER", "amount", "base_price"],
)
PositionHistory = generate_labeler_serializer(
@@ -891,8 +828,8 @@ PositionHistory = generate_labeler_serializer(
"_PLACEHOLDER",
"position_id",
"mts_create",
"mts_update"
]
"mts_update",
],
)
PositionSnapshot = generate_labeler_serializer(
@@ -912,8 +849,8 @@ PositionSnapshot = generate_labeler_serializer(
"_PLACEHOLDER",
"position_id",
"mts_create",
"mts_update"
]
"mts_update",
],
)
PositionAudit = generate_labeler_serializer(
@@ -939,25 +876,20 @@ PositionAudit = generate_labeler_serializer(
"_PLACEHOLDER",
"collateral",
"collateral_min",
"meta"
]
"meta",
],
)
DerivativePositionCollateral = generate_labeler_serializer(
name="DerivativePositionCollateral",
klass=dataclasses.DerivativePositionCollateral,
labels=[
"status"
]
labels=["status"],
)
DerivativePositionCollateralLimits = generate_labeler_serializer(
name="DerivativePositionCollateralLimits",
klass=dataclasses.DerivativePositionCollateralLimits,
labels=[
"min_collateral",
"max_collateral"
]
labels=["min_collateral", "max_collateral"],
)
#endregion
# endregion