Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: DeathAndTaxes on January 01, 2013, 09:14:14 PM



Title: API to get price of a silver (or other PM) in BTC?
Post by: DeathAndTaxes on January 01, 2013, 09:14:14 PM
I doubt one exists for BTC but using any one of the numerous BTC spot price APIs combine with a spot price API for silver it shoudn't be too difficult.

The problem is that finding spot prices of silver or other precious metals (in any currency) has been difficult.  I found one commercial webservice but at $4,000 for per minute quotes I think I will pass.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: ShireSilver on January 01, 2013, 10:32:21 PM
You can screen-scrape to get silver prices. Get them from several places, toss out the obviously bad ones, and average the rest; if you want redundancy.

XE.com is $540/year and you can choose XAG for silver ounces, but that's still ridiculously expensive IMHO.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: DeathAndTaxes on January 02, 2013, 02:53:54 AM
You can screen-scrape to get silver prices. Get them from several places, toss out the obviously bad ones, and average the rest; if you want redundancy.

XE.com is $540/year and you can choose XAG for silver ounces, but that's still ridiculously expensive IMHO.

Yeah I was thinking about scraping or using a low cost brokerage account and scrapping from that.  I was kinda hoping an API existed.  I will take a look at XE.COM.  $540 is sill kinda excessive but it is a lot cheaper than $4K.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: gusti on January 02, 2013, 03:13:17 AM
daily prices ok ?
http://www.quandl.com/OFDP-Open-Financial-Data-Project/SILVER_5-LBMA-Silver-Price-London-Fixings


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: Eveofwar on January 02, 2013, 04:35:05 AM
I might be able to whip something up...PM inbound.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: World on January 02, 2013, 05:17:21 PM
here is nice website but I am not sure Ag and Au is there :-(
https://openexchangerates.org (https://openexchangerates.org)
try to share API with Gary https://bitcointalk.org/index.php?topic=43616.msg1366595#msg1366595 (https://bitcointalk.org/index.php?topic=43616.msg1366595#msg1366595)


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: DeathAndTaxes on January 02, 2013, 05:51:40 PM
here is nice website but I am not sure Ag and Au is there :-(
https://openexchangerates.org (https://openexchangerates.org)
try to share API with Gary https://bitcointalk.org/index.php?topic=43616.msg1366595#msg1366595 (https://bitcointalk.org/index.php?topic=43616.msg1366595#msg1366595)

Nice site.  Looks like they don't support PM yet but plan to "soon".  Hell if they ended up supporting PM and BTC well that would be pure WIN.

Quote
Do you provide rates for precious metals?

Not at the moment (as of November 2012) - this is a planned addition to both the free and paid API service, which should be available by early 2013.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: World on January 02, 2013, 06:10:29 PM
there is already support for BTC from
Quote
10th Dec 2012: Bitcoin (BTC) volume-weighted average rate now available for all Open Exchange Rates API users!


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: Eveofwar on January 03, 2013, 02:27:07 AM
I might be able to whip something up...PM inbound.

I've finished the application.  It currently pulls the last local USD trade from http://mtgox.com/api/1/BTCUSD/ticker (http://mtgox.com/api/1/BTCUSD/ticker) and then grabs the Kitco chart from http://www.kitco.com/images/live/silver.gif (http://www.kitco.com/images/live/silver.gif)...crops the image to only the "- Jan 02 Last 31.050" section then scales it up 10x (improved OCR detection/accuracy).  OCR functions are then performed on the image and just the price is grabbed from that line.  Once both values are available, the last MtGox USD price is divided by the last Silver USD spot price and rounded to the 4th decimal and then the result is output to file :)


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: sunnankar on January 03, 2013, 02:43:42 AM
daily prices ok ?

This .csv has the spot, 50dma and 200dma (http://www.runtogold.com/metalprices/data/summary.csv) updated every 10 minutes.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: DeathAndTaxes on January 04, 2013, 01:26:01 AM
daily prices ok ?

This .csv has the spot, 50dma and 200dma (http://www.runtogold.com/metalprices/data/summary.csv) updated every 10 minutes.

Awesome.  Just tracked it today and it was within 0.5% of so of realtime throughout the day.  We have a winner.  Hopefully https://openexchangerates.org adds PM to their lineup but this will work in the meantime.  If you have a donation address I'll throw you a tip.  It is very hard to find even 10 minute quotes on PM in text form.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: DeathAndTaxes on January 04, 2013, 01:27:20 AM
I might be able to whip something up...PM inbound.

I've finished the application.  It currently pulls the last local USD trade from http://mtgox.com/api/1/BTCUSD/ticker (http://mtgox.com/api/1/BTCUSD/ticker) and then grabs the Kitco chart from http://www.kitco.com/images/live/silver.gif (http://www.kitco.com/images/live/silver.gif)...crops the image to only the "- Jan 02 Last 31.050" section then scales it up 10x (improved OCR detection/accuracy).  OCR functions are then performed on the image and just the price is grabbed from that line.  Once both values are available, the last MtGox USD price is divided by the last Silver USD spot price and rounded to the 4th decimal and then the result is output to file :)

I hope you didn't spend too much time on it. I didn't ask anyone to write anything for me.   I am not found of screen captures because they are fragile and for the application I am looking at if it broke and reported incorrect data it could be costly.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: DeathAndTaxes on January 04, 2013, 01:28:50 AM
there is already support for BTC from
Quote
10th Dec 2012: Bitcoin (BTC) volume-weighted average rate now available for all Open Exchange Rates API users!


Good to know.  I didn't see it in their list of supported currencies but I am glad they added BTC.  Now if they add PM it would be perfect.  In the meantime the csv at runtogold will work.  Long term that site is a really nice resource.  I hope they keep expanding and improving it.  If you have a donation address I will send a tip your way.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: Eveofwar on January 04, 2013, 02:07:26 AM
I might be able to whip something up...PM inbound.

I've finished the application.  It currently pulls the last local USD trade from http://mtgox.com/api/1/BTCUSD/ticker (http://mtgox.com/api/1/BTCUSD/ticker) and then grabs the Kitco chart from http://www.kitco.com/images/live/silver.gif (http://www.kitco.com/images/live/silver.gif)...crops the image to only the "- Jan 02 Last 31.050" section then scales it up 10x (improved OCR detection/accuracy).  OCR functions are then performed on the image and just the price is grabbed from that line.  Once both values are available, the last MtGox USD price is divided by the last Silver USD spot price and rounded to the 4th decimal and then the result is output to file :)

I hope you didn't spend too much time on it. I didn't ask anyone to write anything for me.   I am not found of screen captures because they are fragile and for the application I am looking at if it broke and reported incorrect data it could be costly.

No worries, it was a fun and interesting project :)

I agree that screen captures aren't the best source for this, but having the data in realtime is a plus.  Finally tweaked the cropped image a bit to reduce variation and increase accuracy.  I'm liking it so far, may just keep it for personal use.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: the founder on March 13, 2013, 04:05:31 PM
Sorry for being late... this has existed for quite some time.

http://www.ounce.me

and the RSS feed / API for bitcoin / silver / gold / etc is here:

http://www.ounce.me/rss.xml




Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: DeathAndTaxes on March 13, 2013, 04:06:39 PM
http://www.ounce.me/rss.xml

Nice one.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: mintymark on March 13, 2013, 04:11:37 PM
You can use the Perl module Finance::Quote::GoldMoney

This scrapes the goldmoney home page and gives prices for Gold, Silver, Platinum, and Paladium.



Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: the founder on March 13, 2013, 04:24:15 PM
You can use the Perl module Finance::Quote::GoldMoney

This scrapes the goldmoney home page and gives prices for Gold, Silver, Platinum, and Paladium.



That's why I like the ounce.me one... it's not a scraper...  uses the quotes from the ETF's , factors out the commissions and presents a very accurate figure,  for BTC it goes to several exchanges, averages them, and gives a very accurate figure.

It's most likely the most accurate number that you can get.





Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: debianlinux on March 13, 2013, 04:31:01 PM
So, what this REALLY does is compare the price of PM to USD and the price of BTC to USD and make a correlation. Both values are still pegged to USD. Wake me up when we are directly pricing PM in BTC with little to no correlation to USD.


Title: Re: API to get price of a silver (or other PM) in BTC?
Post by: the founder on March 13, 2013, 04:40:35 PM
So, what this REALLY does is compare the price of PM to USD and the price of BTC to USD and make a correlation. Both values are still pegged to USD. Wake me up when we are directly pricing PM in BTC with little to no correlation to USD.

Will do the second you go to the local grocery store and buy everything in BTC easily....  dude I agree with you.. .but we're a VERY long way from that... though I have to say that more options are becoming available recently.

Plus there's still a lingering argument that never went away from it's inception.   Bitcoin most likely isn't a currency, but a commodity .. like Gold, Silver or Oil ...   and I doubt most people would want it any other way... the second is becomes a "currency"  then it opens a can of worms with regulations, etc.