-
-
Save rendezfoo/a47870ad04e0c43cd80e3567666ae8c6 to your computer and use it in GitHub Desktop.
BTC ticker on your Apple TouchBar
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
on replace_chars(this_text, search_string, replacement_string) | |
if this_text contains the search_string then | |
set AppleScript's text item delimiters to the search_string | |
set the item_list to every text item of this_text | |
set AppleScript's text item delimiters to the replacement_string | |
set this_text to the item_list as string | |
set AppleScript's text item delimiters to "" | |
end if | |
return this_text | |
end replace_chars | |
set stockValue to do shell script "curl -s 'https://api.coinmarketcap.com/v1/ticker/bitcoin/' | grep 'price_usd'" | |
set stockValue to replace_chars(stockValue, " \"price_usd\": \"", "") | |
set stockValue to replace_chars(stockValue, "\",", "") | |
return "" & "$" & stockValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you.
How can I change the Currency from USD to BTC?
For example ETH/BTC?