question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

connectivity problem: cannot get candle data

See original GitHub issue

When I use v20-instrument-candles EUR_USD

I got following error message

Traceback (most recent call last):
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 393, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 389, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 575, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 640, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py", line 261, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
    chunked=chunked)
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 395, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 315, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api-fxpractice.oanda.com', port=443): Read timed out. (read timeout=2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/v20/__init__.py", line 301, in request
    timeout=timeout
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/requests/adapters.py", line 499, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api-fxpractice.oanda.com', port=443): Read timed out. (read timeout=2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dex/github/v20-python-samples/env/bin/v20-instrument-candles", line 11, in <module>
    load_entry_point('v20-python-samples', 'console_scripts', 'v20-instrument-candles')()
  File "/home/dex/github/v20-python-samples/src/instrument/candles.py", line 139, in main
    response = api.instrument.candles(args.instrument, **kwargs)
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/v20/instrument.py", line 311, in candles
    response = self.ctx.request(request)
  File "/home/dex/github/v20-python-samples/env/lib/python3.5/site-packages/v20/__init__.py", line 308, in request
    raise V20Timeout(url, "read")
v20.errors.V20Timeout: v20 REST request to https://api-fxpractice.oanda.com:443/v3/instruments/EUR_USD/candles has timed out (read)

And then I checked the official doc and tried another method to get candle (example from doc, excluded my own token & account)

curl \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <AUTHENTICATION TOKEN>" \
  "https://api-fxtrade.oanda.com/v3/instruments/EUR_USD/candles?count=6&price=M&granularity=S5"

Still I got

{"errorMessage":"An internal server error has occurred."}

But I am able to create order using python src/market_order_full_example.py

So this seems to be a problem with connectivity of oanda’s candle api. Anyone knows how to fix this problem? Thanks in advance!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
hootnotcommented, Jul 13, 2017

My personal experience is that both environments are very stable. Last week the live environment had issues during the day, over several days, that was also to find on the health page. I have ‘oanda-trading-environment’ installed on a raspberry pi and it has very long uptimes. This maintenance weekend was an exception to other maintenance weekends.

Just noticed there were issues again in live streaming …

1reaction
hootnotcommented, Jul 10, 2017

Guess your are still waiting for it to come up…

OANDA had an extended maintenance program (was till yesterday on the login page). V20 history candle history is still not working on the practice env. Streaming quotes work fine though. The old V1 has no issues.

I just tried the V20 live-environment to perform the same request to get some candle data and that works fine too.

So if you only have practice you still need some patience …

Read more comments on GitHub >

github_iconTop Results From Across the Web

Candle API not returning any data - Kite Connect
The possible close reason is AWS. Sometime times AWS Firewall blocks incoming traffic for unknown reason(Just for few seconds to few hours). We ......
Read more >
Cannot retrieve correct historic rates using Coinbase Pro API
I'm asking data for 10 minutes, with a granularity of 60 seconds, so I was expecting ten candles data. Instead I obtain a...
Read more >
last MES candle is distorted (Faulty CQG data!) - Support Board
The solution was to reconnect to the data feed, to get correct metadata which on the prior connection CQG was transmitting incorrectly.
Read more >
Why doesn't the candlestick bodies align to open/close?
It's likely there is data missing around, that does not get into charts when individual candles are generated.
Read more >
Plot minute candle stick by Yuval sss - QuantConnect.com
Hello,When plotting candle charts the data is aggregated into days (or weeks). ... The problem is getting such a plot to work -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found