Jump to content

Tomegnon

Community Member
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Tomegnon

  1. Hi, thank you for your response

    I've inserted the version it doesn't seem to help. The response include only the first market in the watchlist and only few fields for that market. The API Companion works fine though, I see all the data. I can't see why...

    Public Function watchlistMarkets(watchlistIdentifier As String) As Collection

        Dim A_instrumentName As String
        Dim A_expiry As String
        Dim A_epic As String
        Dim A_marketStatus As String
        Dim A_lotSize As String
        Dim A_high As String
        Dim A_low As String
        Dim A_percentageChange As String
        Dim A_netChange As String
        Dim A_bid As String
        Dim A_offer As String
        Dim A_updateTime As String
        Dim A_updateTimeUTC As String
        Dim A_delayTime As String
        Dim A_streamingPricesAvailable As String
        Dim A_scalingFactor As String
        
        Call oXMLHTTP.Open("GET", IG_API_HOST + "/watchlists/" + watchlistIdentifier, False)
        Call oXMLHTTP.SetRequestHeader("X-SECURITY-TOKEN", m_accountToken)
        Call oXMLHTTP.SetRequestHeader("CST", m_clientToken)
        Call oXMLHTTP.SetRequestHeader("Version", "1")
        Call oXMLHTTP.SetRequestHeader("X-IG-API-KEY", m_apiKey)
        Call oXMLHTTP.SetRequestHeader("Content-Type", "application/json; charset=utf-8")
        Call oXMLHTTP.SetRequestHeader("Accept", "application/json; charset=utf-8")
        Call oXMLHTTP.send
        If oXMLHTTP.Status = 200 Then
            Dim data As Dictionary
            Dim market As Dictionary
            Set data = JSON.parse(oXMLHTTP.responseText)
            Set watchlistMarkets = data.Item("markets")
            For Each market In watchlistMarkets
                A_instrumentName = market.Item("instrumentName")
                A_expiry = market.Item("expiry")
                A_epic = market.Item("epic")
                A_marketStatus = market.Item("marketStatus")
                A_lotSize = market.Item("lotSize")
                A_high = market.Item("high")
                A_low = market.Item("low")
                A_percentageChange = market.Item("percentageChange")
                A_netChange = market.Item("netChange")
                A_bid = market.Item("bid")
                A_offer = market.Item("offer")
                A_updateTime = market.Item("updateTime")
                A_updateTimeUTC = market.Item("updateTimeUTC")
                A_delayTime = market.Item("delayTime")
                A_streamingPricesAvailable = market.Item("streamingPricesAvailable")
                A_scalingFactor = market.Item("scalingFactor")
            Next
        Else
            Set watchlistMarkets = Nothing
        End If
            
        Exit Function

    End Function

            
        Exit Function

    End Function

     

    API.thumb.jpg.0105708196e3c10a60f7c432e5c6e3c3.jpg

     

  2. Hi

    I am receiving only incomplete information from my API request. I use VBA and the request is based on the sample. I only get the first market of the watchlist and only few fields such as "expiry" and "epic", but no "bid" or "ask" for instance. If anyone has an idea?

    Thanks

    Public Function watchlistMarkets(watchlistIdentifier As String) As Collection
     

       Call oXMLHTTP.Open("GET", IG_API_HOST + "/watchlists/" + watchlistIdentifier, False)
        Call oXMLHTTP.SetRequestHeader("X-SECURITY-TOKEN", m_accountToken)
        Call oXMLHTTP.SetRequestHeader("CST", m_clientToken)
        Call oXMLHTTP.SetRequestHeader("X-IG-API-KEY", m_apiKey)
        Call oXMLHTTP.SetRequestHeader("Content-Type", "application/json; charset=utf-8")
        Call oXMLHTTP.SetRequestHeader("Accept", "application/json; charset=utf-8")
        Call oXMLHTTP.send
        If oXMLHTTP.Status = 200 Then
            Dim data As Dictionary
            Set data = JSON.parse(oXMLHTTP.responseText)
            Set watchlistMarkets = data.Item("markets")
        Else
            Set watchlistMarkets = Nothing
        End If
              

    End Function

     

×
×
  • Create New...
us