Add open_rate_requested and close_rate_requested for slippage detection

This commit is contained in:
Matthias Voppichler 2018-04-25 20:16:36 +02:00
parent 43fd9b37df
commit d3fb2e4516
2 changed files with 4 additions and 0 deletions

View File

@ -330,6 +330,7 @@ class FreqtradeBot(object):
fee_open=fee, fee_open=fee,
fee_close=fee, fee_close=fee,
open_rate=buy_limit, open_rate=buy_limit,
open_rate_requested=buy_limit,
open_date=datetime.utcnow(), open_date=datetime.utcnow(),
exchange=exchange.get_id(), exchange=exchange.get_id(),
open_order_id=order_id open_order_id=order_id
@ -538,6 +539,7 @@ class FreqtradeBot(object):
# Execute sell and update trade record # Execute sell and update trade record
order_id = exchange.sell(str(trade.pair), limit, trade.amount)['id'] order_id = exchange.sell(str(trade.pair), limit, trade.amount)['id']
trade.open_order_id = order_id trade.open_order_id = order_id
trade.close_rate_requested = limit
fmt_exp_profit = round(trade.calc_profit_percent(rate=limit) * 100, 2) fmt_exp_profit = round(trade.calc_profit_percent(rate=limit) * 100, 2)
profit_trade = trade.calc_profit(rate=limit) profit_trade = trade.calc_profit(rate=limit)

View File

@ -88,7 +88,9 @@ class Trade(_DECL_BASE):
fee_open = Column(Float, nullable=False, default=0.0) fee_open = Column(Float, nullable=False, default=0.0)
fee_close = Column(Float, nullable=False, default=0.0) fee_close = Column(Float, nullable=False, default=0.0)
open_rate = Column(Float) open_rate = Column(Float)
open_rate_requested = Column(Float)
close_rate = Column(Float) close_rate = Column(Float)
close_rate_requested = Column(Float)
close_profit = Column(Float) close_profit = Column(Float)
stake_amount = Column(Float, nullable=False) stake_amount = Column(Float, nullable=False)
amount = Column(Float) amount = Column(Float)