Implement updating protection

This commit is contained in:
2023-02-22 07:20:37 +00:00
parent ba8eb69309
commit ed63085e10
4 changed files with 55 additions and 33 deletions

View File

@@ -145,13 +145,14 @@ class OANDAExchange(BaseExchange):
r = trades.TradeDetails(accountID=self.account_id, tradeID=trade_id)
return self.call(r)
def update_trade(self, trade):
raise NotImplementedError
# r = orders.OrderReplace(
# accountID=self.account_id, orderID=trade.order_id, data=data
# )
# self.client.request(r)
# return r.response
def update_trade(self, trade_id, take_profit_price, stop_loss_price):
data = {}
if take_profit_price:
data["takeProfit"] = {"price": str(take_profit_price)}
if stop_loss_price:
data["stopLoss"] = {"price": str(stop_loss_price)}
r = trades.TradeCRCDO(accountID=self.account_id, tradeID=trade_id, data=data)
return self.call(r)
def cancel_trade(self, trade_id):
raise NotImplementedError