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, MktPair,
Symbol, Symbol,
unpack_fqme, unpack_fqme,
_derivs as DerivTypes,
) )
from ._allocate import ( from ._allocate import (
mk_allocator, mk_allocator,
@ -65,6 +66,7 @@ __all__ = [
'open_pps', 'open_pps',
'open_trade_ledger', 'open_trade_ledger',
'unpack_fqme', 'unpack_fqme',
'DerivTypes',
] ]

View File

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