Closed mehedi02 closed 5 years ago
@mehedi02
it looks like you mixup my library (oandapyV20) and the one of Oanda (v20).
Using oandapyV20 you create request instances and process these using the client (the oanda instance in your example). So instead of your 'data-line' create the request and process it like:
# see: http://developer.oanda.com/rest-live-v20/instrument-ep/
params = { 'from': ...,
'to': ... ,
'granularity':
}
r = instruments.InstrumentsCandles(instrument="EUR_USD", params=params)
oanda.request(r)
print r.response['candles']
take a look at the docs: https://oanda-api-v20.readthedocs.io/en/latest/endpoints/instruments/instrumentlist.html
Thank you for your reply
On Sun, Apr 28, 2019, 2:18 PM Feite Brekeveld notifications@github.com wrote:
@mehedi02 https://github.com/mehedi02
it looks like you mixup my library (oandapyV20) and the one of Oanda (v20).
Using oandapyV20 you create request instances and process these using the client (the oanda instance in your example). So instead of your 'data-line' create the request and process it like:
see: http://developer.oanda.com/rest-live-v20/instrument-ep/
params = { 'from': ..., 'to': ... , 'granularity': } r = instruments.InstrumentsCandles(instrument="EUR_USD", params=params) oanda.request(r) print r.response['candles']
take a look at the docs: https://oanda-api-v20.readthedocs.io/en/latest/endpoints/instruments/instrumentlist.html
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hootnot/oanda-api-v20/issues/143#issuecomment-487356778, or mute the thread https://github.com/notifications/unsubscribe-auth/AJPQNY2ZWI4YSCL7K7R6PJTPSVMVBANCNFSM4HI5TNFA .
Hi,
Since you were playing with historical data and dataframes you might want to take a look at:
Following code produce AttributeError
import configparser import oandapyV20 as opy import pandas as pd
config = configparser.ConfigParser() config.read('oanda.cfg')
oanda = opy.API(environment='practice', access_token=config['oanda']['access_token'])
data = oanda.get_historyV20(instrument='EUR_USD', start='2016-12-08', end='2016-12-10', granularity='M1')
df = pd.DataFrame(data['candles']).set_index('time')
df.index = pd.DatetimeIndex(df.index)
df.info()