Remove order.leverage column
This commit is contained in:
parent
e3471129f7
commit
94274e4823
@ -197,18 +197,15 @@ def migrate_orders_table(engine, table_back_name: str, cols_order: List):
|
|||||||
ft_fee_base = get_column_def(cols_order, 'ft_fee_base', 'null')
|
ft_fee_base = get_column_def(cols_order, 'ft_fee_base', 'null')
|
||||||
average = get_column_def(cols_order, 'average', 'null')
|
average = get_column_def(cols_order, 'average', 'null')
|
||||||
|
|
||||||
# let SQLAlchemy create the schema as required
|
|
||||||
leverage = get_column_def(cols_order, 'leverage', '1.0')
|
|
||||||
# sqlite does not support literals for booleans
|
# sqlite does not support literals for booleans
|
||||||
with engine.begin() as connection:
|
with engine.begin() as connection:
|
||||||
connection.execute(text(f"""
|
connection.execute(text(f"""
|
||||||
insert into orders ( id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
insert into orders ( id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
||||||
status, symbol, order_type, side, price, amount, filled, average, remaining, cost,
|
status, symbol, order_type, side, price, amount, filled, average, remaining, cost,
|
||||||
order_date, order_filled_date, order_update_date, ft_fee_base, leverage)
|
order_date, order_filled_date, order_update_date, ft_fee_base)
|
||||||
select id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
select id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
|
||||||
status, symbol, order_type, side, price, amount, filled, {average} average, remaining,
|
status, symbol, order_type, side, price, amount, filled, {average} average, remaining,
|
||||||
cost, order_date, order_filled_date, order_update_date, {ft_fee_base} ft_fee_base,
|
cost, order_date, order_filled_date, order_update_date, {ft_fee_base} ft_fee_base
|
||||||
{leverage} leverage
|
|
||||||
from {table_back_name}
|
from {table_back_name}
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
|
@ -135,7 +135,6 @@ class Order(_DECL_BASE):
|
|||||||
order_date = Column(DateTime, nullable=True, default=datetime.utcnow)
|
order_date = Column(DateTime, nullable=True, default=datetime.utcnow)
|
||||||
order_filled_date = Column(DateTime, nullable=True)
|
order_filled_date = Column(DateTime, nullable=True)
|
||||||
order_update_date = Column(DateTime, nullable=True)
|
order_update_date = Column(DateTime, nullable=True)
|
||||||
leverage = Column(Float, nullable=True, default=1.0)
|
|
||||||
|
|
||||||
ft_fee_base = Column(Float, nullable=True)
|
ft_fee_base = Column(Float, nullable=True)
|
||||||
|
|
||||||
@ -183,9 +182,6 @@ class Order(_DECL_BASE):
|
|||||||
self.average = order.get('average', self.average)
|
self.average = order.get('average', self.average)
|
||||||
self.remaining = order.get('remaining', self.remaining)
|
self.remaining = order.get('remaining', self.remaining)
|
||||||
self.cost = order.get('cost', self.cost)
|
self.cost = order.get('cost', self.cost)
|
||||||
# TODO-lev: ccxt order objects don't contain leverage.
|
|
||||||
# Therefore the below will always be 1.0 - which is wrong.
|
|
||||||
self.leverage = order.get('leverage', self.leverage)
|
|
||||||
|
|
||||||
if 'timestamp' in order and order['timestamp'] is not None:
|
if 'timestamp' in order and order['timestamp'] is not None:
|
||||||
self.order_date = datetime.fromtimestamp(order['timestamp'] / 1000, tz=timezone.utc)
|
self.order_date = datetime.fromtimestamp(order['timestamp'] / 1000, tz=timezone.utc)
|
||||||
@ -608,9 +604,6 @@ class LocalTrade():
|
|||||||
# Update open rate and actual amount
|
# Update open rate and actual amount
|
||||||
self.open_rate = order.safe_price
|
self.open_rate = order.safe_price
|
||||||
self.amount = order.safe_amount_after_fee
|
self.amount = order.safe_amount_after_fee
|
||||||
# if 'leverage' in order:
|
|
||||||
# TODO-lev: order.leverage is not properly filled on the order object!
|
|
||||||
# self.leverage = order.leverage
|
|
||||||
if self.is_open:
|
if self.is_open:
|
||||||
payment = "SELL" if self.is_short else "BUY"
|
payment = "SELL" if self.is_short else "BUY"
|
||||||
logger.info(f'{order.order_type.upper()}_{payment} has been fulfilled for {self}.')
|
logger.info(f'{order.order_type.upper()}_{payment} has been fulfilled for {self}.')
|
||||||
|
Loading…
Reference in New Issue
Block a user