Closed Mexflubber closed 4 years ago
After doing some debugging I found that this always happens after a "Delayed", and the line that breaks is
msg = self.qhist.get()
of https://github.com/happydasch/btoandav20/blob/master/btoandav20/feeds/oandav20feed.py#L436
checked the size of the queue and it is 0.
DATA NOTIF: CONNBROKEN DATA NOTIF: DELAYED ***** STORE NOTIF: v20 REST request to https://stream-fxpractice.oanda.com:443/v3/accounts/x/pricing/stream?instruments=EUR_USD has timed out (stream)
this just tells you, that there was a disconnect. this may happen because of a timeout, you internet connection goes away, ...
for the queue, this just means, it is still waiting for a reconnection. The code will continue, after the reconnection was successful. Until then, it will wait at this point.
What else would you expect to happen at the point, where no connection to the stream is available?
Also check out the param quicknotify=True when running backtrader. This will allow to show notifications, while there is no new data.
Don't get me wrong, if there is a issue, i would fix it, but this behaviour is inteded.
It could be, that there is another underlaying problem in the store, where the reconnection is happening. But i cannot reproduce this behaviour.
also, with the practice account, it is from time to time not possible to connect, the timeouts occour way more often then in live trading.
The lines you referenced are fine. The TODO i added for the param onlyComplete=False. This just means, when fetching data from oanda, which happened between reconnections will include incomplete candles. So you would even get a new candle within the given compression / timeframe.
That the code waits at the empty queue is also fine, since it is waiting for a reconnection.
If a reconnection does not happen, then it will be at a different place (specially in the store, where historical candles are fetched).
If you are fine debugging, check this block: https://github.com/happydasch/btoandav20/blob/4624873b87df05d27db62a2ae5faae8377449e01/btoandav20/stores/oandav20store.py#L718 especially https://github.com/happydasch/btoandav20/blob/4624873b87df05d27db62a2ae5faae8377449e01/btoandav20/stores/oandav20store.py#L745 and https://github.com/happydasch/btoandav20/blob/4624873b87df05d27db62a2ae5faae8377449e01/btoandav20/stores/oandav20store.py#L731
So, I kept debugging and on this line it appears that an exception is being swallowed here.
After debugging I get the following error. I might need more help from you. If you want we can keep chatting over email at aldogarcia at gmail and we can post the resolution here after (I can even send a merge request).
`GET https://api-fxpractice.oanda.com:443/v3/instruments/EUR_USD/candles?price=M&granularity=S5&from=2020-09-05T03%3A32%3A00.000000000Z&includeFirst=True expected status 200, got 400 (Bad Request)"
i've send you an email
For anyone having issues with reconnection, in this case, it worked to provide a timezone. I will look into that more deeply. For now, if reconnections are not working, try to set a timezone.
Ex.
python examples/oandav20test/oandav20test.py --token XXX --account YYY --data0 EUR_USD --timezone America/Los_Angeles
Similar to https://github.com/happydasch/btoandav20/issues/54
I am experiencing timeouts but it my case it never recovers. Waited for 10 minutes and this was the last of it. Dis happened for at least 3-4 hours. I tried debugging v20 without success.