hootnot / oanda-api-v20

OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
MIT License
398 stars 107 forks source link

`InstrumentsCandles` Returns Candles from a few days ago #182

Closed mrpozzi closed 2 years ago

mrpozzi commented 2 years ago

I'm trying to pull the most recent batch of candles up to the latest incomplete candle but I keep getting back a batch that is approximately a few days old.

I'm not sure where to begin troubleshooting this, the most similar issue I found is Issue #144 but I'm not sure how to extrapolate to my case.

The code I'm running is

from oandapyV20 import API
import oandapyV20.endpoints.instruments as instruments

ctx = API(
    access_token=TOKEN,
    )

params = {
    'granularity': "M30",
    'count': 100,
    'alignmentTimezone': "UTC",
    'price': "AB"
}

candles_req = instruments.InstrumentsCandles(instrument="EUR_USD", params=params)
response = ctx.request(candles_req)
candles_req.response

The latest time stamp returned is 2021-07-30 20:30:00+00:00

mrpozzi commented 2 years ago

Nevermind. Deep and sincere apologies. Forex is obviously not trading over the weekend...