Add `MktPair._atype` for back-compat, always `str(.dst)`
parent
94cb8fa1b1
commit
d6634e9b02
|
@ -215,6 +215,8 @@ class MktPair(Struct, frozen=True):
|
||||||
# strike price, call or put, swap type, exercise model, etc.
|
# strike price, call or put, swap type, exercise model, etc.
|
||||||
contract_info: str | None = None
|
contract_info: str | None = None
|
||||||
|
|
||||||
|
_atype: str = ''
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_msg(
|
def from_msg(
|
||||||
self,
|
self,
|
||||||
|
@ -239,6 +241,8 @@ class MktPair(Struct, frozen=True):
|
||||||
size_tick: float | str,
|
size_tick: float | str,
|
||||||
bs_mktid: str,
|
bs_mktid: str,
|
||||||
|
|
||||||
|
**kwargs,
|
||||||
|
|
||||||
) -> MktPair:
|
) -> MktPair:
|
||||||
|
|
||||||
broker, key, suffix = unpack_fqme(fqme)
|
broker, key, suffix = unpack_fqme(fqme)
|
||||||
|
@ -254,6 +258,8 @@ class MktPair(Struct, frozen=True):
|
||||||
size_tick=size_tick,
|
size_tick=size_tick,
|
||||||
bs_mktid=bs_mktid,
|
bs_mktid=bs_mktid,
|
||||||
broker=broker,
|
broker=broker,
|
||||||
|
|
||||||
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -267,7 +273,7 @@ class MktPair(Struct, frozen=True):
|
||||||
"symbol".
|
"symbol".
|
||||||
|
|
||||||
'''
|
'''
|
||||||
return maybe_cons_tokens([self.dst, self.src])
|
return maybe_cons_tokens([str(self.dst), self.src])
|
||||||
|
|
||||||
# NOTE: the main idea behind an fqme is to map a "market address"
|
# NOTE: the main idea behind an fqme is to map a "market address"
|
||||||
# to some endpoint from a transaction provider (eg. a broker) such
|
# to some endpoint from a transaction provider (eg. a broker) such
|
||||||
|
@ -351,8 +357,11 @@ class MktPair(Struct, frozen=True):
|
||||||
# TODO: BACKWARD COMPAT, TO REMOVE?
|
# TODO: BACKWARD COMPAT, TO REMOVE?
|
||||||
@property
|
@property
|
||||||
def type_key(self) -> str:
|
def type_key(self) -> str:
|
||||||
|
if isinstance(self.dst, Asset):
|
||||||
return str(self.dst.atype)
|
return str(self.dst.atype)
|
||||||
|
|
||||||
|
return self._atype
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tick_size_digits(self) -> int:
|
def tick_size_digits(self) -> int:
|
||||||
return float_digits(self.price_tick)
|
return float_digits(self.price_tick)
|
||||||
|
|
Loading…
Reference in New Issue