Skip to content

Commit

Permalink
stex: use new url of stocksexchange
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Oct 3, 2018
1 parent 8ad6065 commit 685747b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions web/yaamp/core/exchange/stocksexchange.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

// markets https://stocks.exchange/api2/markets
// prices https://stocks.exchange/api2/ticker
// prices https://stocks.exchange/api2/prices (unused)
// markets https://app.stex.com/api2/markets
// prices https://app.stex.com/api2/ticker

function stocksexchange_api_query($method)
{
$uri = "https://stocks.exchange/api2/$method";
$uri = "https://app.stex.com/api2/$method";

$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Expand All @@ -26,9 +25,10 @@ function stocksexchange_api_user($method, $params=array())

if (empty(EXCH_STOCKSEXCHANGE_KEY) || empty(EXCH_STOCKSEXCHANGE_SECRET)) return false;

$exchange = 'stocksexchange';
$mt = explode(' ', microtime());
$nonce = $mt[1].substr($mt[0], 2, 6);
$url = "https://stocks.exchange/api2?method=$method&nonce=$nonce";
$url = "https://app.stex.com/api2?method=$method&nonce=$nonce";

$sign_data = json_encode($params);
$sign = hash_hmac('sha512', $sign_data, EXCH_STOCKSEXCHANGE_SECRET);
Expand Down Expand Up @@ -57,7 +57,7 @@ function stocksexchange_api_user($method, $params=array())
$res = curl_exec($ch);
if($res === false) {
$e = curl_error($ch);
debuglog("stocksexchange: $e");
debuglog("$exchange: $e");
curl_close($ch);
return false;
}
Expand All @@ -66,9 +66,9 @@ function stocksexchange_api_user($method, $params=array())
if(!is_object($result) && !is_array($result)) {
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (strpos($res,'Maintenance'))
debuglog("stocksexchange: $method failed (Maintenance)");
debuglog("$exchange: $method failed (Maintenance)");
else
debuglog("stocksexchange: $method failed ($status) ".strip_data($res));
debuglog("$exchange: $method failed ($status) ".strip_data($res));
}

curl_close($ch);
Expand Down

0 comments on commit 685747b

Please sign in to comment.