Back to Ccxt

Bitfinex2 Fetch Trades Since

wiki/examples/php/bitfinex2-fetch-trades-since.md

4.5.52480 B
Original Source
php
<?php

include './ccxt.php';

date_default_timezone_set('UTC');

$id = 'bitfinex2';

// instantiate the exchange by id
$exchange = '\\ccxt\\' . $id;
$exchange = new $exchange ();

// load all markets from the exchange
$trades = $exchange->fetch_trades ('ETH/BTC', 1518983548636 - 2 * 24 * 60 * 60 * 1000);

foreach ($trades as $trade) {
   echo $trade['datetime'] . "\n";
}
echo count ($trades) . " trades\n";

?>