Skip to content

Commit

Permalink
1.10.742
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jan 17, 2018
1 parent 144e25b commit b7338cd
Show file tree
Hide file tree
Showing 24 changed files with 224 additions and 204 deletions.
151 changes: 78 additions & 73 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.741'
const version = '1.10.742'

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.741",
"version": "1.10.742",
"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.741';
$version = '1.10.742';

abstract class Exchange {

Expand Down
28 changes: 14 additions & 14 deletions php/binance.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function fetch_markets () {
'amount' => $market['baseAssetPrecision'],
'price' => $market['quotePrecision'],
);
$active = ($market['status'] == 'TRADING');
$active = ($market['status'] === 'TRADING');
$lot = -1 * log10 ($precision['amount']);
$entry = array_merge ($this->fees['trading'], array (
'id' => $id,
Expand Down Expand Up @@ -373,7 +373,7 @@ public function calculate_fee ($symbol, $type, $side, $amount, $price, $takerOrM
$key = 'quote';
$rate = $market[$takerOrMaker];
$cost = floatval ($this->cost_to_precision($symbol, $amount * $rate));
if ($side == 'sell') {
if ($side === 'sell') {
$cost *= $price;
} else {
$key = 'base';
Expand Down Expand Up @@ -579,13 +579,13 @@ public function fetch_trades ($symbol, $since = null, $limit = null, $params = a
}

public function parse_order_status ($status) {
if ($status == 'NEW')
if ($status === 'NEW')
return 'open';
if ($status == 'PARTIALLY_FILLED')
if ($status === 'PARTIALLY_FILLED')
return 'open';
if ($status == 'FILLED')
if ($status === 'FILLED')
return 'closed';
if ($status == 'CANCELED')
if ($status === 'CANCELED')
return 'canceled';
return strtolower ($status);
}
Expand Down Expand Up @@ -641,7 +641,7 @@ public function create_order ($symbol, $type, $side, $amount, $price = null, $pa
'type' => strtoupper ($type),
'side' => strtoupper ($side),
);
if ($type == 'limit') {
if ($type === 'limit') {
$order = array_merge ($order, array (
'price' => $this->price_to_precision($symbol, $price),
'timeInForce' => 'GTC', // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
Expand Down Expand Up @@ -732,13 +732,13 @@ public function fetch_my_trades ($symbol = null, $since = null, $limit = null, $
}

public function common_currency_code ($currency) {
if ($currency == 'BCC')
if ($currency === 'BCC')
return 'BCH';
return $currency;
}

public function currency_id ($currency) {
if ($currency == 'BCH')
if ($currency === 'BCH')
return 'BCC';
return $currency;
}
Expand Down Expand Up @@ -813,7 +813,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (

public function handle_errors ($code, $reason, $url, $method, $headers, $body) {
if ($code >= 400) {
if ($code == 418)
if ($code === 418)
throw new DDoSProtection ($this->id . ' ' . (string) $code . ' ' . $reason . ' ' . $body);
if (mb_strpos ($body, 'Price * QTY is zero or less') !== false)
throw new InvalidOrder ($this->id . ' order cost = amount * price is zero or less ' . $body);
Expand All @@ -826,15 +826,15 @@ public function handle_errors ($code, $reason, $url, $method, $headers, $body) {
if (mb_strpos ($body, 'Order does not exist') !== false)
throw new OrderNotFound ($this->id . ' ' . $body);
}
if ($body[0] == "{") {
if ($body[0] === '{') {
$response = json_decode ($body, $as_associative_array = true);
$error = $this->safe_value($response, 'code');
if ($error !== null) {
if ($error == -2010) {
if ($error === -2010) {
throw new InsufficientFunds ($this->id . ' ' . $this->json ($response));
} else if ($error == -2011) {
} else if ($error === -2011) {
throw new OrderNotFound ($this->id . ' ' . $this->json ($response));
} else if ($error == -1013) { // Invalid quantity
} else if ($error === -1013) { // Invalid quantity
throw new InvalidOrder ($this->id . ' ' . $this->json ($response));
}
}
Expand Down
8 changes: 4 additions & 4 deletions php/bitfinex2.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ public function fetch_balance ($params = array ()) {
for ($b = 0; $b < count ($response); $b++) {
$balance = $response[$b];
list ($accountType, $currency, $total, $interest, $available) = $balance;
if ($accountType == $balanceType) {
if ($currency[0] == 't')
if ($accountType === $balanceType) {
if ($currency[0] === 't')
$currency = mb_substr ($currency, 1);
$uppercase = strtoupper ($currency);
$uppercase = $this->common_currency_code($uppercase);
Expand Down Expand Up @@ -392,7 +392,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
$request = $this->version . '/' . $this->implode_params($path, $params);
$query = $this->omit ($params, $this->extract_params($path));
$url = $this->urls['api'] . '/' . $request;
if ($api == 'public') {
if ($api === 'public') {
if ($query) {
$url .= '?' . $this->urlencode ($query);
}
Expand Down Expand Up @@ -421,7 +421,7 @@ public function request ($path, $api = 'public', $method = 'GET', $params = arra
throw new ExchangeError ($this->id . ' ' . $this->json ($response));
}
return $response;
} else if ($response == '') {
} else if ($response === '') {
throw new ExchangeError ($this->id . ' returned empty response');
}
return $response;
Expand Down
69 changes: 36 additions & 33 deletions php/cryptopia.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,35 @@ public function describe () {
}

public function common_currency_code ($currency) {
if ($currency == 'CC')
return 'CCX';
if ($currency == 'FCN')
return 'Facilecoin';
if ($currency == 'NET')
return 'NetCoin';
if ($currency == 'BTG')
return 'Bitgem';
if ($currency == 'FUEL')
return 'FC2'; // FuelCoin != FUEL
if ($currency == 'WRC')
return 'WarCoin';
$currencies = array (
'ACC' => 'AdCoin',
'CC' => 'CCX',
'CMT' => 'Comet',
'FCN' => 'Facilecoin',
'NET' => 'NetCoin',
'BTG' => 'Bitgem',
'FUEL' => 'FC2', // FuelCoin != FUEL
'QBT' => 'Cubits',
'WRC' => 'WarCoin',
);
if (is_array ($currencies) && array_key_exists ($currency, $currencies))
return $currencies[$currency];
return $currency;
}

public function currency_id ($currency) {
if ($currency == 'CCX')
return 'CC';
if ($currency == 'Facilecoin')
return 'FCN';
if ($currency == 'NetCoin')
return 'NET';
if ($currency == 'Bitgem')
return 'BTG';
if ($currency == 'FC2')
return 'FUEL'; // FuelCoin != FUEL
$currencies = array (
'AdCoin' => 'ACC',
'CCX' => 'CC',
'Comet' => 'CMT',
'Cubits' => 'QBT',
'Facilecoin' => 'FCN',
'NetCoin' => 'NET',
'Bitgem' => 'BTG',
'FC2' => 'FUEL',
);
if (is_array ($currencies) && array_key_exists ($currency, $currencies))
return $currencies[$currency];
return $currency;
}

Expand Down Expand Up @@ -137,7 +140,7 @@ public function fetch_markets () {
'amount' => $amountLimits,
'price' => $priceLimits,
);
$active = $market['Status'] == 'OK';
$active = $market['Status'] === 'OK';
$result[] = array (
'id' => $id,
'symbol' => $symbol,
Expand Down Expand Up @@ -305,9 +308,9 @@ public function fetch_currencies ($params = array ()) {
// differentiated fees for each particular method
$precision = 8; // default $precision, todo => fix "magic constants"
$code = $this->common_currency_code($id);
$active = ($currency['ListingStatus'] == 'Active');
$active = ($currency['ListingStatus'] === 'Active');
$status = strtolower ($currency['Status']);
if ($status != 'ok')
if ($status !== 'ok')
$active = false;
$result[$code] = array (
'id' => $id,
Expand Down Expand Up @@ -362,7 +365,7 @@ public function fetch_balance ($params = array ()) {
}

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);
Expand Down Expand Up @@ -501,7 +504,7 @@ public function fetch_orders ($symbol = null, $since = null, $limit = null, $par
$this->orders[$id] = array_merge ($this->orders[$id], $openOrdersIndexedById[$id]);
} else {
$order = $this->orders[$id];
if ($order['status'] == 'open') {
if ($order['status'] === 'open') {
$this->orders[$id] = array_merge ($order, array (
'status' => 'closed',
'cost' => $order['amount'] * $order['price'],
Expand All @@ -511,7 +514,7 @@ public function fetch_orders ($symbol = null, $since = null, $limit = null, $par
}
}
$order = $this->orders[$id];
if ($order['symbol'] == $symbol)
if ($order['symbol'] === $symbol)
$result[] = $order;
}
return $this->filter_by_since_limit($result, $since, $limit);
Expand All @@ -521,7 +524,7 @@ public function fetch_order ($id, $symbol = null, $params = array ()) {
$id = (string) $id;
$orders = $this->fetch_orders($symbol, null, null, $params);
for ($i = 0; $i < count ($orders); $i++) {
if ($orders[$i]['id'] == $id)
if ($orders[$i]['id'] === $id)
return $orders[$i];
}
throw new OrderNotCached ($this->id . ' order ' . $id . ' not found in cached .orders, fetchOrder requires .orders (de)serialization implemented for this method to work properly');
Expand All @@ -531,7 +534,7 @@ public function fetch_open_orders ($symbol = null, $since = null, $limit = null,
$orders = $this->fetch_orders($symbol, $params);
$result = array ();
for ($i = 0; $i < count ($orders); $i++) {
if ($orders[$i]['status'] == 'open')
if ($orders[$i]['status'] === 'open')
$result[] = $orders[$i];
}
return $result;
Expand All @@ -541,7 +544,7 @@ public function fetch_closed_orders ($symbol = null, $since = null, $limit = nul
$orders = $this->fetch_orders($symbol, $params);
$result = array ();
for ($i = 0; $i < count ($orders); $i++) {
if ($orders[$i]['status'] == 'closed')
if ($orders[$i]['status'] === 'closed')
$result[] = $orders[$i];
}
return $result;
Expand Down Expand Up @@ -579,7 +582,7 @@ public function withdraw ($currency, $amount, $address, $params = array ()) {
public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
$url = $this->urls['api'] . '/' . $this->implode_params($path, $params);
$query = $this->omit ($params, $this->extract_params($path));
if ($api == 'public') {
if ($api === 'public') {
if ($query)
$url .= '?' . $this->urlencode ($query);
} else {
Expand Down Expand Up @@ -608,7 +611,7 @@ public function request ($path, $api = 'public', $method = 'GET', $params = arra
if ($response['Success']) {
return $response;
} else if (is_array ($response) && array_key_exists ('Error', $response)) {
if ($response['Error'] == 'Insufficient Funds.')
if ($response['Error'] === 'Insufficient Funds.')
throw new InsufficientFunds ($this->id . ' ' . $this->json ($response));
}
}
Expand Down
4 changes: 2 additions & 2 deletions php/hitbtc.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ public function describe () {
'ZSC' => 191,
),
'deposit' => array (
'BTC' => 0,
'ETH' => 0,
'BTC' => 0.0006,
'ETH' => 0.003,
'BCH' => 0,
'USDT' => 0,
'BTG' => 0,
Expand Down
4 changes: 2 additions & 2 deletions php/hitbtc2.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ public function describe () {
'ZSC' => 191,
),
'deposit' => array (
'BTC' => 0.0003,
'ETH' => 0,
'BTC' => 0.0006,
'ETH' => 0.003,
'BCH' => 0,
'USDT' => 0,
'BTG' => 0,
Expand Down
Loading

0 comments on commit b7338cd

Please sign in to comment.