Remove asset filter and begin implementing posting trades

This commit is contained in:
2022-11-10 07:20:14 +00:00
parent 47384aed5f
commit 40f6330a13
7 changed files with 164 additions and 86 deletions

View File

@@ -1,4 +1,6 @@
from alpaca.common.exceptions import APIError
from glom import glom
from oandapyV20.exceptions import V20Error
from core.lib import schemas
from core.util import logs
@@ -135,7 +137,11 @@ class BaseExchange(object):
:raises NoSchema: If the method is not in the schema mapping
:raises ValidationError: If the response cannot be validated
"""
response = self.call_method(method, *args, **kwargs)
try:
response = self.call_method(method, *args, **kwargs)
except (APIError, V20Error) as e:
log.error(f"Error calling method {method}: {e}")
raise GenericAPIError(e)
try:
response_valid = self.validate_response(response, method)
except NoSchema as e:
@@ -147,6 +153,7 @@ class BaseExchange(object):
except NoSchema as e:
log.error(f"{e} - {response}")
response_converted = response_valid
# return (True, response_converted)
return response_converted