Monitor Bitcoin Price

Get help with using AutoHotkey and its commands and hotkeys
holahapi
Posts: 40
Joined: 09 Nov 2016, 21:52

Monitor Bitcoin Price

15 Dec 2017, 00:29

Is there a way to get the Bitcoin price in AHK

I find some API, but dont have any clue to do that

https://www.coindesk.com/api/
https://blockchain.info/api/exchange_rates_api
User avatar
noname
Posts: 459
Joined: 19 Nov 2013, 09:15

Re: Monitor Bitcoin Price

15 Dec 2017, 05:33

Interesting to have a real graphic update onscreen , i have no clue how it varies in a day but i will check it out today :)

example gives the response and extract the value:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

imustbeamoron
Posts: 16
Joined: 18 Aug 2016, 22:56

Re: Monitor Bitcoin Price

15 Dec 2017, 21:11

another way.. download the json, convert to ahk object.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

holahapi
Posts: 40
Joined: 09 Nov 2016, 21:52

Re: Monitor Bitcoin Price

16 Dec 2017, 22:19

thank you noname and imustbeamoron

The first one works fine
and the second one get some error
Line 22 SC := ComObjCreate("ScriptControl") <<<<<<<<<<Class not registered


In addition
how can I extract the JPY price from the follow ? https://api.coindesk.com/v1/bpi/currentprice/JPY.json
and is there a way create error level when not able download the information?
I was trying to understand "U)float.*(\d+.*)\}" , does this manual have all the descriptions? https://autohotkey.com/docs/misc/RegEx-QuickRef.htm


noname wrote:Interesting to have a real graphic update onscreen

The real time price is good enough for my purpose :D
 
teadrinker
Posts: 344
Joined: 29 Mar 2015, 09:41
Contact:

Re: Monitor Bitcoin Price

17 Dec 2017, 00:16

Hi, holahapi
COM object "ScriptControl" works on 32 bit processes only. It won't work if you use 64 bit AHK. But there are some another ways to use JScript for parsing JSON. I used one of them in my class to get and convert JSON string to AHK object.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
noname
Posts: 459
Joined: 19 Nov 2013, 09:15

Re: Monitor Bitcoin Price

17 Dec 2017, 12:26

Image

teadrinker 's code using json parser is safer (and professional...) as syntax/format can change and regex could fail.

Anyway here is regex adapted for the japanese yen values and a check if something goes wrong, i tried to make some errors and found keywords in the response that can be used to detect it ( like "Sorry" :D ).

You can find regex info in the link you mentioned : https://autohotkey.com/docs/misc/RegEx-QuickRef.htm
You also have an online tester to try in real time : https://regex101.com/

I made a" real time update" to follow the bitcoin movement and gain/loss (update every minute) and as you can see i would be wealthy if i bought some yesterday!!

code with regex for yen:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

holahapi
Posts: 40
Joined: 09 Nov 2016, 21:52

Re: Monitor Bitcoin Price

18 Dec 2017, 04:02

thank you teadrinker and noname

The regex tester is very helpful for me to learn about it.

It is surprise that the Jason class can get the data directly, I will use it for this one.

:D
holahapi
Posts: 40
Joined: 09 Nov 2016, 21:52

Re: Monitor Bitcoin Price

19 Dec 2017, 10:01

teadrinker wrote:Hi, holahapi
COM object "ScriptControl" works on 32 bit processes only. It won't work if you use 64 bit AHK. But there are some another ways to use JScript for parsing JSON. I used one of them in my class to get and convert JSON string to AHK object.


Is it possible to get a error catch for the GetFromUrl, It stop my AHK when there are no internet connection.
Error message as follow

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus






I am using other way to checking Internet from the reference (https://autohotkey.com/board/topic/2145 ... onnection/)
But I do not think it is the best solution.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

teadrinker
Posts: 344
Joined: 29 Mar 2015, 09:41
Contact:

Re: Monitor Bitcoin Price

19 Dec 2017, 14:39

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], CH HAN and 71 guests