forked from globalzon/yaamp
-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: use new kucoin public api url and disable it
private api to finish, tired to decrypt asian brains...
- Loading branch information
Showing
6 changed files
with
49 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1527,13 +1527,11 @@ function updateKuCoinMarkets() | |
$list = getdbolist('db_markets', "name LIKE '$exchange%'"); | ||
if (empty($list)) return; | ||
|
||
$markets = kucoin_api_query('open/symbols','market=BTC'); | ||
if(!kucoin_result_valid($markets) || empty($markets->data)) return; | ||
$symbols = kucoin_api_query('symbols','market=BTC'); | ||
if(!kucoin_result_valid($symbols) || empty($symbols->data)) return; | ||
|
||
$coininfo = NULL; //kucoin_api_query('market/open/coins'); | ||
if(!kucoin_result_valid($coininfo) || empty($coininfo->data)) { | ||
$coininfo = NULL; | ||
} | ||
$markets = kucoin_api_query('markets/allTickers'); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
if(!kucoin_result_valid($markets) || empty($markets->data)) return; | ||
This comment has been minimized.
Sorry, something went wrong.
pinpins
|
||
|
||
foreach($list as $market) | ||
{ | ||
|
@@ -1550,18 +1548,25 @@ function updateKuCoinMarkets() | |
|
||
$pair = strtoupper($symbol).'-BTC'; | ||
|
||
$enableTrading = false; | ||
foreach ($symbols->data as $sym) { | ||
if (objSafeVal($sym,'symbol') != $pair) continue; | ||
$enableTrading = objSafeVal($sym,'enableTrading',false); | ||
break; | ||
} | ||
|
||
if ($market->disabled == $enableTrading) { | ||
$market->disabled = (int) (!$enableTrading); | ||
$market->save(); | ||
if ($market->disabled) continue; | ||
} | ||
|
||
foreach ($markets->data as $ticker) { | ||
if ($ticker->symbol != $pair) continue; | ||
if (objSafeVal($ticker,'buy',-1) == -1) continue; | ||
|
||
$market->price = AverageIncrement($market->price, $ticker->buy); | ||
$market->price2 = AverageIncrement($market->price2, objSafeVal($ticker,'sell',$ticker->buy)); | ||
if (!empty($coininfo)) foreach ($coininfo->data as $info) { | ||
if ($info->coin == $symbol) { | ||
//todo: $market->withdrawfee = $info->withdrawMinFee; | ||
break; | ||
} | ||
} | ||
$market->txfee = $ticker->feeRate * 100; // is 0.1% for trades (0.001) | ||
$market->priority = -1; | ||
$market->pricetime = time(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Small type to fix
kucoin_api_query('market/allTickers');