add class Pair in venues, PAIRTYPES for future uses
parent
499b2d0090
commit
b3bbef30c0
|
@ -56,25 +56,44 @@ def get_api_eps(venue: MarketType) -> tuple[str, str]:
|
||||||
}[venue]
|
}[venue]
|
||||||
|
|
||||||
|
|
||||||
class OptionPair(Struct, frozen=True, kw_only=True):
|
class Pair(Struct, frozen=True, kw_only=True):
|
||||||
|
|
||||||
symbol: str
|
symbol: str
|
||||||
venue: str
|
|
||||||
|
|
||||||
# src
|
# src
|
||||||
quote_currency: str
|
quote_currency: str # 'BTC'
|
||||||
|
|
||||||
# dst
|
# dst
|
||||||
base_currency: str
|
settlement_currency: str # "BTC",
|
||||||
|
|
||||||
tick_size: float # 0.0001
|
tick_size: float # 0.0001
|
||||||
tick_size_steps: list[dict] # [{'above_price': 0.005, 'tick_size': 0.0005}]
|
tick_size_steps: list[dict[str, str | int | float]] # [{'above_price': 0.005, 'tick_size': 0.0005}]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def price_tick(self) -> Decimal:
|
||||||
|
step_size: str = self.tick_size_steps[0].get('above_price')
|
||||||
|
return Decimal(step_size)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def size_tick(self) -> Decimal:
|
||||||
|
step_size: str = self.tick_size_steps[0].get('tick_size')
|
||||||
|
return Decimal(step_size)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def bs_fqme(self) -> str:
|
||||||
|
return self.symbol
|
||||||
|
|
||||||
|
@property
|
||||||
|
def bs_mktid(self) -> str:
|
||||||
|
return f'{self.symbol}.{self.venue}'
|
||||||
|
|
||||||
|
|
||||||
|
class OptionPair(Struct, frozen=True, kw_only=True):
|
||||||
|
|
||||||
taker_commission: float # 0.0003
|
taker_commission: float # 0.0003
|
||||||
strike: float # 5000.0
|
strike: float # 5000.0
|
||||||
settlement_period: str # 'day'
|
settlement_period: str # 'day'
|
||||||
settlement_currency: str # "BTC",
|
|
||||||
rfq: bool # false
|
rfq: bool # false
|
||||||
quote_currency: str # 'BTC'
|
|
||||||
price_index: str # 'btc_usd'
|
price_index: str # 'btc_usd'
|
||||||
option_type: str # 'call'
|
option_type: str # 'call'
|
||||||
min_trade_amount: float # 0.1
|
min_trade_amount: float # 0.1
|
||||||
|
@ -110,10 +129,13 @@ class OptionPair(Struct, frozen=True, kw_only=True):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bs_dst_asset(self) -> str:
|
def bs_dst_asset(self) -> str:
|
||||||
return f'{self.base_currency}'
|
return f'{self.settlement_currency}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bs_mktid(self) -> str:
|
def bs_mktid(self) -> str:
|
||||||
return f'{self.symbol}.{self.venue}'
|
return f'{self.symbol}.{self.venue}'
|
||||||
|
|
||||||
|
|
||||||
|
PAIRTYPES: dict[MarketType, Pair] = {
|
||||||
|
'option': OptionPair,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue