Implement trailing stop loss
This commit is contained in:
@@ -66,6 +66,11 @@ class OANDAExchange(BaseExchange):
|
||||
data["order"]["price"] = str(trade.price)
|
||||
elif trade.type == "market":
|
||||
data["order"]["priceBound"] = str(trade.price)
|
||||
if trade.trailing_stop_loss is not None:
|
||||
data["order"]["trailingStopLossOnFill"] = {
|
||||
"distance": str(trade.trailing_stop_loss),
|
||||
"timeInForce": "GTC",
|
||||
}
|
||||
r = orders.OrderCreate(self.account_id, data=data)
|
||||
response = self.call(r)
|
||||
trade.response = response
|
||||
|
||||
Reference in New Issue
Block a user