Commit c510e13b authored by shajiaming's avatar shajiaming

bva行情更新

parent f555604a
......@@ -8,7 +8,7 @@ class Bilaxy extends Exchange implements ExchangeInterface
{
protected $supported_symbol = 'supported_symbol_bilaxy';
protected $quotation_prefix = 'quotation_bilaxy_';
protected $base_url = 'https://api.bilaxy.com/v1/tickers';
protected $base_url = 'https://newapi.bilaxy.com/';
public function symbolExists($tag = 'BVA', $aim = "USDT")
......@@ -38,7 +38,15 @@ class Bilaxy extends Exchange implements ExchangeInterface
*/
public function setSupportedSymbol()
{
$this->redis->sadd($this->supported_symbol, 'BVA_USDT');
$curl = new Curl();
$api = $this->base_url . '/v1/ticker/24hr';
$content = $curl->get($api, false);//json
if (is_array($content)) {
foreach ($content as $key => $item) {
$this->redis->sadd($this->supported_symbol, strtoupper($key));
}
}
}
/**
......@@ -49,14 +57,13 @@ class Bilaxy extends Exchange implements ExchangeInterface
public function setQuotation()
{
$curl = new Curl();
$content = $curl->get($this->base_url, false);
if (is_array($content) && isset($content['data'])) {
$data = $content['data'];
$key = $this->quotation_prefix . 'BVA_USDT';
foreach ($data as $item) {
if ( 260 == $item['symbol']) {
$this->redis->hmset($key, 'low', $item['low'], 'high', $item['high'], 'last', $item['last']);
$this->redis->sadd($this->supported_symbol, 'KPC8_USDT');
$api = $this->base_url . '/v1/ticker/24hr';
$content = $curl->get($api, false);
if (is_array($content)) {
foreach ($content as $key => $item) {
$this->redis->hmset($this->quotation_prefix . strtoupper($key), 'low', $item['low'], 'high', $item['height'], 'last', $item['close']);
if (!$this->redis->sismember($this->supported_symbol, strtoupper($key))){
$this->redis->sadd($this->supported_symbol, strtoupper($key));
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment