mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-22 00:04:20 +01:00
Apply black to all python files (bfxapi/**/*.py).
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user