Skip to content

Commit

Permalink
1.17.1
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jul 24, 2018
1 parent 153baa9 commit 8fc2666
Show file tree
Hide file tree
Showing 41 changed files with 62,256 additions and 8,871 deletions.
67,305 changes: 60,292 additions & 7,013 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ccxt.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ declare module 'ccxt' {
export class rightbtc extends Exchange {}
export class southxchange extends Exchange {}
export class surbitcoin extends foxbit {}
export class theocean extends Exchange {}
export class therock extends Exchange {}
export class tidebit extends Exchange {}
export class tidex extends liqui {}
Expand Down
3 changes: 2 additions & 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.16.89'
const version = '1.17.1'

Exchange.ccxtVersion = version

Expand Down Expand Up @@ -157,6 +157,7 @@ const exchanges = {
'rightbtc': require ('./js/rightbtc.js'),
'southxchange': require ('./js/southxchange.js'),
'surbitcoin': require ('./js/surbitcoin.js'),
'theocean': require ('./js/theocean.js'),
'therock': require ('./js/therock.js'),
'tidebit': require ('./js/tidebit.js'),
'tidex': require ('./js/tidex.js'),
Expand Down
550 changes: 289 additions & 261 deletions doc/README.rst

Large diffs are not rendered by default.

682 changes: 343 additions & 339 deletions doc/exchanges-by-country.rst

Large diffs are not rendered by default.

516 changes: 260 additions & 256 deletions doc/exchanges.rst

Large diffs are not rendered by default.

518 changes: 261 additions & 257 deletions doc/manual.rst

Large diffs are not rendered by default.

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.17.0",
"version": "1.17.1",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
4 changes: 2 additions & 2 deletions php/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
use kornrunner\Secp256k1;
use kornrunner\Solidity;

$version = '1.16.89';
$version = '1.17.1';

// rounding mode
const TRUNCATE = 0;
Expand All @@ -50,7 +50,7 @@

class Exchange {

const VERSION = '1.16.89';
const VERSION = '1.17.1';

public static $eth_units = array (
'wei' => '1',
Expand Down
7 changes: 5 additions & 2 deletions php/binance.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function describe () {
'name' => 'Binance',
'countries' => array ( 'JP' ), // Japan
'rateLimit' => 500,
'certified' => true,
// new metainfo interface
'has' => array (
'fetchDepositAddress' => true,
Expand Down Expand Up @@ -502,10 +503,12 @@ public function fetch_ohlcv ($symbol, $timeframe = '1m', $since = null, $limit =
'symbol' => $market['id'],
'interval' => $this->timeframes[$timeframe],
);
if ($since !== null)
if ($since !== null) {
$request['startTime'] = $since;
if ($limit !== null)
}
if ($limit !== null) {
$request['limit'] = $limit; // default == max == 500
}
$response = $this->publicGetKlines (array_merge ($request, $params));
return $this->parse_ohlcvs($response, $market, $timeframe, $since, $limit);
}
Expand Down
1 change: 1 addition & 0 deletions php/bitfinex.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function describe () {
'countries' => array ( 'VG' ),
'version' => 'v1',
'rateLimit' => 1500,
'certified' => true,
// new metainfo interface
'has' => array (
'CORS' => false,
Expand Down
1 change: 1 addition & 0 deletions php/bitfinex2.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function describe () {
'name' => 'Bitfinex v2',
'countries' => array ( 'VG' ),
'version' => 'v2',
'certified' => false,
// new metainfo interface
'has' => array (
'CORS' => true,
Expand Down
1 change: 1 addition & 0 deletions php/bittrex.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function describe () {
'countries' => array ( 'US' ),
'version' => 'v1.1',
'rateLimit' => 1500,
'certified' => true,
// new metainfo interface
'has' => array (
'CORS' => true,
Expand Down
2 changes: 1 addition & 1 deletion php/btcmarkets.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function create_order ($symbol, $type, $side, $amount, $price = null, $pa
);
}

public function cancel_orders ($ids) {
public function cancel_orders ($ids, $symbol = null, $params = array ()) {
$this->load_markets();
for ($i = 0; $i < count ($ids); $i++) {
$ids[$i] = intval ($ids[$i]);
Expand Down
2 changes: 1 addition & 1 deletion php/coinfloor.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {
}

public function parse_order ($order, $market = null) {
$timestamp = $this->parse_date($order['datetime']);
$timestamp = $this->parse8601 ($order['datetime']);
$datetime = $this->iso8601 ($timestamp);
$price = $this->safe_float($order, 'price');
$amount = $this->safe_float($order, 'amount');
Expand Down
1 change: 1 addition & 0 deletions php/kraken.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function describe () {
'countries' => array ( 'US' ),
'version' => '0',
'rateLimit' => 3000,
'certified' => true,
'has' => array (
'createDepositAddress' => true,
'fetchDepositAddress' => true,
Expand Down
64 changes: 41 additions & 23 deletions php/liqui.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public function fetch_markets () {
$markets = $response['pairs'];
$keys = is_array ($markets) ? array_keys ($markets) : array ();
$result = array ();
for ($p = 0; $p < count ($keys); $p++) {
$id = $keys[$p];
for ($i = 0; $i < count ($keys); $i++) {
$id = $keys[$i];
$market = $markets[$id];
list ($base, $quote) = $this->get_base_quote_from_market_id ($id);
$symbol = $base . '/' . $quote;
Expand Down Expand Up @@ -197,12 +197,14 @@ public function fetch_order_book ($symbol, $limit = null, $params = array ()) {
$request = array (
'pair' => $market['id'],
);
if ($limit !== null)
if ($limit !== null) {
$request['limit'] = $limit; // default = 150, max = 2000
}
$response = $this->publicGetDepthPair (array_merge ($request, $params));
$market_id_in_reponse = (is_array ($response) && array_key_exists ($market['id'], $response));
if (!$market_id_in_reponse)
if (!$market_id_in_reponse) {
throw new ExchangeError ($this->id . ' ' . $market['symbol'] . ' order book is empty or not available');
}
$orderbook = $response[$market['id']];
return $this->parse_order_book($orderbook);
}
Expand Down Expand Up @@ -241,8 +243,9 @@ public function fetch_order_books ($symbols = null, $params = array ()) {
public function parse_ticker ($ticker, $market = null) {
$timestamp = $ticker['updated'] * 1000;
$symbol = null;
if ($market)
if ($market !== null) {
$symbol = $market['symbol'];
}
$last = $this->safe_float($ticker, 'last');
return array (
'symbol' => $symbol,
Expand Down Expand Up @@ -314,26 +317,31 @@ public function parse_trade ($trade, $market = null) {
if ($side === 'bid')
$side = 'buy';
$price = $this->safe_float($trade, 'price');
if (is_array ($trade) && array_key_exists ('rate', $trade))
if (is_array ($trade) && array_key_exists ('rate', $trade)) {
$price = $this->safe_float($trade, 'rate');
}
$id = $this->safe_string($trade, 'tid');
if (is_array ($trade) && array_key_exists ('trade_id', $trade))
if (is_array ($trade) && array_key_exists ('trade_id', $trade)) {
$id = $this->safe_string($trade, 'trade_id');
}
$order = $this->safe_string($trade, $this->get_order_id_key ());
if (is_array ($trade) && array_key_exists ('pair', $trade)) {
$marketId = $trade['pair'];
$market = $this->markets_by_id[$marketId];
}
$symbol = null;
if ($market)
if ($market !== null) {
$symbol = $market['symbol'];
}
$amount = $trade['amount'];
$type = 'limit'; // all trades are still limit trades
$isYourOrder = $this->safe_value($trade, 'is_your_order');
$takerOrMaker = 'taker';
if ($isYourOrder !== null)
if ($isYourOrder)
if ($isYourOrder !== null) {
if ($isYourOrder) {
$takerOrMaker = 'maker';
}
}
$fee = $this->calculate_fee($symbol, $type, $side, $amount, $price, $takerOrMaker);
return array (
'id' => $id,
Expand All @@ -356,15 +364,17 @@ public function fetch_trades ($symbol, $since = null, $limit = null, $params = a
$request = array (
'pair' => $market['id'],
);
if ($limit !== null)
if ($limit !== null) {
$request['limit'] = $limit;
}
$response = $this->publicGetTradesPair (array_merge ($request, $params));
return $this->parse_trades($response[$market['id']], $market, $since, $limit);
}

public function create_order ($symbol, $type, $side, $amount, $price = null, $params = array ()) {
if ($type === 'market')
if ($type === 'market') {
throw new ExchangeError ($this->id . ' allows limit orders only');
}
$this->load_markets();
$market = $this->market ($symbol);
$request = array (
Expand Down Expand Up @@ -417,13 +427,13 @@ public function get_order_id_key () {

public function cancel_order ($id, $symbol = null, $params = array ()) {
$this->load_markets();
$response = null;
$request = array ();
$idKey = $this->get_order_id_key ();
$request[$idKey] = $id;
$response = $this->privatePostCancelOrder (array_merge ($request, $params));
if (is_array ($this->orders) && array_key_exists ($id, $this->orders))
if (is_array ($this->orders) && array_key_exists ($id, $this->orders)) {
$this->orders[$id]['status'] = 'canceled';
}
return $response;
}

Expand All @@ -434,22 +444,26 @@ public function parse_order_status ($status) {
'2' => 'canceled',
'3' => 'canceled', // or partially-filled and still open? https://github.com/ccxt/ccxt/issues/1594
);
if (is_array ($statuses) && array_key_exists ($status, $statuses))
if (is_array ($statuses) && array_key_exists ($status, $statuses)) {
return $statuses[$status];
}
return $status;
}

public function parse_order ($order, $market = null) {
$id = (string) $order['id'];
$status = $this->safe_string($order, 'status');
if ($status !== 'null')
if ($status !== 'null') {
$status = $this->parse_order_status($status);
}
$timestamp = intval ($order['timestamp_created']) * 1000;
$symbol = null;
if (!$market)
if ($market === null) {
$market = $this->markets_by_id[$order['pair']];
if ($market)
}
if ($market !== null) {
$symbol = $market['symbol'];
}
$remaining = null;
$amount = null;
$price = $this->safe_float($order, 'rate');
Expand Down Expand Up @@ -544,8 +558,9 @@ public function update_cached_orders ($openOrders, $symbol) {
'remaining' => 0.0,
));
if ($cachedOrder['cost'] === null) {
if ($cachedOrder['filled'] !== null)
if ($cachedOrder['filled'] !== null) {
$cachedOrder['cost'] = $cachedOrder['filled'] * $cachedOrder['price'];
}
}
$this->orders[$cachedOrderId] = $cachedOrder;
}
Expand Down Expand Up @@ -603,14 +618,17 @@ public function fetch_my_trades ($symbol = null, $since = null, $limit = null, $
$market = $this->market ($symbol);
$request['pair'] = $market['id'];
}
if ($limit !== null)
if ($limit !== null) {
$request['count'] = intval ($limit);
if ($since !== null)
}
if ($since !== null) {
$request['since'] = intval ($since / 1000);
}
$response = $this->privatePostTradeHistory (array_merge ($request, $params));
$trades = array ();
if (is_array ($response) && array_key_exists ('return', $response))
if (is_array ($response) && array_key_exists ('return', $response)) {
$trades = $response['return'];
}
return $this->parse_trades($trades, $market, $since, $limit);
}

Expand Down Expand Up @@ -745,7 +763,7 @@ public function handle_errors ($httpCode, $reason, $url, $method, $headers, $bod
} else if ($message === 'external service unavailable') {
throw new ExchangeNotAvailable ($feedback);
} else {
throw new ExchangeError ($this->id . ' unknown "error" value => ' . $this->json ($response));
throw new ExchangeError ($feedback);
}
}
}
Expand Down
Loading

0 comments on commit 8fc2666

Please sign in to comment.