Implement closing trades on OANDA
This commit is contained in:
parent
2fa61fb195
commit
9835219e51
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue