Fix bugs and differences in namings/types/fields between bfxapi.rest.types, bfxapi.rest.serializers and bfxapi.websocket.types, bfxapi.websocket.serializers.

This commit is contained in:
Davide Casale
2023-01-31 18:54:15 +01:00
parent 7b313ddcab
commit 40a48184da
5 changed files with 95 additions and 97 deletions

View File

@@ -248,16 +248,6 @@ FxRate = generate_labeler_serializer("FxRate", klass=types.FxRate, labels=[
#region Serializers definition for Rest Authenticated Endpoints #region Serializers definition for Rest Authenticated Endpoints
Wallet = generate_labeler_serializer("Wallet", klass=types.Wallet, labels=[
"wallet_type",
"currency",
"balance",
"unsettled_interest",
"available_balance",
"last_change",
"trade_details"
])
Order = generate_labeler_serializer("Order", klass=types.Order, labels=[ Order = generate_labeler_serializer("Order", klass=types.Order, labels=[
"id", "id",
"gid", "gid",
@@ -316,30 +306,6 @@ Position = generate_labeler_serializer("Position", klass=types.Position, labels=
"meta" "meta"
]) ])
FundingOffer = generate_labeler_serializer("FundingOffer", klass=types.FundingOffer, labels=[
"id",
"symbol",
"mts_create",
"mts_update",
"amount",
"amount_orig",
"offer_type",
"_PLACEHOLDER",
"_PLACEHOLDER",
"flags",
"offer_status",
"_PLACEHOLDER",
"_PLACEHOLDER",
"_PLACEHOLDER",
"rate",
"period",
"notify",
"hidden",
"_PLACEHOLDER",
"renew",
"_PLACEHOLDER"
])
Trade = generate_labeler_serializer("Trade", klass=types.Trade, labels=[ Trade = generate_labeler_serializer("Trade", klass=types.Trade, labels=[
"id", "id",
"pair", "pair",
@@ -392,28 +358,28 @@ Ledger = generate_labeler_serializer("Ledger", klass=types.Ledger, labels=[
"description" "description"
]) ])
FundingLoan = generate_labeler_serializer("FundingLoan", klass=types.FundingLoan, labels=[ FundingOffer = generate_labeler_serializer("FundingOffer", klass=types.FundingOffer, labels=[
"id", "id",
"symbol", "symbol",
"side",
"mts_create", "mts_create",
"mts_update", "mts_update",
"amount", "amount",
"amount_orig",
"offer_type",
"_PLACEHOLDER",
"_PLACEHOLDER",
"flags", "flags",
"status", "offer_status",
"_PLACEHOLDER", "_PLACEHOLDER",
"_PLACEHOLDER", "_PLACEHOLDER",
"_PLACEHOLDER", "_PLACEHOLDER",
"rate", "rate",
"period", "period",
"mts_opening",
"mts_last_payout",
"notify", "notify",
"hidden", "hidden",
"_PLACEHOLDER", "_PLACEHOLDER",
"renew", "renew",
"rate_real", "_PLACEHOLDER"
"no_close"
]) ])
FundingCredit = generate_labeler_serializer("FundingCredit", klass=types.FundingCredit, labels=[ FundingCredit = generate_labeler_serializer("FundingCredit", klass=types.FundingCredit, labels=[
@@ -441,6 +407,30 @@ FundingCredit = generate_labeler_serializer("FundingCredit", klass=types.Funding
"position_pair" "position_pair"
]) ])
FundingLoan = generate_labeler_serializer("FundingLoan", klass=types.FundingLoan, labels=[
"id",
"symbol",
"side",
"mts_create",
"mts_update",
"amount",
"flags",
"status",
"rate_type",
"_PLACEHOLDER",
"_PLACEHOLDER",
"rate",
"period",
"mts_opening",
"mts_last_payout",
"notify",
"hidden",
"_PLACEHOLDER",
"renew",
"_PLACEHOLDER",
"no_close"
])
FundingAutoRenew = generate_labeler_serializer("FundingAutoRenew", klass=types.FundingAutoRenew, labels=[ FundingAutoRenew = generate_labeler_serializer("FundingAutoRenew", klass=types.FundingAutoRenew, labels=[
"currency", "currency",
"period", "period",
@@ -456,6 +446,16 @@ FundingInfo = generate_labeler_serializer("FundingInfo", klass=types.FundingInfo
"duration_lend" "duration_lend"
]) ])
Wallet = generate_labeler_serializer("Wallet", klass=types.Wallet, labels=[
"wallet_type",
"currency",
"balance",
"unsettled_interest",
"available_balance",
"last_change",
"trade_details"
])
Transfer = generate_labeler_serializer("Transfer", klass=types.Transfer, labels=[ Transfer = generate_labeler_serializer("Transfer", klass=types.Transfer, labels=[
"mts", "mts",
"wallet_from", "wallet_from",

View File

@@ -197,16 +197,6 @@ class FxRate(_Type):
#region Type hinting for Rest Authenticated Endpoints #region Type hinting for Rest Authenticated Endpoints
@dataclass
class Wallet(_Type):
wallet_type: str
currency: str
balance: float
unsettled_interest: float
available_balance: float
last_change: str
trade_details: JSON
@dataclass @dataclass
class Order(_Type): class Order(_Type):
id: int id: int
@@ -252,23 +242,6 @@ class Position(_Type):
collateral_min: float collateral_min: float
meta: JSON meta: JSON
@dataclass
class FundingOffer(_Type):
id: int
symbol: str
mts_create: int
mts_update: int
amount: float
amount_orig: float
offer_type: str
flags: int
offer_status: str
rate: float
period: int
notify: bool
hidden: int
renew: bool
@dataclass @dataclass
class Trade(_Type): class Trade(_Type):
id: int id: int
@@ -317,24 +290,21 @@ class Ledger(_Type):
description: str description: str
@dataclass @dataclass
class FundingLoan(_Type): class FundingOffer(_Type):
id: int id: int
symbol: str symbol: str
side: int
mts_create: int mts_create: int
mts_update: int mts_update: int
amount: float amount: float
amount_orig: float
offer_type: str
flags: int flags: int
status: str offer_status: str
rate: float rate: float
period: int period: int
mts_opening: int
mts_last_payout: int
notify: int notify: int
hidden: int hidden: int
renew: int renew: int
rate_real: float
no_close: int
@dataclass @dataclass
class FundingCredit(_Type): class FundingCredit(_Type):
@@ -346,6 +316,7 @@ class FundingCredit(_Type):
amount: float amount: float
flags: int flags: int
status: str status: str
rate_type: str
rate: float rate: float
period: int period: int
mts_opening: int mts_opening: int
@@ -353,10 +324,29 @@ class FundingCredit(_Type):
notify: int notify: int
hidden: int hidden: int
renew: int renew: int
rate_real: float
no_close: int no_close: int
position_pair: str position_pair: str
@dataclass
class FundingLoan(_Type):
id: int
symbol: str
side: int
mts_create: int
mts_update: int
amount: float
flags: int
status: str
rate_type: str
rate: float
period: int
mts_opening: int
mts_last_payout: int
notify: int
hidden: int
renew: int
no_close: int
@dataclass @dataclass
class FundingAutoRenew(_Type): class FundingAutoRenew(_Type):
currency: str currency: str
@@ -372,6 +362,16 @@ class FundingInfo(_Type):
duration_loan: float duration_loan: float
duration_lend: float duration_lend: float
@dataclass
class Wallet(_Type):
wallet_type: str
currency: str
balance: float
unsettled_interest: float
available_balance: float
last_change: str
trade_details: JSON
@dataclass @dataclass
class Transfer(_Type): class Transfer(_Type):
mts: int mts: int

View File

@@ -139,7 +139,7 @@ class AuthenticatedChannelsHandler(object):
("fcs", "fcn", "fcu", "fcc",): serializers.FundingCredit, ("fcs", "fcn", "fcu", "fcc",): serializers.FundingCredit,
("fls", "fln", "flu", "flc",): serializers.FundingLoan, ("fls", "fln", "flu", "flc",): serializers.FundingLoan,
("ws", "wu",): serializers.Wallet, ("ws", "wu",): serializers.Wallet,
("bu",): serializers.BalanceInfo ("bu",): serializers.Balance
} }
EVENTS = [ EVENTS = [

View File

@@ -89,7 +89,7 @@ Candle = generate_labeler_serializer("Candle", klass=types.Candle, labels=[
]) ])
DerivativesStatus = generate_labeler_serializer("DerivativesStatus", klass=types.DerivativesStatus, labels=[ DerivativesStatus = generate_labeler_serializer("DerivativesStatus", klass=types.DerivativesStatus, labels=[
"time_ms", "mts",
"_PLACEHOLDER", "_PLACEHOLDER",
"deriv_price", "deriv_price",
"spot_price", "spot_price",
@@ -194,15 +194,15 @@ Trade = generate_labeler_serializer("Trade", klass=types.Trade, labels=[
FundingOffer = generate_labeler_serializer("FundingOffer", klass=types.FundingOffer, labels=[ FundingOffer = generate_labeler_serializer("FundingOffer", klass=types.FundingOffer, labels=[
"id", "id",
"symbol", "symbol",
"mts_created", "mts_create",
"mts_updated", "mts_update",
"amount", "amount",
"amount_orig", "amount_orig",
"offer_type", "offer_type",
"_PLACEHOLDER", "_PLACEHOLDER",
"_PLACEHOLDER", "_PLACEHOLDER",
"flags", "flags",
"status", "offer_status",
"_PLACEHOLDER", "_PLACEHOLDER",
"_PLACEHOLDER", "_PLACEHOLDER",
"_PLACEHOLDER", "_PLACEHOLDER",
@@ -235,7 +235,7 @@ FundingCredit = generate_labeler_serializer("FundingCredit", klass=types.Funding
"hidden", "hidden",
"_PLACEHOLDER", "_PLACEHOLDER",
"renew", "renew",
"rate_real", "_PLACEHOLDER",
"no_close", "no_close",
"position_pair" "position_pair"
]) ])
@@ -260,7 +260,7 @@ FundingLoan = generate_labeler_serializer("FundingLoan", klass=types.FundingLoan
"hidden", "hidden",
"_PLACEHOLDER", "_PLACEHOLDER",
"renew", "renew",
"rate_real", "_PLACEHOLDER",
"no_close" "no_close"
]) ])
@@ -269,12 +269,12 @@ Wallet = generate_labeler_serializer("Wallet", klass=types.Wallet, labels=[
"currency", "currency",
"balance", "balance",
"unsettled_interest", "unsettled_interest",
"balance_available", "available_balance",
"description", "last_change",
"meta" "trade_details"
]) ])
BalanceInfo = generate_labeler_serializer("BalanceInfo", klass=types.BalanceInfo, labels=[ Balance = generate_labeler_serializer("Balance", klass=types.Balance, labels=[
"aum", "aum",
"aum_net", "aum_net",
]) ])

View File

@@ -90,7 +90,7 @@ class Candle(_Type):
@dataclass @dataclass
class DerivativesStatus(_Type): class DerivativesStatus(_Type):
time_ms: int mts: int
deriv_price: float deriv_price: float
spot_price: float spot_price: float
insurance_fund_balance: float insurance_fund_balance: float
@@ -170,13 +170,13 @@ class Trade(_Type):
class FundingOffer(_Type): class FundingOffer(_Type):
id: int id: int
symbol: str symbol: str
mts_created: int mts_create: int
mts_updated: int mts_update: int
amount: float amount: float
amount_orig: float amount_orig: float
offer_type: str offer_type: str
flags: int flags: int
status: str offer_status: str
rate: float rate: float
period: int period: int
notify: int notify: int
@@ -200,7 +200,6 @@ class FundingCredit(_Type):
notify: int notify: int
hidden: int hidden: int
renew: int renew: int
rate_real: float
no_close: int no_close: int
position_pair: str position_pair: str
@@ -221,7 +220,6 @@ class FundingLoan(_Type):
notify: int notify: int
hidden: int hidden: int
renew: int renew: int
rate_real: float
no_close: int no_close: int
@dataclass @dataclass
@@ -230,12 +228,12 @@ class Wallet(_Type):
currency: str currency: str
balance: float balance: float
unsettled_interest: float unsettled_interest: float
balance_available: float available_balance: float
description: str last_change: str
meta: JSON trade_details: JSON
@dataclass @dataclass
class BalanceInfo(_Type): class Balance(_Type):
aum: float aum: float
aum_net: float aum_net: float