Modified the position handling to fix a pricing bug, so that locally handled Portfolio values match those of OANDA (up to slippage).

This commit is contained in:
Michael Halls-Moore
2015-07-13 16:30:55 +01:00
parent be9ef2b54f
commit 675412c125
6 changed files with 73 additions and 60 deletions
+2 -1
View File
@@ -38,12 +38,13 @@ class StreamingForexPrices(PriceHandler):
def connect_to_stream(self):
pairs_oanda = ["%s_%s" % (p[:3], p[3:]) for p in self.pairs]
pair_list = ",".join(pairs_oanda)
try:
requests.packages.urllib3.disable_warnings()
s = requests.Session()
url = "https://" + self.domain + "/v1/prices"
headers = {'Authorization' : 'Bearer ' + self.access_token}
params = {'instruments' : pairs_oanda, 'accountId' : self.account_id}
params = {'instruments' : pair_list, 'accountId' : self.account_id}
req = requests.Request('GET', url, headers=headers, params=params)
pre = req.prepare()
resp = s.send(pre, stream=True, verify=False)