Jump to content

Workflow to get the latest BTC price in GBP


Recommended Posts

I'm new to Alfred workflows, json and python, so I'm more or less starting from scratch on this one!

 

I want to create a workflow that will get the latest bitcoin price in GBP, using the bitcoinaverage API (https://api.bitcoinaverage.com/ticker/global/GBP/).

 

That gives me a json file that looks something like this:

 

{
"24h_avg": 473.32,
"ask": 498.26,
"bid": 497.76,
"last": 498.02,
"timestamp": "Mon, 13 Jun 2016 14:26:07 -0000",
"volume_btc": 1703.35,
"volume_percent": 0.7
}

 

I would like to have a simple python script that will query the API, extract the "bid" value and then give it back to me in Alfred. I'm trying to base my script off the Pinboard tutorial but it's not working so far. Can anyone help?

Link to comment

You could remove almost all the imports but the code looks otherwise spot-on.

If you want to share the workflow, it might be a better idea to export it and put it on Packal rather than just post the script here. That way, if someone wants to use it, they can just download and install it instead of having to create their own workflow to put the script in, install Alfred-Workflow etc.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...