Android Tutorial ? [B4X] [XUI] [B4XPages] Simple B4A stock ticker code using JSON REST API - Newer developers

Hello to you all,
Here is a simple example on retrieving data from a REST API requested using the JSON Generator (you could also use http URL download), the same JSON library is also used to parse the received JSON data (2 JSON feeds). Once you receive the filtered JSON ticker data, displaying the results on xCharts is extremely simple to accomplish and shows 28 days worth of High and Low trading prices including the dates. The code in B4XMainPage is relatively simple to follow and works with B4A, B4i and also B4J, I've added comments where feasible to do so.

Please note that not all the symbol names will display company ticker data, this is part of the limitations for using the free ticker REST API.

CLICK HERE to register for FREE at Twelve Data to access their free stock ticker API.


NOTE: The zip file in the link below contains the Stock Ticker B4XPages project for B4A, B4i and also B4j.
>>> CLICK HERE <<< to download the B4XPages source code.

Libraries needed:



Android screenshots below:










Enjoy...
 
Last edited:

omo

Active Member
Licensed User
Longtime User
Thank you @ Peter Simpson for this your sample code. I registered with twelvedata and obtained my api key to test and see if I can adapt it to predict cryptocurrency instead of stock in your sample. However, in your stock sample, company combobox couldn't get populated even after adding my api key which crashes the app.

I have tried these links below directly from browser which return cryptocurrency data, however I want to see if I can adapt your stock sample to do that but company combo box is not populated which hangs and crashes the app. Please, can somebody that got that sample worked put me in the right track or adapt it to cryptocurrency for me?
[URL ="true"][URL https://api.twelvedata.com/time_series?symbol=ETH/BTC&interval=1min&apikey=my[/URL] API key here

15&end_date=2021-11-17&apikey=my API here

15&end_date=2021-11-16&apikey=my API here
 
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
to test and see if I can adapt it to predict cryptocurrency instead of stock in your sample.
Hello @omo
The example above was specifically created as a simple stock example. You should start with just a basic extraction of the api data that you need and just try to populate the combobox without worrying about any other data, you should start a new blank B4XPages project for you. Once you have got the combobox populated, you should find the rest relatively easy to incorporate.

If need be you can PM me with your key and I'll test it at my end.

BTW this example was just a quick example, using B4X there are plenty of other ways to get these exact same results.
 

omo

Active Member
Licensed User
Longtime User
Thank you @ Peter Simpson for your fast response, I will PM you with my key and where I need clarification in your link.
Regards
 

omo

Active Member
Licensed User
Longtime User
Hello @ Peter Simpson, it will not be fair if I don't remember to say thank you for finding out of your busy schedule to help out. I really appreciate
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…