• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Pulling exchange pricing?

TheDashGuy

Well-known member
Anyone feel like sending me in the right direction to understanding how to pull a price off an exchange, I know a little programming, a decent amount of JS, and am very good at the easy stuff like html/css/graphics but I have yet to tackle this whole using an API within a certain language to pull simple shit like prices.

Any pointers? I'll do the work to figure it out, I just don't want to run around finding all the pieces to fit together, if you know what I mean.

Thanks everyone! You all are very helpful.
 
Actually would be interested in this. I can do python, css, Stata, SQL and a couple of other languages, but I never got good explanation for what the hell is an API. Is it simple accessing the database behind a paywall or like a crawling program?
 
A (web-) API is more or less a web-page without all that fancy UI-stuff, just plain data.

These days the most commonly used format is the JSON format.

Bash shell-script example to get the US-Dollar exchange rate of Dash from www.cryptonator:

curl https://www.cryptonator.com/api/ticker/dash-usd > DASH-USD.json

The resulting file "DASH-USD.json" looks like this:
Code:
{"ticker":{"base":"DASH","target":"USD","price":"2.61265436","volume":"243.95007369","change":"-0.00004587"},"timestamp":1450430493,"success":true,"error":""}

As you can see, the exchange rate is labeled "price", and its value is "2.61265436".
You can either parse this yourself with the different Unix tools (grep, awk, jq, ... check Wikipedia for details on those) or read it with a JSON-enabled program of your choice.
 
Last edited by a moderator:
I hacked something out the other day in Ruby. The code to pull Dash/BTC from Poloniex and to pull BTC/USD price from Bitstamp is here:

https://github.com/nmarley/dash-usd-price/blob/master/lib/wavg/www.rb

Have a look through that repo if you want to get some ideas for how to use it, but that file is the only one pulling the exchange data. It uses the JSON APIs for both exchanges.

Generally you'll want to look for the exchanges' "public ticker" APIs, which just about anyone can query. Diving into the "trading" APIs is a little more complex, because you'll have to create accounts and authenticate. Public ticker should be available without doing that.
 
Someone want to throw a up a quick link for an easy intro to using an API, I think my problem is i'm just not understanding a piece of this setup, because I have no idea where this code would go..... but then again maybe I'm just not seeing whats right in front of my face...
 
Someone want to throw a up a quick link for an easy intro to using an API, I think my problem is i'm just not understanding a piece of this setup, because I have no idea where this code would go..... but then again maybe I'm just not seeing whats right in front of my face...

Can you be more specific? What exactly are you trying to do? Exactly? I know it seems like it shouldn't matter, but the details really do. The API code just grabs data. You use data wherever you want, (display it on a web page, or stick it into a database, etc.) but it's hard to help if we don't know what you are trying to accomplish.
 
Back
Top