Woops, implement `Symbol.fqme` same a `Mktpair`..

master
Tyler Goodlet 2023-05-14 20:24:19 -04:00
parent ebe351e2ee
commit 98c043815a
1 changed files with 12 additions and 11 deletions

View File

@ -552,6 +552,9 @@ class Symbol(Struct):
''' '''
key: str key: str
broker: str = ''
venue: str = ''
# precision descriptors for price and vlm # precision descriptors for price and vlm
tick_size: Decimal = Decimal('0.01') tick_size: Decimal = Decimal('0.01')
lot_tick_size: Decimal = Decimal('0.0') lot_tick_size: Decimal = Decimal('0.0')
@ -571,9 +574,11 @@ class Symbol(Struct):
lot_size = info.get('lot_tick_size', 0.0) lot_size = info.get('lot_tick_size', 0.0)
return Symbol( return Symbol(
broker=broker,
key=mktep, key=mktep,
tick_size=tick_size, tick_size=tick_size,
lot_tick_size=lot_size, lot_tick_size=lot_size,
venue=venue,
suffix=suffix, suffix=suffix,
broker_info={broker: info}, broker_info={broker: info},
) )
@ -603,17 +608,13 @@ class Symbol(Struct):
return list(self.broker_info.keys())[0] return list(self.broker_info.keys())[0]
@property @property
def fqsn(self) -> str: def fqme(self) -> str:
broker = self.broker return maybe_cons_tokens([
key = self.key self.key, # final "pair name" (eg. qqq[/usd], btcusdt)
if self.suffix: self.venue,
tokens = (key, self.suffix, broker) self.suffix, # includes expiry and other con info
else: self.broker,
tokens = (key, broker) ])
return '.'.join(tokens).lower()
fqme = fqsn
def quantize( def quantize(
self, self,