Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once "poloniex.php";
- // precisa alterar o poloniex.php fornecido pela polo
- // para que ele retorne "returnCompleteBalances" ao inves de "returnBalances"
- $key = "SUA_API_KEY";
- $secret = "SEU_SECRET";
- $api = new poloniex($key, $secret);
- $dbfile="/var/www/anubis/db.sqlite3";
- $balances = $api->get_balances();
- $btc_total = 0.0;
- foreach ($balances as $coin => $balance) {
- $btc_total += $balance['btcValue'];
- }
- $db = new SQLite3($dbfile);
- $stmt = $db->prepare("insert into balance values (:ts, :val)");
- $stmt->bindValue(':val', $btc_total, SQLITE3_FLOAT);
- $stmt->bindValue(':ts', time(), SQLITE3_INTEGER);
- $result = $stmt->execute();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement