Add `MktPair._atype` for back-compat, always `str(.dst)`
parent
7aba290541
commit
cfbba9e0b3
|
@ -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,7 +357,10 @@ 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:
|
||||||
return str(self.dst.atype)
|
if isinstance(self.dst, Asset):
|
||||||
|
return str(self.dst.atype)
|
||||||
|
|
||||||
|
return self._atype
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tick_size_digits(self) -> int:
|
def tick_size_digits(self) -> int:
|
||||||
|
|
Loading…
Reference in New Issue