Bring Alpaca and OANDA implementation functions into alignment
This commit is contained in:
parent
a41a1e76a5
commit
3a7b5c3ffd
|
@ -22,9 +22,16 @@ class AlpacaExchange(BaseExchange):
|
||||||
def get_account(self):
|
def get_account(self):
|
||||||
return self.call("get_account")
|
return self.call("get_account")
|
||||||
|
|
||||||
def get_supported_assets(self):
|
def get_instruments(self):
|
||||||
request = GetAssetsRequest(status="active", asset_class="crypto")
|
request = GetAssetsRequest(status="active", asset_class="crypto")
|
||||||
assets = self.call("get_all_assets", filter=request)
|
assets = self.call("get_all_assets", filter=request)
|
||||||
|
return assets
|
||||||
|
|
||||||
|
def get_currencies(self, currencies):
|
||||||
|
pass # TODO
|
||||||
|
|
||||||
|
def get_supported_assets(self):
|
||||||
|
assets = self.get_instruments()
|
||||||
assets = assets["itemlist"]
|
assets = assets["itemlist"]
|
||||||
asset_list = [x["symbol"] for x in assets if "symbol" in x]
|
asset_list = [x["symbol"] for x in assets if "symbol" in x]
|
||||||
|
|
||||||
|
@ -67,7 +74,7 @@ class AlpacaExchange(BaseExchange):
|
||||||
cast = {
|
cast = {
|
||||||
"symbol": trade.symbol,
|
"symbol": trade.symbol,
|
||||||
"side": direction,
|
"side": direction,
|
||||||
"time_in_force": TimeInForce.IOC,
|
"time_in_force": TimeInForce.IOC, # TODO
|
||||||
}
|
}
|
||||||
if trade.amount is not None:
|
if trade.amount is not None:
|
||||||
cast["qty"] = trade.amount
|
cast["qty"] = trade.amount
|
||||||
|
@ -115,7 +122,7 @@ class AlpacaExchange(BaseExchange):
|
||||||
return order
|
return order
|
||||||
|
|
||||||
def get_trade(self, trade_id):
|
def get_trade(self, trade_id):
|
||||||
pass
|
pass # TODO
|
||||||
|
|
||||||
def update_trade(self, trade):
|
def update_trade(self, trade):
|
||||||
pass
|
pass
|
||||||
|
@ -125,7 +132,7 @@ class AlpacaExchange(BaseExchange):
|
||||||
|
|
||||||
def get_position_info(self, symbol):
|
def get_position_info(self, symbol):
|
||||||
position = self.call("get_open_position", symbol)
|
position = self.call("get_open_position", symbol)
|
||||||
return position
|
return position # TODO: check
|
||||||
|
|
||||||
def get_all_positions(self):
|
def get_all_positions(self):
|
||||||
items = []
|
items = []
|
||||||
|
@ -139,7 +146,7 @@ class AlpacaExchange(BaseExchange):
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def close_position(self, side, symbol):
|
def close_position(self, side, symbol):
|
||||||
pass
|
pass # TODO
|
||||||
|
|
||||||
def close_all_positions(self):
|
def close_all_positions(self):
|
||||||
pass
|
pass # TODO
|
||||||
|
|
Loading…
Reference in New Issue