Tried to add liquidation price to order object, caused a test to fail
This commit is contained in:
parent
1414df5e27
commit
dd6cc1153b
@ -148,6 +148,7 @@ def migrate_orders_table(decl_base, inspector, engine, table_back_name: str, col
|
||||
decl_base.metadata.create_all(engine)
|
||||
leverage = get_column_def(cols, 'leverage', '1.0')
|
||||
is_short = get_column_def(cols, 'is_short', 'False')
|
||||
liquidation_price = get_column_def(cols, 'liquidation_price', 'False')
|
||||
with engine.begin() as connection:
|
||||
connection.execute(text(f"""
|
||||
insert into orders ( id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
||||
@ -156,7 +157,7 @@ def migrate_orders_table(decl_base, inspector, engine, table_back_name: str, col
|
||||
select id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
||||
status, symbol, order_type, side, price, amount, filled, null average, remaining, cost,
|
||||
order_date, order_filled_date, order_update_date,
|
||||
{leverage} leverage, {is_short} is_short
|
||||
{leverage} leverage, {is_short} is_short, {liquidation_price} liquidation_price
|
||||
from {table_back_name}
|
||||
"""))
|
||||
|
||||
|
@ -134,6 +134,7 @@ class Order(_DECL_BASE):
|
||||
|
||||
leverage = Column(Float, nullable=True, default=1.0)
|
||||
is_short = Column(Boolean, nullable=True, default=False)
|
||||
# liquidation_price = Column(Float, nullable=True)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
@ -159,6 +160,7 @@ class Order(_DECL_BASE):
|
||||
self.remaining = order.get('remaining', self.remaining)
|
||||
self.cost = order.get('cost', self.cost)
|
||||
self.leverage = order.get('leverage', self.leverage)
|
||||
# TODO-mg: liquidation price? is_short?
|
||||
if 'timestamp' in order and order['timestamp'] is not None:
|
||||
self.order_date = datetime.fromtimestamp(order['timestamp'] / 1000, tz=timezone.utc)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user