Add a "perpetual_future" mkt info type

basic_buy_bot
Tyler Goodlet 2023-06-13 15:20:27 -04:00
parent e68c55e9bd
commit 4c4787ce58
2 changed files with 10 additions and 1 deletions

View File

@ -40,6 +40,7 @@ from ._mktinfo import (
MktPair,
Symbol,
unpack_fqme,
_derivs as DerivTypes,
)
from ._allocate import (
mk_allocator,
@ -65,6 +66,7 @@ __all__ = [
'open_pps',
'open_trade_ledger',
'unpack_fqme',
'DerivTypes',
]

View File

@ -39,6 +39,7 @@ from typing import (
from ..data.types import Struct
# TODO: make these literals..
_underlyings: list[str] = [
'stock',
'bond',
@ -52,6 +53,7 @@ _derivs: list[str] = [
'swap',
'future',
'continuous_future',
'perpetual_future',
'option',
'futures_option',
@ -540,10 +542,15 @@ class MktPair(Struct, frozen=True):
# TODO: BACKWARD COMPAT, TO REMOVE?
@property
def type_key(self) -> str:
# if set explicitly then use it!
if self._atype:
return self._atype
if isinstance(self.dst, Asset):
return str(self.dst.atype)
return self._atype
return 'unknown'
@property
def price_tick_digits(self) -> int: