Skip to content

Commit b754ebf

Browse files
committed
Add Coinbase ETH spot price example
1 parent a97721c commit b754ebf

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

examples/coinbase_spot_rate.php renamed to examples/coinbase_btc_spot_price.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
$curl = new Curl();
77
$curl->setHeader('CB-VERSION', '2016-01-01');
8-
$curl->get('https://api.coinbase.com/v2/prices/spot');
8+
$curl->get('https://api.coinbase.com/v2/prices/BTC-USD/spot');
99

1010
echo
11-
'The current price of bitcoin at Coinbase is ' .
11+
'The current price of BTC at Coinbase is ' .
1212
'$' . $curl->response->data->amount . ' ' . $curl->response->data->currency . '.' . "\n";

examples/coinbase_eth_spot_price.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
require __DIR__ . '/vendor/autoload.php';
3+
4+
use \Curl\Curl;
5+
6+
$curl = new Curl();
7+
$curl->setHeader('CB-VERSION', '2016-01-01');
8+
$curl->get('https://api.coinbase.com/v2/prices/ETH-USD/spot');
9+
10+
echo
11+
'The current price of ETH at Coinbase is ' .
12+
'$' . $curl->response->data->amount . ' ' . $curl->response->data->currency . '.' . "\n";

0 commit comments

Comments
 (0)