Jump to content
  • 0

IG Excel Sample Modified to Download Data by Historical Range


Hi! Anyone got any tools / ideas on how to modify IG's excel sample to download data by historical range? Currently the excel sample is only able to download by a set number of data points from the latest date. 

I am not very good with VBA, I tried (but it didn't work) to modify the VBA code in the excel sample:


For Public Function ("price") in IGApiRestClient:


Public Function prices(epic As String, resolution As String, numPoints As String) As Collection

    Call oXMLHTTP.Open("GET", IG_API_HOST + "/prices/" + epic + "/" + resolution + "/" + numPoints, False)


Public Function prices(epic As String, resolution As String, startDate As String, endDate As String) As Collection

    Call oXMLHTTP.Open("GET", IG_API_HOST + "/prices/" + epic + "/" + resolution + "/" + startDate + "/" + endDate, False)


For Private Sub priceHistoryButton_Click() in Sheet1:


Set prices = restClient.prices(epicTextBox.value, priceResolutionComboBox.value, numPointsTextBox.value)


Set prices = restClient.prices(epicTextBox.value, priceResolutionComboBox.value, Range("K2").value, Range("K3").value)


I tried to key in the dates (in "YYYY-MM-DD HH:MM:SS") in cells K2 & K3 but it doesn't work. Any ideas/help on how to make it work?

Share this post

Link to post

1 answer to this question

Recommended Posts

  • 0


Not sure if you ever got this working, but you could use an Excel Add-in that I have built that enables you to easily download historic data, either by specifying a date range or number of points:

IG Index Historical Data Download Excel

More details here: https://www.excelpricefeed.com/userguide/historic-data-download-ig-index

Hope this helps.


Edited by andysinclair

Share this post

Link to post

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

You are posting as a guest. If you have an account, please sign in.
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Member Statistics

    • Total Topics
    • Total Posts
    • Total Members
    Newest Member
    Joined 20/11/19 19:11
  • Posts

    • So US indices have been climbing higher (albeit a red day today). Trump needs the US stock market to blossom in order for him to say that it is a lot higher since he became US President.  So what happened to the wall he was going to build? This was one of the key pledges he was making during his election campaign. It is no different to Boris Johnson saying with confidence that the UK would leave the EU on 31st October 2019! There were even messages on the M1 (Motorway) in the UK inferring this.  POLITICAL SPIN and Marketing Wizardry at its best. Trump has focussed the media attention on the US-China Trade War to deflect from his broken promise so far.  Traders need to understand the fundamentals and how they work when it comes to politics and economics when trading not just US and UK indices but all major indices around the world. There were lots of stock market predictions being made about how it was going to see a big fall but this has not materialised. It may well do in 2020, I don't know, but never fight the trend until the bend at the end. Even then the bend can turn back again and continue which is what we have been witnessing with the US indices as politicians control the news flow, dictate the narrative and plot the course for stock markets.  
    • One should treat trading like a business. In any successful business there would be a business plan. So for any successful trader there must be a trading plan.  There is a cheesy line but very true which is something like - failing to plan is a plan to fail.  Some of the best and most successful traders in the world will have and are more likely to have a trading plan. I would be surprised if they do not.  This trading plan can be an evolving plan which can be changed and adapted as situations change, knowledge improves, experience is gained, etc.