Use units by default for continuous futes
parent
1ad83e4556
commit
772f871272
|
@ -178,7 +178,9 @@ class Allocator(BaseModel):
|
||||||
l_sub_pp = (self.currency_limit - live_cost_basis) / price
|
l_sub_pp = (self.currency_limit - live_cost_basis) / price
|
||||||
|
|
||||||
else:
|
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)
|
# an entry (adding-to or starting a pp)
|
||||||
if (
|
if (
|
||||||
|
@ -290,7 +292,7 @@ def mk_allocator(
|
||||||
# default allocation settings
|
# default allocation settings
|
||||||
defaults: dict[str, float] = {
|
defaults: dict[str, float] = {
|
||||||
'account': None, # select paper by default
|
'account': None, # select paper by default
|
||||||
'size_unit': 'currency', #_size_units['currency'],
|
'size_unit': 'currency',
|
||||||
'units_limit': 400,
|
'units_limit': 400,
|
||||||
'currency_limit': 5e3,
|
'currency_limit': 5e3,
|
||||||
'slots': 4,
|
'slots': 4,
|
||||||
|
@ -318,11 +320,14 @@ def mk_allocator(
|
||||||
|
|
||||||
asset_type = symbol.type_key
|
asset_type = symbol.type_key
|
||||||
|
|
||||||
|
|
||||||
# specific configs by asset class / type
|
# 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
|
# 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'
|
||||||
|
|
Loading…
Reference in New Issue