Hi Im trying to create an alert for btc price using binance api, and in order to parse the price of btc i don't need to create a user key api.
I checked on the forum for similar topics and I found this one
and modified a bit the code to be used on b4x pages
but i'm getting few errors, eventho the op in the other topic said it worked..
what is exactly the issue? thanks
I checked on the forum for similar topics and I found this one
and modified a bit the code to be used on b4x pages
B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Dim t As Timer
t.Initialize("t",1000)
t.Enabled=True
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub t_tick
Dim j As HttpJob
j.Download("https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT")
Wait For (h) JobDone(h As HttpJob)
Dim parser As JSONParser
If j.Success Then
parser.Initialize(j.GetString)
Dim Root As Map = parser.NextObject
Dim USDT As Double = Root.Get("price")
Log("USDT= " & USDT)
End If
j.Release
End Sub
but i'm getting few errors, eventho the op in the other topic said it worked..
B4X:
B4XMainPage - 40: Unknown member: get
B4XMainPage - 39: Current declaration does not match previous one.<br />Previous: {Type=B4XView,Rank=0, RemoteObject=True}<br />Current: {Type=Map,Rank=0, RemoteObject=True}
B4XMainPage - 13: This sub should only be used for variables declaration or assignments of primitive values. (warning #29)
B4XMainPage - 34: Undeclared variable 'h'. (warning #8)
B4XMainPage - 41: Undeclared variable 'usdt'. (warning #8)
B4XMainPage - 32: Variable 'j' was not initialized. (warning #11)
what is exactly the issue? thanks