Wrap API calls in helper and validate response
This commit is contained in:
@@ -2,9 +2,15 @@ from oandapyV20 import API
|
||||
from oandapyV20.endpoints import accounts, orders, positions, trades
|
||||
|
||||
from core.exchanges import BaseExchange
|
||||
from core.lib.schemas import oanda_s
|
||||
|
||||
OANDA_SCHEMA_MAPPING = {}
|
||||
|
||||
|
||||
class OANDAExchange(BaseExchange):
|
||||
def set_schema(self):
|
||||
self.schema = OANDA_SCHEMA_MAPPING
|
||||
|
||||
def connect(self):
|
||||
self.client = API(access_token=self.account.api_secret)
|
||||
self.account_id = self.account.api_key
|
||||
@@ -53,4 +59,4 @@ class OANDAExchange(BaseExchange):
|
||||
def get_all_positions(self):
|
||||
r = positions.OpenPositions(accountID=self.account_id)
|
||||
self.client.request(r)
|
||||
return r.response["positions"]
|
||||
return (True, [])
|
||||
|
||||
Reference in New Issue
Block a user