Bring Alpaca and OANDA implementation functions into alignment

This commit is contained in:
Mark Veidemanis 2022-12-13 07:20:49 +00:00
parent a41a1e76a5
commit 3a7b5c3ffd
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 13 additions and 6 deletions

View File

@ -22,9 +22,16 @@ class AlpacaExchange(BaseExchange):
def get_account(self):
return self.call("get_account")
def get_supported_assets(self):
def get_instruments(self):
request = GetAssetsRequest(status="active", asset_class="crypto")
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"]
asset_list = [x["symbol"] for x in assets if "symbol" in x]
@ -67,7 +74,7 @@ class AlpacaExchange(BaseExchange):
cast = {
"symbol": trade.symbol,
"side": direction,
"time_in_force": TimeInForce.IOC,
"time_in_force": TimeInForce.IOC, # TODO
}
if trade.amount is not None:
cast["qty"] = trade.amount
@ -115,7 +122,7 @@ class AlpacaExchange(BaseExchange):
return order
def get_trade(self, trade_id):
pass
pass # TODO
def update_trade(self, trade):
pass
@ -125,7 +132,7 @@ class AlpacaExchange(BaseExchange):
def get_position_info(self, symbol):
position = self.call("get_open_position", symbol)
return position
return position # TODO: check
def get_all_positions(self):
items = []
@ -139,7 +146,7 @@ class AlpacaExchange(BaseExchange):
return items
def close_position(self, side, symbol):
pass
pass # TODO
def close_all_positions(self):
pass
pass # TODO