anyone help me please, how to convert this https://indodax.com/api/tickers into a message dialog with format like this:
BTC-IDR
Last: Rp. 107,082,000
High: Rp. 112,503,000
Low: Rp. 95,880,000
TEN-IDR
Last: Rp. 316
High: Rp. 346
Low: Rp. 292
bla bla bla also another coin
.
im so blind in this
How to convert this
Moderator: Martin
-
- Posts: 18
- Joined: 08 Nov 2018 15:10
- Contact:
How to convert this
From: Redmi 5 Plus (Vince)
-
- Posts: 179
- Joined: 16 Oct 2019 17:38
Re: How to convert this
Hello
This should get you going. You can see the structure and amend as required.
http://automagic4android.com/flow.php?i ... cf57e0c20f
Hope this helps
Micky
This should get you going. You can see the structure and amend as required.
http://automagic4android.com/flow.php?i ... cf57e0c20f
Hope this helps
Micky
Crude but it works.
-
- Posts: 18
- Joined: 08 Nov 2018 15:10
- Contact:
Re: How to convert this
thank you very much i get it
[edited]
but how to add map with less script, this script just for 2 Coin
i want to add more coin but so many script
[edited]
but how to add map with less script, this script just for 2 Coin
i want to add more coin but so many script
- Attachments
-
- flow_Refresher.xml
- flow file
- (13.11 KiB) Downloaded 816 times
-
- adding into map manually
- Screenshot_Automagic_Premium_20200321-101013.png (247.71 KiB) Viewed 17564 times
From: Redmi 5 Plus (Vince)
-
- Posts: 18
- Joined: 08 Nov 2018 15:10
- Contact:
Re: How to convert this
can you help me to make it more less script to adding new map?Micky Micky wrote: ↑20 Mar 2020 20:36Hello
This should get you going. You can see the structure and amend as required.
http://automagic4android.com/flow.php?i ... cf57e0c20f
Hope this helps
Micky
From: Redmi 5 Plus (Vince)
Re: How to convert this
@gilanxcheetz : Use loop. If you dig on the js variable in the debug dialog, change value, you can tap the "tickers" and see all the coins map. Loop upon this and store in other list or you can directly create the text to show. I prefer to create a temporary list or map to store the converstion first, because you can do another preprocessing before showing it, or doing some filter.
As you can see above, first I create newmap tickers. Loop upon the js and store all the needed info into this newMap.
Then loop against the new map and put the info on the {show}.
Using temporary map, we can filter out for only some coins. As shown in the favourite part.
You can also use the remove, to show every coin except the ones you don't need. You can also do some calculation and don't include the coin which have value lower than 0. But I will leave that to you first.
Code: Select all
js = fromJSON(response);
t = js["tickers"];
tickers = newMap();
for(i in getMapKeys(t))
tickers[i] = newList(t[i]["last"], t[i]["high"], t[i]["low"]);
//tickers contains map | coin name : Last, High, Low
show = "";
for(i in getMapKeys(tickers))
show = show +
"{toUpperCase(i)}\n" +
"Last : Rp. {tickers[i][0],numberformat,#,##0.##}\n" +
"High : Rp. {tickers[i][1],numberformat,#,##0.#}\n" +
"Low : Rp. {tickers[i][2],numberformat,#,##0.##}\n\n";
//this part use the favourite, save the keyword in the fav list
fav = newList("btc_idr", "ten_idr");
showfav = "";
for(i in fav)
showfav = showfav +
"{toUpperCase(i)}\n" +
"Last : Rp. {tickers[i][0],numberformat,#,##0.##}\n" +
"High : Rp. {tickers[i][1],numberformat,#,##0.#}\n" +
"Low : Rp. {tickers[i][2],numberformat,#,##0.##}\n\n";
Then loop against the new map and put the info on the {show}.
Using temporary map, we can filter out for only some coins. As shown in the favourite part.
You can also use the remove, to show every coin except the ones you don't need. You can also do some calculation and don't include the coin which have value lower than 0. But I will leave that to you first.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 18
- Joined: 08 Nov 2018 15:10
- Contact:
Re: How to convert this
wow.. awesomeDesmanto wrote: ↑21 Mar 2020 16:30@gilanxcheetz : Use loop. If you dig on the js variable in the debug dialog, change value, you can tap the "tickers" and see all the coins map. Loop upon this and store in other list or you can directly create the text to show. I prefer to create a temporary list or map to store the converstion first, because you can do another preprocessing before showing it, or doing some filter.
Using temporary map, we can filter out for only some coins. As shown in the favourite part.
You can also use the remove, to show every coin except the ones you don't need. You can also do some calculation and don't include the coin which have value lower than 0. But I will leave that to you first.
thank youu !1!1!
i'll try to adding new fetature, CRUD on 'favorites' coin
mkasih bnyak :v
From: Redmi 5 Plus (Vince)