Accept humanized str input for order settings
parent
d3d7f8a6f8
commit
4d06502bc8
|
@ -36,7 +36,7 @@ from ._anchors import (
|
|||
pp_tight_and_right, # wanna keep it straight in the long run
|
||||
gpath_pin,
|
||||
)
|
||||
from ..calc import humanize, pnl
|
||||
from ..calc import humanize, pnl, puterize
|
||||
from ..clearing._allocate import Allocator, Position
|
||||
from ..data._normalize import iterticks
|
||||
from ..data.feed import Feed
|
||||
|
@ -209,16 +209,14 @@ class SettingsPane:
|
|||
|
||||
# WRITE any settings to current pp's allocator
|
||||
try:
|
||||
value = puterize(value)
|
||||
if key == 'limit':
|
||||
if size_unit == 'currency':
|
||||
# old = alloc.currency_limit
|
||||
alloc.currency_limit = float(value)
|
||||
alloc.currency_limit = value
|
||||
else:
|
||||
# old = alloc.units_limit
|
||||
alloc.units_limit = float(value)
|
||||
alloc.units_limit = value
|
||||
|
||||
elif key == 'slots':
|
||||
# old = alloc.slots
|
||||
alloc.slots = int(value)
|
||||
|
||||
elif key == 'size_unit':
|
||||
|
@ -226,7 +224,7 @@ class SettingsPane:
|
|||
# the current settings in the new units
|
||||
alloc.size_unit = value
|
||||
|
||||
elif key != 'account':
|
||||
else:
|
||||
raise ValueError(f'Unknown setting {key}')
|
||||
|
||||
log.info(f'settings change: {key}: {value}')
|
||||
|
|
Loading…
Reference in New Issue