mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-24 09:14:24 +01:00
Add tests subpackage. Add TestRestSerializersAndTypes and TestWebsocketSerializersAndTypes unit tests. Fix consistency bugs between serializers and types.
This commit is contained in:
@@ -4,6 +4,17 @@ from .. labeler import generate_labeler_serializer
|
||||
|
||||
from .. notification import _Notification
|
||||
|
||||
__serializers__ = [
|
||||
"TradingPairTicker", "FundingCurrencyTicker", "TradingPairTrade",
|
||||
"FundingCurrencyTrade", "TradingPairBook", "FundingCurrencyBook",
|
||||
"TradingPairRawBook", "FundingCurrencyRawBook", "Candle",
|
||||
"DerivativesStatus",
|
||||
|
||||
"Order", "Position", "Trade",
|
||||
"FundingOffer", "FundingCredit", "FundingLoan",
|
||||
"Wallet", "Balance",
|
||||
]
|
||||
|
||||
#region Serializers definition for Websocket Public Channels
|
||||
|
||||
TradingPairTicker = generate_labeler_serializer("TradingPairTicker", klass=types.TradingPairTicker, labels=[
|
||||
@@ -32,7 +43,7 @@ FundingCurrencyTicker = generate_labeler_serializer("FundingCurrencyTicker", kla
|
||||
"last_price",
|
||||
"volume",
|
||||
"high",
|
||||
"low"
|
||||
"low",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"frr_amount_available"
|
||||
@@ -100,7 +111,7 @@ DerivativesStatus = generate_labeler_serializer("DerivativesStatus", klass=types
|
||||
"next_funding_accrued",
|
||||
"next_funding_step",
|
||||
"_PLACEHOLDER",
|
||||
"current_funding"
|
||||
"current_funding",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"mark_price",
|
||||
|
||||
@@ -6,6 +6,17 @@ from ..labeler import _Type
|
||||
from ..notification import Notification
|
||||
from .. utils.encoder import JSON
|
||||
|
||||
__types__ = [
|
||||
"TradingPairTicker", "FundingCurrencyTicker", "TradingPairTrade",
|
||||
"FundingCurrencyTrade", "TradingPairBook", "FundingCurrencyBook",
|
||||
"TradingPairRawBook", "FundingCurrencyRawBook", "Candle",
|
||||
"DerivativesStatus",
|
||||
|
||||
"Order", "Position", "Trade",
|
||||
"FundingOffer", "FundingCredit", "FundingLoan",
|
||||
"Wallet", "Balance",
|
||||
]
|
||||
|
||||
#region Type hinting for Websocket Public Channels
|
||||
|
||||
@dataclass
|
||||
@@ -143,6 +154,7 @@ class Position(_Type):
|
||||
pl_perc: float
|
||||
price_liq: float
|
||||
leverage: float
|
||||
flag: int
|
||||
position_id: int
|
||||
mts_create: int
|
||||
mts_update: int
|
||||
|
||||
Reference in New Issue
Block a user