Add support for different order types

This commit is contained in:
Matthias
2018-11-15 06:58:24 +01:00
parent 23958ba96a
commit 6a71f80a9e
5 changed files with 35 additions and 16 deletions

View File

@@ -475,7 +475,8 @@ class FreqtradeBot(object):
amount = stake_amount / buy_limit
order_id = self.exchange.buy(pair, buy_limit, amount)['id']
order_id = self.exchange.buy(pair=pair, rate=buy_limit, amount=amount,
ordertype=self.strategy.order_types['buy'])['id']
self.rpc.send_msg({
'type': RPCMessageType.BUY_NOTIFICATION,
@@ -762,8 +763,12 @@ class FreqtradeBot(object):
:param sellreason: Reason the sell was triggered
:return: None
"""
sell_type = 'sell'
if sell_reason in (SellType.STOP_LOSS, SellType.TRAILING_STOP_LOSS):
sell_type = 'stoploss'
# Execute sell and update trade record
order_id = self.exchange.sell(str(trade.pair), limit, trade.amount)['id']
order_id = self.exchange.sell(pair=str(trade.pair), rate=limit, amount=trade.amount,
ordertype=self.strategy.order_types[sell_type])['id']
trade.open_order_id = order_id
trade.close_rate_requested = limit
trade.sell_reason = sell_reason.value