Skip to content

Instantly share code, notes, and snippets.

@kendepelchin
Last active August 29, 2015 13:56
Show Gist options
  • Save kendepelchin/8935680 to your computer and use it in GitHub Desktop.
Save kendepelchin/8935680 to your computer and use it in GitHub Desktop.
Get terminal notifications for litecoin changes
<?php
error_reporting(0);
while (true) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.kraken.com/0/public/Ticker?pair=LTCEUR');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
curl_close($ch);
if ($content) {
$result = json_decode($content, true);
$low = $result['result']['XLTCZEUR']['l'][0];
$high = $result['result']['XLTCZEUR']['h'][0];
}
exec('terminal-notifier -message "low: ' . $low . ' - high: ' . $high . '" -title "Kraken LTC"');
sleep(3600 / 4);
}
// https://api.kraken.com/0/public/Ticker?pair=LTCEUR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment