diff --git a/core/exchanges/alpaca.py b/core/exchanges/alpaca.py index 0c0103f..03861d9 100644 --- a/core/exchanges/alpaca.py +++ b/core/exchanges/alpaca.py @@ -121,6 +121,11 @@ class AlpacaExchange(BaseExchange): trade.save() return order + def close_trade(self, trade_id): # TODO + """ + Close a trade + """ + def get_trade(self, trade_id): pass # TODO diff --git a/core/exchanges/oanda.py b/core/exchanges/oanda.py index af7a8d7..ae62306 100644 --- a/core/exchanges/oanda.py +++ b/core/exchanges/oanda.py @@ -94,6 +94,13 @@ class OANDAExchange(BaseExchange): trade.save() return response + def close_trade(self, trade_id): + """ + Close a trade. + """ + r = trades.TradeClose(accountID=self.account_id, tradeID=trade_id) + return self.call(r) + def get_trade(self, trade_id): # OANDA is off by one... r = trades.TradeDetails(accountID=self.account_id, tradeID=trade_id)