date format to get history

4 posts / 0 new
Last post
cephalopod
date format to get history

Hello everyone,

I'm using R to access the IG API and I'm having some issues retrieving historical information. In the following piece of code how do i enter the date format>

I tried "2018-07-09000000/2018-07-10000000" which did not work...any assistance would be greatly appreciated

httr::GET("https://demo-api.ig.com/gateway/deal/prices/CS.D.EURUSD.MINI.IP/HOUR_4/2...",
add_headers(`X-IG-API-KEY` = vvvvvv,
`CST` = ccccc,
`X-SECURITY-TOKEN` = xxx),
content_type_json())

Thanks in advance.

Kind regards,
Joe

ExhaleTrading
IG requires the date format

IG requires the date format to be little special. You have to bring it in the following form:

resolution=HOUR&from=2018-07-02T00%3A00%3A00&to=2018-07-10T23%3A59%3A59

You need this "T" between date and time and the colons in the time string must be replaced by "%3A". Don't ask me why but it works this way. :-)

cephalopod
Date format

Hi Boris,

Tried what you recommended but that did not work.
I'm using Version 2 for now.

Any other ideas?

cephalopod
Date format

Ok, I worked it out. I was using Version = 2 instead of 3!

Managed to do this with assistance from helpdesk and the API companion (which I should have used in the first instance to work out the address instead of relying on "Reference" tab.

Log in or register to post comments