Bitcoin Forum
May 03, 2024, 10:16:16 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [PHP] VirWox BTC/USD Exchange Rate  (Read 5416 times)
OdinHephaestus (OP)
Member
**
Offline Offline

Activity: 70
Merit: 10



View Profile
April 20, 2013, 04:21:12 AM
Last edit: April 20, 2013, 10:51:52 AM by OdinHephaestus
 #1

So, had to make this for a project, and thought I would share.

This is a simple PHP script that calculates the BTC<->USD exchange rate on VirWox, after fees.

Code:
function getVirWoxRate() {
$curs = json_decode(file_get_contents("http://api.virwox.com/api/json.php?method=getMarketDepth&symbols%5b0%5d=USD/SLL&symbols%5b1%5d=BTC/SLL&buyDepth=1&sellDepth=1&id=1"))->{'result'};
$usd = $curs[0]->{'buy'}[0]->{'price'}; //Price of USD in SLL
$btc = $curs[1]->{'buy'}[0]->{'price'}; //Price of BTC in SLL
$tran1 = $btc-($btc*.029); //Price of BTC in SLL after Fee
$tran2i = $tran1/$usd; //Price of BTC in USD before Fee
$tran2 = $tran2i-($tran2i*.029); //Price of BTC in USD after Fee
return $tran2;
}

Bitcoin: 1odinQ5YUdbfuopNF2D1FZRN8qcrC4y1L
Litecoin: LeodinXzG7CgHqPDZxaUgsDKUKBUu46qa5
1714774576
Hero Member
*
Offline Offline

Posts: 1714774576

View Profile Personal Message (Offline)

Ignore
1714774576
Reply with quote  #2

1714774576
Report to moderator
1714774576
Hero Member
*
Offline Offline

Posts: 1714774576

View Profile Personal Message (Offline)

Ignore
1714774576
Reply with quote  #2

1714774576
Report to moderator
"I'm sure that in 20 years there will either be very large transaction volume or no volume." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714774576
Hero Member
*
Offline Offline

Posts: 1714774576

View Profile Personal Message (Offline)

Ignore
1714774576
Reply with quote  #2

1714774576
Report to moderator
1714774576
Hero Member
*
Offline Offline

Posts: 1714774576

View Profile Personal Message (Offline)

Ignore
1714774576
Reply with quote  #2

1714774576
Report to moderator
caktux
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile WWW
August 03, 2013, 10:03:43 AM
 #2

Thank you for this! I made a USD/BTC tracking chart based on this at http://caktux.ca/virwox comparing the resulting price with MtGox and Bitstamp. Deposit and withdrawal fees are also taken into account. I was surprised to see that even after all those fees, there are a few times when you can get a better rate than at the other exchanges.

Code:
    $usd = $virwox->result[0]->sell[0]->price - (50 / $virwox->result[0]->buy[0]->price); // Price of USD to SLL + commission fee of 50 SLL
    $usd_with_fees = $usd - ($usd * 0.029); // Price of USD to SLL + fee

    $btc = $virwox->result[1]->buy[0]->price + 50; // Price of SLL to BTC + commission fee
    $btc_with_fees = $btc + ($btc * 0.029); // Price of SLL to BTC + fee

    $rate_with_fees = $btc_with_fees / $usd_with_fees;

    $rate_virwox = $rate_with_fees + ($rate_with_fees * 0.034) + 0.5 + (0.01 * $rate_with_fees); // Price of BTC to USD + initial deposit fee + .35 EUR->USD + withdrawal fee
Hfleer
Sr. Member
****
Offline Offline

Activity: 448
Merit: 250


Changing avatars is currently not possible.


View Profile
August 03, 2013, 10:18:53 AM
 #3

Thank you for this! I made a USD/BTC tracking chart based on this at http://caktux.ca/virwox comparing the resulting price with MtGox and Bitstamp. Deposit and withdrawal fees are also taken into account. I was surprised to see that even after all those fees, there are a few times when you can get a better rate than at the other exchanges.


For a market order right now would cost $101.85 per BTC, and you could sell for $96.50.  That's without the fees which I think change with your volume and the order type, but are pretty high.  Your site says 106-108, so sell is probably around 90ish with those fees.  The Buy is not too horrible if you're doing it on credit.

█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
▓▓▓▓▓  BIT-X.comvvvvvvvvvvvvvvi
→ CREATE ACCOUNT 
▓▓▓▓▓
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
Lavabo
Newbie
*
Offline Offline

Activity: 17
Merit: 0



View Profile
August 27, 2013, 03:42:30 PM
 #4

Thank you for this! I made a USD/BTC tracking chart based on this at http://caktux.ca/virwox comparing the resulting price with MtGox and Bitstamp. Deposit and withdrawal fees are also taken into account. I was surprised to see that even after all those fees, there are a few times when you can get a better rate than at the other exchanges.


Interesting, but is it possible to have BTC/USD  live chart??  When im trading my BTC im having a hard time understanding the SLL rate

thanks
chmod755
Legendary
*
Offline Offline

Activity: 1386
Merit: 1020



View Profile WWW
August 29, 2013, 06:56:39 PM
 #5

There are discounts on the trading fees for limit orders based on your trading activity during the last 30 days - so your results might be different from the chart if you're using limit orders instead of market orders.

bitcon
Legendary
*
Offline Offline

Activity: 2212
Merit: 1008


View Profile
September 01, 2013, 07:03:55 AM
 #6

^this.  you get higher discount the more trades you complete
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!