Bitcoin Forum
December 09, 2016, 03:45:55 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: New service: BTCrate.com  (Read 1809 times)
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
May 23, 2011, 08:52:14 AM
 #1

BTCrate.com is a simple service which provides currency conversion between Bitcoin and other world currencies.

To use it, send a request in the form of:

Code:
GET http://btcrate.com/convert?from=<from_currency>&to=<to_currency>[&exch=<exchange>[&conv=<converter>[&amount=<amount>]]]

  • Currently supported exchanges are "mtgox" and "bitomat". Currently supported conversion services are "google" and "xe".
  • MtGox and Bitomat are demand-polled every 10 minutes. Google and XE.com are demand-polled every 60 minutes.
  • MtGox is the default exchange (thereby making the US dollar the default basis currency), and Google is the default conversion service.

Example:

We'll ask for the value of BTC 100 in ounces of gold, using MtGox's last trade rate and XE.com's gold price:

Code:
GET http://btcrate.com/convert?from=btc&to=xau&exch=mtgox&conv=xe&amount=1000

Result:
Code:
{"converted": "4.78023000"}

Thus, 1,000 Bitcoins were equivalent to about 4.78 oz of gold at the time.

Like this service? Your gifts to 1B2Tsi3dz2jm9GBHvAd1QoroAeA3BEBrUS are much appreciated!

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
1481298355
Hero Member
*
Offline Offline

Posts: 1481298355

View Profile Personal Message (Offline)

Ignore
1481298355
Reply with quote  #2

1481298355
Report to moderator
1481298355
Hero Member
*
Offline Offline

Posts: 1481298355

View Profile Personal Message (Offline)

Ignore
1481298355
Reply with quote  #2

1481298355
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481298355
Hero Member
*
Offline Offline

Posts: 1481298355

View Profile Personal Message (Offline)

Ignore
1481298355
Reply with quote  #2

1481298355
Report to moderator
1481298355
Hero Member
*
Offline Offline

Posts: 1481298355

View Profile Personal Message (Offline)

Ignore
1481298355
Reply with quote  #2

1481298355
Report to moderator
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2002



View Profile
May 23, 2011, 01:38:10 PM
 #2

This is awesome.

Hoping some javascript programmer can take the Javascript Bitcoin Converter and update it to accommodate these additional currencies:
  - http://sanescreen.org/converter
  - http://en.bitcoin.it/wiki/Converter

matt.collier
Member
**
Offline Offline

Activity: 105



View Profile
May 23, 2011, 03:44:05 PM
 #3

This is great!  Would you be able to provide a X day moving average based on closing price?  If you want to get fancy, a moving average on open, close, high and low would be nice!  Smiley
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
May 24, 2011, 12:20:29 AM
 #4

This is great!  Would you be able to provide a X day moving average based on closing price?  If you want to get fancy, a moving average on open, close, high and low would be nice!  Smiley

Thanks.

What you're asking about would require that I take the full trading data feeds from MtGox and Bitomat, which I'm not doing. Seems like you're thinking of a trading application for the data, whereas the need that motivated me to create this is to have a source of conversion data for doing automated re-pricing on Bitcoin-accepting merchant websites.

You could grab weighted pricing from bitcoinmarket.com's API. I think they offer 3 different intervals.

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
matt.collier
Member
**
Offline Offline

Activity: 105



View Profile
May 24, 2011, 12:32:08 AM
 #5

The repricing is what I had in mind as well.  While the market is making 10-15% moves in a day, I think an average of some kind is more valuable.
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
May 24, 2011, 01:11:46 AM
 #6

The repricing is what I had in mind as well.  While the market is making 10-15% moves in a day, I think an average of some kind is more valuable.

Gotcha. I'll have to think about it. Thus far, I'd envisioned shopping cart implementers polling the service on their own schedule and doing whatever they liked with the data. That could certainly involve building up a moving average and pricing off it. Hmm.

Actually, this is the reverse case of my use case, now that I remember correctly. What I wanted for an e-shop is the ability to price in Bitcoins, but have a convenience option of displaying secondary prices to customers in their local currencies. For that case, you'd actually tend to want up-to-the-minute data.

Now to get an AJAX wrapper done for this..

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
Longmarch
Full Member
***
Offline Offline

Activity: 132



View Profile
May 24, 2011, 04:52:41 AM
 #7

Google and XE.com are demand-polled every 60 minutes.

Are you paying for the XE.com feed?
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
May 24, 2011, 05:08:26 AM
 #8

Google and XE.com are demand-polled every 60 minutes.

Are you paying for the XE.com feed?

Hell no:

Code:
r = urllib2.urlopen("http://www.xe.com/tmi/xe-output.php?appid=ffxtn-1.0&from_amount=1&from=" + from_currency + "&to=" + to_currency).read()

Wink

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
May 24, 2011, 07:21:01 AM
 #9

BTCrate.com now sports a Javascript interface.

By including a script from BTCrate.com into your web page with the appropriate arguments, a Javascript variable btcrate_com_rate will be set with the conversion rate.

Here's a simple example:

Code:
<html><head><title>BTCrate.com Javascript interface test</title>
<script type="text/javascript" src="http://btcrate.com/convert.js?from=btc&to=eur"></script>

</head><body>
<span id="rate"></span>
<script type="text/javascript">
        window.onload = function() {
                document.getElementById("rate").innerHTML="BTC 1 is worth " + btcrate_com_rate + " euros.";
        }
</script>
</body></html>

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
jerfelix
Sr. Member
****
Offline Offline

Activity: 266


View Profile
May 24, 2011, 10:07:26 AM
 #10

Very cool!

Question:  How do you envision merchants would use this?  I'm thinking out loud here....

Seems like as a merchant, you'd want to offer your goods and services in various currencies, and "lock in" the prices for the duration of the users' session, so that the price in Bitcoins is constant during the period that a user fills out the order form. 

Say the merchant's page says "Now available for 6.20 BTC (which is approximately $44.99 at the current exchange rate)."  And then the user fills out the order form.  Meanwhile, the exchange rate has fluctuated.  But, as a merchant, I want to make it easy for my buyer, and if they agree to pay me 6.20 BTC, I don't want to stop the transaction and say "oh wait, the currency value fluctuated, and now you owe me 6.25 BTC".   (unless, perhaps, the exchange rate has fluctuated wildly during the time that the user filled out the form).

Most merchants will think in their native currency, so they'll want to make sure that the offers in BTC are approximately equivalent to their offer in the native currency.

My concern is that if the price conversion is determined by Javascript at the client, then it's potentially subject to attack by the user.  So the merchant would need to validate the sanity of the BTC pricing at the server once the order is submitted.  And the range of acceptable prices could be pretty wide.

An example of this concern would be that I, as a user with Firebug installed, could easily alter the 6.20 BTC price, make it 2.20 BTC, and order the product.  The server would then need to be able to detect that I was cheating.  How would this work?  Does the server need to keep track of all recent exchange fluctuations?  (because a 6.20 vs 6.25 difference may be acceptable due to the time it takes to fill out the form.  But a 2.20 vs 6.25 difference was probably the result of a cheater).  Or would the server just check to see if the submitted price is within, say, 3% of the current exchange rate? (In which case, if I were a cheater, I'd always give myself a 3% discount)

I'm sure this issue can be resolved, and probably has been resolved for non-BTC multi-currency sites. 

Maybe there needs to be a way for the server to hit BTCrate and ask "when was the last time $44.99 converted to 2.20 BTC?" and check to see that the time interval is within an acceptable range.  If the answer is greater than 20 minutes, then throw the user to a "Sorry, you timed out" page.

Any thoughts?
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!