Skip to content

Commit

Permalink
1.10.873
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jan 27, 2018
1 parent 0842dfc commit 6696b9b
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 35 deletions.
38 changes: 36 additions & 2 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 Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.10.872'
const version = '1.10.873'

Exchange.ccxtVersion = version

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.872",
"version": "1.10.873",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 90+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
2 changes: 1 addition & 1 deletion php/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.10.872';
$version = '1.10.873';

abstract class Exchange {

Expand Down
34 changes: 34 additions & 0 deletions php/zb.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,25 @@ public function describe () {
'version' => 'v1',
'has' => array (
'CORS' => false,
'fetchOHLCV' => true,
'fetchTickers' => true,
'fetchOrder' => true,
'withdraw' => true,
),
'timeframes' => array (
'1m' => '1min',
'3m' => '3min',
'5m' => '5min',
'15m' => '15min',
'30m' => '30min',
'1h' => '1hour',
'2h' => '2hour',
'4h' => '4hour',
'6h' => '6hour',
'12h' => '12hour',
'1d' => '1day',
'3d' => '3day',
'1w' => '1week',
),
'urls' => array (
'logo' => 'https://user-images.githubusercontent.com/1294454/32859187-cd5214f0-ca5e-11e7-967d-96568e2e2bd1.jpg',
Expand Down Expand Up @@ -244,6 +262,22 @@ public function fetch_ticker ($symbol, $params = array ()) {
);
}

public function fetch_ohlcv ($symbol, $timeframe = '1m', $since = null, $limit = null, $params = array ()) {
$this->load_markets();
$market = $this->market ($symbol);
if ($limit === null)
$limit = 1000;
$request = array (
'market' => $market['id'],
'type' => $this->timeframes[$timeframe],
'limit' => $limit,
);
if ($since !== null)
$request['since'] = $since;
$response = $this->publicGetKline (array_merge ($request, $params));
return $this->parse_ohlcvs($response['data'], $market, $timeframe, $since, $limit);
}

public function parse_trade ($trade, $market = null) {
$timestamp = $trade['date'] * 1000;
$side = ($trade['trade_type'] === 'bid') ? 'buy' : 'sell';
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.872'
__version__ = '1.10.873'

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

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.872'
__version__ = '1.10.873'

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

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.872'
__version__ = '1.10.873'

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

Expand Down
33 changes: 33 additions & 0 deletions python/ccxt/async/zb.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,25 @@ def describe(self):
'version': 'v1',
'has': {
'CORS': False,
'fetchOHLCV': True,
'fetchTickers': True,
'fetchOrder': True,
'withdraw': True,
},
'timeframes': {
'1m': '1min',
'3m': '3min',
'5m': '5min',
'15m': '15min',
'30m': '30min',
'1h': '1hour',
'2h': '2hour',
'4h': '4hour',
'6h': '6hour',
'12h': '12hour',
'1d': '1day',
'3d': '3day',
'1w': '1week',
},
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/32859187-cd5214f0-ca5e-11e7-967d-96568e2e2bd1.jpg',
Expand Down Expand Up @@ -246,6 +264,21 @@ async def fetch_ticker(self, symbol, params={}):
'info': ticker,
}

async def fetch_ohlcv(self, symbol, timeframe='1m', since=None, limit=None, params={}):
await self.load_markets()
market = self.market(symbol)
if limit is None:
limit = 1000
request = {
'market': market['id'],
'type': self.timeframes[timeframe],
'limit': limit,
}
if since is not None:
request['since'] = since
response = await self.publicGetKline(self.extend(request, params))
return self.parse_ohlcvs(response['data'], market, timeframe, since, limit)

def parse_trade(self, trade, market=None):
timestamp = trade['date'] * 1000
side = 'buy' if (trade['trade_type'] == 'bid') else 'sell'
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.872'
__version__ = '1.10.873'

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

Expand Down
32 changes: 6 additions & 26 deletions python/ccxt/zb.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ def describe(self):
'countries': 'CN',
'rateLimit': 1000,
'version': 'v1',
'hasCORS': False,
# old metainfo interface
'hasFetchOrder': True,
'hasFetchTickers': True,
'hasWithdraw': True,
'hasFetchOHLCV': True,
# new metainfo interface
'has': {
'CORS': False,
'fetchOHLCV': True,
Expand Down Expand Up @@ -271,33 +264,20 @@ def fetch_ticker(self, symbol, params={}):
'info': ticker,
}

def parse_ohlcv(self, ohlcv, market=None, timeframe='1m', since=None, limit=None):
return [ohlcv[0],
ohlcv[1],
ohlcv[2],
ohlcv[3],
ohlcv[4],
ohlcv[5]]

def fetch_ohlcv(self, symbol, timeframe='1m', since=None, limit=None, params={}):
self.load_markets()
market = self.market(symbol)
if limit is None:
limit = 1000
request = {
'market': market['id'],
'type': self.timeframes[timeframe],
'limit': limit,
}
request['limit'] = limit if (limit) else 1000 # default == max == 1000

# Set since = 0 to traverse records from the beginning.
if not (since is None) and (since >= 0):
# The length of the 'since' parameter
# passed to the API must be exactly 13 bytes.
str_since = str(since)
if len(str_since) < 13:
str_since = "{0}{1}".format("0" * (13 - len(str_since)), str_since)
request['since'] = str_since
if since is not None:
request['since'] = since
response = self.publicGetKline(self.extend(request, params))
return self.parse_ohlcvs(response["data"], market, timeframe, since, limit)
return self.parse_ohlcvs(response['data'], market, timeframe, since, limit)

def parse_trade(self, trade, market=None):
timestamp = trade['date'] * 1000
Expand Down

0 comments on commit 6696b9b

Please sign in to comment.