Use units by default for continuous futes

big_data_lines
Tyler Goodlet 2022-03-18 10:59:05 -04:00
parent 1ad83e4556
commit 772f871272
1 changed files with 10 additions and 5 deletions

View File

@ -178,7 +178,9 @@ class Allocator(BaseModel):
l_sub_pp = (self.currency_limit - live_cost_basis) / price
else:
raise ValueError(f"Not valid size unit '{size}'")
raise ValueError(
f"Not valid size unit '{size_unit}'"
)
# an entry (adding-to or starting a pp)
if (
@ -290,7 +292,7 @@ def mk_allocator(
# default allocation settings
defaults: dict[str, float] = {
'account': None, # select paper by default
'size_unit': 'currency', #_size_units['currency'],
'size_unit': 'currency',
'units_limit': 400,
'currency_limit': 5e3,
'slots': 4,
@ -318,11 +320,14 @@ def mk_allocator(
asset_type = symbol.type_key
# specific configs by asset class / type
if asset_type in ('future', 'option', 'futures_option'):
if asset_type in (
'future',
'continuous_future',
'option',
'futures_option',
):
# since it's harder to know how currency "applies" in this case
# given leverage properties
alloc.size_unit = '# units'