Skip to content

Commit

Permalink
1.10.426
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Dec 20, 2017
1 parent 644b4a8 commit 6d4f1c1
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 51 deletions.
36 changes: 23 additions & 13 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const errors = require ('./js/base/errors')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.10.425'
const version = '1.10.426'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion ccxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.10.425';
$version = '1.10.426';

define('PATH_TO_CCXT', __DIR__ . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ccxt",
"version": "1.10.425",
"version": "1.10.426",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 90+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
32 changes: 21 additions & 11 deletions php/binance.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,16 @@ public function fetch_order_book ($symbol, $params = array ()) {
return $this->parse_order_book($orderbook);
}

public function parse_ticker ($ticker, $market) {
public function parse_ticker ($ticker, $market = null) {
$timestamp = $this->safe_integer($ticker, 'closeTime');
if ($timestamp === null)
$timestamp = $this->milliseconds ();
$symbol = null;
$symbol = $ticker['symbol'];
if (!$market) {
if (is_array ($this->markets_by_id) && array_key_exists ($symbol, $this->markets_by_id)) {
$market = $this->markets_by_id[$symbol];
}
}
if ($market)
$symbol = $market['symbol'];
return array (
Expand Down Expand Up @@ -389,16 +394,21 @@ public function fetch_ticker ($symbol, $params = array ()) {

public function fetch_tickers ($symbols = null, $params = array ()) {
$this->load_markets();
$tickers = $this->publicGetTickerAllBookTickers ($params);
$rawTickers = $this->publicGetTicker24hr ($params);
$tickers = array ();
for ($i = 0; $i < count ($rawTickers); $i++) {
$tickers[] = $this->parse_ticker($rawTickers[$i]);
}
$tickersBySymbol = $this->index_by($tickers, 'symbol');
// return all of them if no $symbols were passed in the first argument
if (!$symbols)
return $tickersBySymbol;
// otherwise filter by $symbol
$result = array ();
for ($i = 0; $i < count ($tickers); $i++) {
$ticker = $tickers[$i];
$id = $ticker['symbol'];
if (is_array ($this->markets_by_id) && array_key_exists ($id, $this->markets_by_id)) {
$market = $this->markets_by_id[$id];
$symbol = $market['symbol'];
$result[$symbol] = $this->parse_ticker($ticker, $market);
}
for ($i = 0; $i < count ($symbols); $i++) {
$symbol = $symbols[$i];
if (is_array ($tickersBySymbol) && array_key_exists ($symbol, $tickersBySymbol))
$result[$symbol] = $tickersBySymbol[$symbol];
}
return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# ----------------------------------------------------------------------------

__version__ = '1.10.425'
__version__ = '1.10.426'

# ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.425'
__version__ = '1.10.426'

# -----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.425'
__version__ = '1.10.426'

# -----------------------------------------------------------------------------

Expand Down
28 changes: 18 additions & 10 deletions python/ccxt/async/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,14 @@ async def fetch_order_book(self, symbol, params={}):
}, params))
return self.parse_order_book(orderbook)

def parse_ticker(self, ticker, market):
def parse_ticker(self, ticker, market=None):
timestamp = self.safe_integer(ticker, 'closeTime')
if timestamp is None:
timestamp = self.milliseconds()
symbol = None
symbol = ticker['symbol']
if not market:
if symbol in self.markets_by_id:
market = self.markets_by_id[symbol]
if market:
symbol = market['symbol']
return {
Expand Down Expand Up @@ -382,15 +385,20 @@ async def fetch_ticker(self, symbol, params={}):

async def fetch_tickers(self, symbols=None, params={}):
await self.load_markets()
tickers = await self.publicGetTickerAllBookTickers(params)
rawTickers = await self.publicGetTicker24hr(params)
tickers = []
for i in range(0, len(rawTickers)):
tickers.append(self.parse_ticker(rawTickers[i]))
tickersBySymbol = self.index_by(tickers, 'symbol')
# return all of them if no symbols were passed in the first argument
if not symbols:
return tickersBySymbol
# otherwise filter by symbol
result = {}
for i in range(0, len(tickers)):
ticker = tickers[i]
id = ticker['symbol']
if id in self.markets_by_id:
market = self.markets_by_id[id]
symbol = market['symbol']
result[symbol] = self.parse_ticker(ticker, market)
for i in range(0, len(symbols)):
symbol = symbols[i]
if symbol in tickersBySymbol:
result[symbol] = tickersBySymbol[symbol]
return result

def parse_ohlcv(self, ohlcv, market=None, timeframe='1m', since=None, limit=None):
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# -----------------------------------------------------------------------------

__version__ = '1.10.425'
__version__ = '1.10.426'

# -----------------------------------------------------------------------------

Expand Down
28 changes: 18 additions & 10 deletions python/ccxt/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,14 @@ def fetch_order_book(self, symbol, params={}):
}, params))
return self.parse_order_book(orderbook)

def parse_ticker(self, ticker, market):
def parse_ticker(self, ticker, market=None):
timestamp = self.safe_integer(ticker, 'closeTime')
if timestamp is None:
timestamp = self.milliseconds()
symbol = None
symbol = ticker['symbol']
if not market:
if symbol in self.markets_by_id:
market = self.markets_by_id[symbol]
if market:
symbol = market['symbol']
return {
Expand Down Expand Up @@ -382,15 +385,20 @@ def fetch_ticker(self, symbol, params={}):

def fetch_tickers(self, symbols=None, params={}):
self.load_markets()
tickers = self.publicGetTickerAllBookTickers(params)
rawTickers = self.publicGetTicker24hr(params)
tickers = []
for i in range(0, len(rawTickers)):
tickers.append(self.parse_ticker(rawTickers[i]))
tickersBySymbol = self.index_by(tickers, 'symbol')
# return all of them if no symbols were passed in the first argument
if not symbols:
return tickersBySymbol
# otherwise filter by symbol
result = {}
for i in range(0, len(tickers)):
ticker = tickers[i]
id = ticker['symbol']
if id in self.markets_by_id:
market = self.markets_by_id[id]
symbol = market['symbol']
result[symbol] = self.parse_ticker(ticker, market)
for i in range(0, len(symbols)):
symbol = symbols[i]
if symbol in tickersBySymbol:
result[symbol] = tickersBySymbol[symbol]
return result

def parse_ohlcv(self, ohlcv, market=None, timeframe='1m', since=None, limit=None):
Expand Down

0 comments on commit 6d4f1c1

Please sign in to comment.