Created
February 14, 2018 08:27
-
-
Save parthi2929/22dfe4463d374ad77ed877c286e48cc1 to your computer and use it in GitHub Desktop.
For me, I am getting a strange error which I could not resolve. Below is my code. (check problem area). Error screenshot: http://i.cubeupload.com/mRjQt5.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub Refresh_Click() | |
Dim http As Object, JSON As Object, i As Integer | |
Dim posBTC As Integer, posETH As Integer, posINR As Integer, posUSDT As Integer | |
Dim baseCol As Integer, buyCol As Integer, sellCol As Integer, targetCol As Integer, valueCol As Integer | |
Dim JSON1 As Dictionary | |
Set http = CreateObject("MSXML2.XMLHTTP") | |
'Coindelta | |
http.Open "GET", "https://coindelta.com/api/v1/public/getticker/", False | |
http.Send | |
Set JSON = JsonConverter.ParseJson(http.responseText) | |
i = 3 | |
For Each Item In JSON | |
posINR = InStr(Item("MarketName"), "inr") | |
If (posINR > 0) Then | |
ActiveSheet.Cells(i, 1).Value = UCase(Split(Item("MarketName"), "-")(0)) | |
ActiveSheet.Cells(i, 2).Value = Item("Ask") | |
ActiveSheet.Cells(i, 3).Value = Item("Bid") | |
i = i + 1 | |
End If | |
Next | |
Application.StatusBar = "CoinDelta Data Complete" | |
'BuyUCoin | |
http.Open "GET", "https://www.buyucoin.com/api/v1/crypto/", False | |
http.Send | |
Set JSON1 = JsonConverter.ParseJson(http.responseText) | |
i = 3 | |
baseCol = 5 | |
buyCol = 6 | |
sellCol = 7 | |
'MsgBox JSON1("BuyUcoin_data")(1)("ark_buy_price") | |
'MsgBox JSON1("BuyUcoin_data")(1).Count | |
Dim coin As String, action As String | |
Dim LArray() As String | |
For Each Item In JSON1("BuyUcoin_data")(1) | |
LArray = Split(Item, "_") | |
coin = UCase(LArray(0)) | |
action = LArray(1) | |
ActiveSheet.Cells(i, baseCol).Value = coin | |
'ActiveSheet.Cells(i, 9).Value = action | |
ActiveSheet.Cells(i, buyCol).Value = JSON1("BuyUcoin_data")(1)(Item) | |
i = i + 1 | |
Next | |
Dim length As Integer | |
length = i | |
For i = 3 To length | |
ActiveSheet.Cells(i, sellCol).Value = ActiveSheet.Cells(i + 1, buyCol).Value | |
i = i + 1 | |
Next i | |
Dim MySel As Range | |
For i = 4 To length | |
If MySel Is Nothing Then | |
Set MySel = ActiveSheet.Range(ActiveSheet.Cells(i, baseCol), ActiveSheet.Cells(i, sellCol)) | |
Else | |
Set MySel = Union(MySel, ActiveSheet.Range(ActiveSheet.Cells(i, baseCol), ActiveSheet.Cells(i, sellCol))) | |
End If | |
i = i + 1 | |
Next i | |
If Not MySel Is Nothing Then | |
MySel.Delete | |
End If | |
Application.StatusBar = "BuyUCoin Data Complete" | |
'BitBNS | |
http.Open "GET", "https://bitbns.com/order/getTickerAll", False | |
'BELOW IS THE PROBLEM AREA | |
Set JSON1 = JsonConverter.ParseJson(http.responseText) | |
ActiveSheet.Cells(3, 9).Value = JSON1(1)("BTC") | |
'PROBLEM AREA | |
i = 1 | |
' For Each Item In JSON | |
' ActiveSheet.Cells(i + 2, 9).Value = "test" + JSON(i)(Item)("sellPrice") | |
' i = i + 1 | |
' Next | |
Application.StatusBar = "BitBNS Data Complete" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is in lines 72 and 73