Skip to content

Commit

Permalink
binance fetchTickers → fetchBidsAsks, fetchFullTickers → fetchTickers c…
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Jan 14, 2018
1 parent 30ffea1 commit 2e21ecd
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 24 deletions.
12 changes: 7 additions & 5 deletions js/base/Exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ module.exports = class Exchange {
this.hasFetchOrders = false
this.hasFetchTicker = true
this.hasFetchTickers = false
this.hasFetchBidsAsks = false
this.hasFetchTrades = true
this.hasWithdraw = false
this.hasCreateOrder = this.hasPrivateAPI
Expand Down Expand Up @@ -161,6 +162,7 @@ module.exports = class Exchange {
this.fetch_total_balance = this.fetchTotalBalance
this.fetch_l2_order_book = this.fetchL2OrderBook
this.fetch_order_book = this.fetchOrderBook
this.fetch_bids_asks = this.fetchBidsAsks
this.fetch_tickers = this.fetchTickers
this.fetch_ticker = this.fetchTicker
this.fetch_trades = this.fetchTrades
Expand Down Expand Up @@ -212,7 +214,6 @@ module.exports = class Exchange {
'fetchClosedOrders': false,
'fetchCurrencies': false,
'fetchDepositAddress': false,
'fetchFullTickers': false,
'fetchMarkets': true,
'fetchMyTrades': false,
'fetchOHLCV': false,
Expand All @@ -222,6 +223,7 @@ module.exports = class Exchange {
'fetchOrders': false,
'fetchTicker': true,
'fetchTickers': false,
'fetchBidsAsks': false,
'fetchTrades': true,
'withdraw': false,
}
Expand Down Expand Up @@ -537,12 +539,12 @@ module.exports = class Exchange {
return this.setMarkets (markets, currencies)
}

fetchTickers (symbols = undefined, params = {}) {
throw new NotSupported (this.id + ' fetchTickers not supported yet')
fetchBidsAsks (symbols = undefined, params = {}) {
throw new NotSupported (this.id + ' fetchBidsAsks not supported yet')
}

fetchFullTickers (symbols = undefined, params = {}) {
return this.fetchTickers (symbols, params)
fetchTickers (symbols = undefined, params = {}) {
throw new NotSupported (this.id + ' fetchTickers not supported yet')
}

fetchOrder (id, symbol = undefined, params = {}) {
Expand Down
10 changes: 6 additions & 4 deletions js/binance.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = class binance extends Exchange {
'rateLimit': 500,
'hasCORS': false,
// obsolete metainfo interface
'hasFetchFullTickers': true,
'hasFetchBidsAsks': true,
'hasFetchTickers': true,
'hasFetchOHLCV': true,
'hasFetchMyTrades': true,
Expand All @@ -27,7 +27,7 @@ module.exports = class binance extends Exchange {
'hasWithdraw': true,
// new metainfo interface
'has': {
'fetchFullTickers': true,
'fetchBidsAsks': true,
'fetchTickers': true,
'fetchOHLCV': true,
'fetchMyTrades': true,
Expand Down Expand Up @@ -440,7 +440,9 @@ module.exports = class binance extends Exchange {
'high': this.safeFloat (ticker, 'highPrice'),
'low': this.safeFloat (ticker, 'lowPrice'),
'bid': this.safeFloat (ticker, 'bidPrice'),
'bidVolume': this.safeFloat (ticker, 'bidQty'),
'ask': this.safeFloat (ticker, 'askPrice'),
'askVolume': this.safeFloat (ticker, 'askQty'),
'vwap': this.safeFloat (ticker, 'weightedAvgPrice'),
'open': this.safeFloat (ticker, 'openPrice'),
'close': this.safeFloat (ticker, 'prevClosePrice'),
Expand Down Expand Up @@ -483,13 +485,13 @@ module.exports = class binance extends Exchange {
return result;
}

async fetchTickers (symbols = undefined, params = {}) {
async fetchBidAsks (symbols = undefined, params = {}) {
await this.loadMarkets ();
let rawTickers = await this.publicGetTickerBookTicker (params);
return this.parseTickers (rawTickers, symbols);
}

async fetchFullTickers (symbols = undefined, params = {}) {
async fetchTickers (symbols = undefined, params = {}) {
await this.loadMarkets ();
let rawTickers = await this.publicGetTicker24hr (params);
return this.parseTickers (rawTickers, symbols);
Expand Down
3 changes: 0 additions & 3 deletions js/kucoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,6 @@ module.exports = class kucoin extends Exchange {
let response = JSON.parse (body);
this.throwExceptionOnError (response);
}
if (code >= 400) {
throw new ExchangeError (this.id + ' ' + code.toString () + ' ' + reason);
}
}

async request (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
Expand Down
16 changes: 8 additions & 8 deletions php/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -1167,20 +1167,20 @@ public function filterOrdersBySymbol ($orders, $symbol = null) {
return $this->filter_orders_by_symbol ($orders, $symbol);
}

public function fetch_tickers ($symbols, $params = array ()) { // stub
throw new NotSupported ($this->id . ' API does not allow to fetch all tickers at once with a single call to fetch_tickers () for now');
public function fetch_bids_asks ($symbols, $params = array ()) { // stub
throw new NotSupported ($this->id . ' API does not allow to fetch all prices at once with a single call to fetch_bids_asks () for now');
}

public function fetchTickers ($symbols, $params = array ()) {
return $this->fetch_tickers ($symbols, $params);
public function fetchBidsAsks ($symbols, $params = array ()) {
return $this->fetch_bids_asks ($symbols, $params);
}

public function fetch_full_tickers ($symbols, $params = array ()) { // stub
return $this->fetch_tickers ($symbols, $params);
public function fetch_tickers ($symbols, $params = array ()) { // stub
throw new NotSupported ($this->id . ' API does not allow to fetch all tickers at once with a single call to fetch_tickers () for now');
}

public function fetchFullTickers ($symbols, $params = array ()) {
return $this->fetch_full_tickers ($symbols, $params);
public function fetchTickers ($symbols, $params = array ()) {
return $this->fetch_tickers ($symbols, $params);
}

public function fetch_order_status ($id, $market = null) {
Expand Down
6 changes: 3 additions & 3 deletions python/ccxt/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,12 +835,12 @@ def load_markets(self, reload=False):
def fetch_markets(self):
return self.markets

def fetch_bids_asks(self, symbols=None, params={}):
raise NotSupported(self.id + ' API does not allow to fetch all prices at once with a single call to fetch_bid_asks() for now')

def fetch_tickers(self, symbols=None, params={}):
raise NotSupported(self.id + ' API does not allow to fetch all tickers at once with a single call to fetch_tickers() for now')

def fetch_full_tickers(self, symbols=None, params={}):
return self.fetch_tickers(symbols, params)

def fetch_order_status(self, id, market=None):
order = self.fetch_order(id)
return order['status']
Expand Down
2 changes: 1 addition & 1 deletion transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const commonRegexes = [
[ /\.fetchOpenOrder\s/g, '.fetch_open_order'],
[ /\.fetchOrders\s/g, '.fetch_orders'],
[ /\.fetchOrder\s/g, '.fetch_order'],
[ /\.fetchFullTickers\s/g, '.fetch_full_tickers'],
[ /\.fetchBidsAsks\s/g, '.fetch_bids_asks'],
[ /\.fetchTickers\s/g, '.fetch_tickers'],
[ /\.fetchTicker\s/g, '.fetch_ticker'],
[ /\.fetchCurrencies\s/g, '.fetch_currencies'],
Expand Down

0 comments on commit 2e21ecd

Please sign in to comment.