Excel Price Feed includes several functions which are specially designed to be used from VBA. They all begin with EPF.IG.VBA and can be used for market analysis, position analysis etc.
Click on a category below to view the formulas:
EPF.IG.VBA.Mid
EPF.IG.VBA.Bid
EPF.IG.VBA.Offer
EPF.IG.VBA.High
EPF.IG.VBA.Low
EPF.IG.VBA.Change
EPF.IG.VBA.ChangePercent
EPF.IG.VBA.MarketID
EPF.IG.VBA.TradeableStatus
EPF.IG.VBA.MarginFactor
EPF.IG.VBA.MinimumDealSize
EPF.IG.VBA.MinimumDealSizeUnits
EPF.IG.VBA.MinimumStopOrLimitDistance
EPF.IG.VBA.MinimumStopOrLimitDistanceUnits
EPF.IG.VBA.MaximumStopOrLimitDistance
EPF.IG.VBA.MaximumStopOrLimitDistanceUnits
Returns the current value for the specified epic code.
returnValue = Application.Run(functionName, epicCode)
All of these functions have the one single parameter:
Parameter | Description |
---|---|
epicCode | The IG Index epic code for the instrument |
1. Return the live mid price of EURUSD spot:
Dim midPrice As Variant
midPrice = Application.Run("EPF.IG.VBA.Mid", "CS.D.EURUSD.TODAY.IP")
2. Return the live bid price of Apple stock:
Dim bidPrice As Variant
bidPrice = Application.Run("EPF.IG.VBA.Bid", "UA.D.AAPL.DAILY.IP")
3. Return the minimum deal size for GBPUSD:
Dim bidPrice As Variant
bidPrice = Application.Run("EPF.IG.VBA.MinimumDealSize", "CS.D.GBPUSD.TODAY.IP")
EPF.IG.VBA.StartStreaming
EPF.IG.VBA.StopStreaming
These functions control streaming data from IG, they take no parameters, and if successful return an empty string otherwise an error message:
returnValue = Application.Run("EPF.IG.VBA.StartStreaming")
returnValue = Application.Run("EPF.IG.VBA.StopStreaming")
EPF.IG.VBA.SentimentLong
EPF.IG.VBA.SentimentShort
Returns the current IG Index client sentiment (long or short) for the specified the market id.
longSentiment = Application.Run("EPF.IG.VBA.SentimentLong", marketID)
shortSentiment = Application.Run("EPF.IG.VBA.SentimentShort", marketID)
These functions all have the one single parameter:
Parameter | Description |
---|---|
marketID | The IG Index market id for the instrument |
1. Return the current short sentiment value of EURUSD spot:
Dim shortSentiment As Variant
shortSentiment = Application.Run("EPF.IG.VBA.SentimentShort", "EURUSD")
2. Return the current long sentiment value of Apple stock:
Dim longSentiment As Variant
longSentiment = Application.Run("EPF.IG.VBA.SentimentLong", "AAPL")
EPF.IG.VBA.SentimentHistoricDailyLookback
EPF.IG.VBA.SentimentHistoricHourlyLookback
Returns historical IG Index client sentiment for the specified epic and number of points.
historicalSentiment = Application.Run("EPF.IG.VBA.SentimentHistoricDailyLookback", epic, numDataPoints, order, includeHeaders)
These two functions have 4 parameters:
Parameter | Description |
---|---|
epic | The IG Index epic code for the instrument |
numDataPoints | The requested number of points to return (lookback period), either number of hours or days depending on the function |
order | The order to return the data, either "Desc" so latest first otherwise "Asc" which is for oldest first |
includeHeaders | Whether to include the column headers in the returned array, either 1 or headers or 0 for no headers |
The variant array returned has the following "columns":
Array Index | Description |
---|---|
1 | The date/time |
2 | The IG Index epic code eg: CS.D.EURUSD.TODAY.IP |
3 | The percentage of clients long at the close of the period |
4 | The percentage of clients short at the close of the period |
5 | The percentage of clients long at the open of the period |
6 | The percentage of clients short at the open of the period |
7 | The high percentage of clients long during the period |
8 | The high percentage of clients short during the period |
9 | The low percentage of clients long during the period |
9 | The low percentage of clients short during the period |
1. Return the historical daily client sentiment of the S&P500 for the past 10 days (in descending order with column headers):
Dim historicalSentiment As Variant
historicalSentiment = Application.Run("EPF.IG.VBA.SentimentHistoricDailyLookback", "IX.D.SPTRD.DAILY.IP", 10, "Desc", 1)
2. Return the historical hourly client sentiment of bitcoin for the past 24 hours (in ascending order with column headers:
Dim historicalSentiment As Variant
historicalSentiment = Application.Run("EPF.IG.VBA.SentimentHistoricHourlyLookback", "CS.D.BITCOIN.TODAY.IP", 24, "Asc", 1)
EPF.IG.VBA.Positions
Retrieves all open positions.
returnValue = Application.Run("EPF.IG.VBA.Positions")
The EPF.IG.VBA.Positions function has no parameters and returns a VBA variant array containing current position information.
The structure of the array is:
Array Index | Description |
---|---|
1 | The IG Index epic code eg: CS.D.EURUSD.TODAY.IP |
2 | The instrument name |
3 | The position size |
4 | The opening level of the position |
5 | The current price of the instrument (bid or offer depending on long or short) |
6 | Stop Level |
7 | Limit Level |
8 | Profit/Loss |
9 | Deal ID |
10 | Expiry of the instrument |
11 | Instrument short name |