Animated FTC price indicator
-
Small update.
I’ve tested the indicator in Firefox and a couple WebkitGTK browsers (Midori and epiphany). In the latter it does not seem to display properly. I believe it is a font related issue. This is how it shows up in the different browsers:
Do you know a generic font which is visualized the same on every browser?
Still want to listen for a method to link to an off-site JSON. Especially, if a feathercoin.com admin reads this, can you provide a JSONP callback in the api url??
-
Hey that looks awesome! Keep it up ahy!
I clicked the link and in my firefox it looks really good. The animation is working great too!
-
Calem,
glad you like it! I just parked the thing for a while as I’m about to sail in stormy seas for a month or so but I’m planning to get the code on GIT when I’ll be able to reach somebody to tell me how to get the values directly from the feathercoin API. Maybe Bushstar? I need time for doing that so I’m just waiting to be completely free. For now it is relying on a script running on my server for keeping the values up to date.
BTW, if you have a web page, just grab the code (the button, not the javascript) and paste it! Let’s try to spread it!
-
Hi voingiappone,
basically you can access the api through web links.
A good description is here:
https://www.feathercoin.com/feathercoin-api/
I hope, that helps
-
Wellenreiter,
thanks for the link. I found that before and I was trying to make a call like this:var data; $.getJSON("URL-TO-API",function(json){ data = JSON.parse(json); alert(data);
However I was only receiving blank data, i.e. alert(data) was empty. I substituted the API url with a json file I put on my old website and I ended up with a “same-origin policy” problem. That web server provider does not let me access the json as a server side call.
Now the question is still: how do I retrieve the API response in form of a json object without getting either the empty variable or the same-origin errors?
I know I lack the basic knowledge here but there should be some way to tell the script something like:Dude, do you see this API? Well, aske her the FTC price in $
than write the answer in your notebook in json format and bring
it back here. I’ll give you some candy if you do that fine!Also tried asking on stackexchange but to no avail. Is it this really that difficult? :-[
-
I’ve only done this in Python, as thats all I know (and I don’t know much about that)
I use a requests.get call to the API to return the value I’m looking for in this case it’s the current value of 1 FTC to enable the conversion between pounds later in the program, I also do it using payloads as that works out for me better as I’m doing a couple more calls into the API later as the transaction moves on so can just substitute the “payload” data
import requests #returns current feathercoin value def toFTC(v,c='gbp',j='0'): payload = {'output': c, 'amount': v, 'json': j} to_ftc_url = 'http://api.feathercoin.com/' ftotal=-1 try: r = requests.get(to_ftc_url, params=payload) print(r.url) if r.status_code == 200: ftotal = round(float(r.text) ,6) except: pass return ftotal print toFTC(1)
If you run the above the output printed to the screen is the current FTC value in GBP, rounded to 6 decimal places. If you wanted to do it the other war around i.e. how many FTC to the FIAT the api call needs to look something like this
http://api.feathercoin.com/?output=ftcgbp&amount=1&json=1
where you can specify the FIAT currency as follows
?output=ftcaud (Australia) ?output=ftceur (Euro) ?output=ftcgbp (Great Britian) ?output=ftcnzd (New Zealand) ?output=ftcusd (United States)
Hope this gives you a pointer in the right direction
-
uncle_muddy, that’s interesting! It looks like you’re doing the very same thing I tried in JS but using Python… I didn’t have time to try it but being you the author I guess it works… ;) so, why is JS not able to do the same thing?
Well, I could use Python and forget about JS but the only problem is that to use it, the proper Firebase module have to be installed on the server. This would be totally fine if it wasn’t for the fact I would like to have a small script to be easily embeddable in blogs, CMSs etc… the original purpose could easily get lost if the end user has to install stuff on the server…
I will have to dig the Firebase documentation more… or to try harder on the JS side.
Thx for the nice script though!
-
I’m looking at this project since you posted it, and keep having the urge to fine tune that css and graphics of yours, but never get enough time lately…maybe over the weekend…maybe…
Dude, you’re more than welcome! Feel free to fiddle with the code.
I think I’m going to be a little bit less busy starting from next week Friday… If it helps I can set up a GIT repo so we can collaborate!
It’s nice to see somebody eager to jump on board this dull “project” :D
-
I think the project is worth finishing ahy.
It’s a lovely little ticker and I think it would be great to have for anyone to chuck into their site etc.
-
Here it is:
Woa, man that’s slick! It’s a properly formatted css… however this is not rendered well in midori too… well, nobody will care I think.
Now, I will break free from my obliges this week so I will try to do a proper git project and share the info with those who want to participate. I will also try to fix the js / python thing.
As Calem said, it would be nice to have a small copy-pasteable widget to be put on websites! And if the trincket would be able to auto-update firebase data it would be awesome!Thank you so much for the contribution!
-
That would be cool to also have as a widget on my phone.
-
I use the Litecoin Widget on android which is really good and can show BTC FTC LTC PXC and lots more in your local currency. :)
-
That would be cool to also have as a widget on my phone.
Calem, that could be the next step. I don’t have any idea of how to code for mobile apps but once the firebase is there, it will be easy for those with minimum skills!
As you may have noticed I’m stalled now: I have to write a PhD thesis in one month… and I have just been notified of the deadline. I’m freaking out, so I had to park this. Will get back on it as soon as I can.
-
Thats ok, good luck with your thesis!
-
I’ve only done this in Python, as thats all I know (and I don’t know much about that)
I use a requests.get call to the API to return the value I’m looking for in this case it’s the current value of 1 FTC to enable the conversion between pounds later in the program, I also do it using payloads as that works out for me better as I’m doing a couple more calls into the API later as the transaction moves on so can just substitute the “payload” data
import requests #returns current feathercoin value def toFTC(v,c='gbp',j='0'): payload = {'output': c, 'amount': v, 'json': j} to_ftc_url = 'http://api.feathercoin.com/' ftotal=-1 try: r = requests.get(to_ftc_url, params=payload) print(r.url) if r.status_code == 200: ftotal = round(float(r.text) ,6) except: pass return ftotal print toFTC(1)
If you run the above the output printed to the screen is the current FTC value in GBP, rounded to 6 decimal places. If you wanted to do it the other war around i.e. how many FTC to the FIAT the api call needs to look something like this
http://api.feathercoin.com/?output=ftcgbp&amount=1&json=1
where you can specify the FIAT currency as follows
?output=ftcaud (Australia) ?output=ftceur (Euro) ?output=ftcgbp (Great Britian) ?output=ftcnzd (New Zealand) ?output=ftcusd (United States)
Hope this gives you a pointer in the right direction
Thank you very much for this.
I’ve been struggling to do just this all night (I am a cut and paste coder) and only barely know how to install a library on Python let alone do any useful coding
As I still have a spare Raspberry Pi and several Arduinos lying around and was thinking of making an ‘old school’ analogue meter display showing current price of FTC and high and low prices over the last week.
Something similar to this
http://makezine.com/projects/data-dial-dashboard/
No real value in the project other than its something to do.