Make a derivs intrustment type table for alloc config checks

big_data_lines
Tyler Goodlet 2022-03-21 15:25:45 -04:00
parent 1a0e89d07e
commit ed03d77e6e
1 changed files with 10 additions and 7 deletions

View File

@ -284,6 +284,14 @@ class Allocator(BaseModel):
return round(prop * self.slots) return round(prop * self.slots)
_derivs = (
'future',
'continuous_future',
'option',
'futures_option',
)
def mk_allocator( def mk_allocator(
symbol: Symbol, symbol: Symbol,
@ -322,12 +330,7 @@ def mk_allocator(
# specific configs by asset class / type # specific configs by asset class / type
if asset_type in ( if asset_type in _derivs:
'future',
'continuous_future',
'option',
'futures_option',
):
# since it's harder to know how currency "applies" in this case # since it's harder to know how currency "applies" in this case
# given leverage properties # given leverage properties
alloc.size_unit = '# units' alloc.size_unit = '# units'
@ -350,7 +353,7 @@ def mk_allocator(
if startup_size > alloc.units_limit: if startup_size > alloc.units_limit:
alloc.units_limit = startup_size alloc.units_limit = startup_size
if asset_type in ('future', 'option', 'futures_option'): if asset_type in _derivs:
alloc.slots = alloc.units_limit alloc.slots = alloc.units_limit
return alloc return alloc