Skip to content

Commit

Permalink
1.10.859
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jan 27, 2018
1 parent 96cce9b commit ae3d7f0
Show file tree
Hide file tree
Showing 17 changed files with 214 additions and 126 deletions.
93 changes: 58 additions & 35 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.858'
const version = '1.10.859'

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

abstract class Exchange {

Expand Down
23 changes: 19 additions & 4 deletions php/binance.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,29 @@ public function describe () {
),
),
),
'security' => array (
'recvWindow' => 100 * 1000, // 100 sec
),
// exchange-specific options
'recvWindow' => 100 * 1000, // 100 sec
'timeDifference' => 0, // the difference between system clock and Binance clock
'adjustForTimeDifference' => false, // controls the adjustment logic upon instantiation
));
}

public function milliseconds () {
return parent::milliseconds () - $this->timeDelta;
}

public function load_time_difference () {
$before = $this->milliseconds ();
$response = $this->publicGetTime ();
$after = $this->milliseconds ();
$this->timeDifference = ($before . $after) / 2 - $response['serverTime'];
return $this->timeDifference;
}

public function fetch_markets () {
$response = $this->publicGetExchangeInfo ();
if ($this->adjustForTimeDifference)
$this->load_time_difference ();
$markets = $response['symbols'];
$result = array ();
for ($i = 0; $i < count ($markets); $i++) {
Expand Down Expand Up @@ -795,7 +810,7 @@ public function sign ($path, $api = 'public', $method = 'GET', $params = array (
$nonce = $this->milliseconds ();
$query = $this->urlencode (array_merge (array (
'timestamp' => $nonce,
'recvWindow' => $this->security['recvWindow'],
'recvWindow' => $this->recvWindow,
), $params));
$signature = $this->hmac ($this->encode ($query), $this->encode ($this->secret));
$query .= '&' . 'signature=' . $signature;
Expand Down
60 changes: 34 additions & 26 deletions php/bitcoincoid.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,35 @@ public function describe () {
),
),
'markets' => array (
'BTC/IDR' => array ( 'id' => 'btc_idr', 'symbol' => 'BTC/IDR', 'base' => 'BTC', 'quote' => 'IDR', 'baseId' => 'btc', 'quoteId' => 'idr' ),
'BCH/IDR' => array ( 'id' => 'bch_idr', 'symbol' => 'BCH/IDR', 'base' => 'BCH', 'quote' => 'IDR', 'baseId' => 'bch', 'quoteId' => 'idr' ),
'BTG/IDR' => array ( 'id' => 'btg_idr', 'symbol' => 'BTG/IDR', 'base' => 'BTG', 'quote' => 'IDR', 'baseId' => 'btg', 'quoteId' => 'idr' ),
'ETH/IDR' => array ( 'id' => 'eth_idr', 'symbol' => 'ETH/IDR', 'base' => 'ETH', 'quote' => 'IDR', 'baseId' => 'eth', 'quoteId' => 'idr' ),
'ETC/IDR' => array ( 'id' => 'etc_idr', 'symbol' => 'ETC/IDR', 'base' => 'ETC', 'quote' => 'IDR', 'baseId' => 'etc', 'quoteId' => 'idr' ),
'IGNIS/IDR' => array ( 'id' => 'ignis_idr', 'symbol' => 'IGNIS/IDR', 'base' => 'IGNIS', 'quote' => 'IDR', 'baseId' => 'ignis', 'quoteId' => 'idr' ),
'LTC/IDR' => array ( 'id' => 'ltc_idr', 'symbol' => 'LTC/IDR', 'base' => 'LTC', 'quote' => 'IDR', 'baseId' => 'ltc', 'quoteId' => 'idr' ),
'NXT/IDR' => array ( 'id' => 'nxt_idr', 'symbol' => 'NXT/IDR', 'base' => 'NXT', 'quote' => 'IDR', 'baseId' => 'nxt', 'quoteId' => 'idr' ),
'WAVES/IDR' => array ( 'id' => 'waves_idr', 'symbol' => 'WAVES/IDR', 'base' => 'WAVES', 'quote' => 'IDR', 'baseId' => 'waves', 'quoteId' => 'idr' ),
'XRP/IDR' => array ( 'id' => 'xrp_idr', 'symbol' => 'XRP/IDR', 'base' => 'XRP', 'quote' => 'IDR', 'baseId' => 'xrp', 'quoteId' => 'idr' ),
'XZC/IDR' => array ( 'id' => 'xzc_idr', 'symbol' => 'XZC/IDR', 'base' => 'XZC', 'quote' => 'IDR', 'baseId' => 'xzc', 'quoteId' => 'idr' ),
'XLM/IDR' => array ( 'id' => 'str_idr', 'symbol' => 'XLM/IDR', 'base' => 'XLM', 'quote' => 'IDR', 'baseId' => 'str', 'quoteId' => 'idr' ),
'BTS/BTC' => array ( 'id' => 'bts_btc', 'symbol' => 'BTS/BTC', 'base' => 'BTS', 'quote' => 'BTC', 'baseId' => 'bts', 'quoteId' => 'btc' ),
'DASH/BTC' => array ( 'id' => 'drk_btc', 'symbol' => 'DASH/BTC', 'base' => 'DASH', 'quote' => 'BTC', 'baseId' => 'drk', 'quoteId' => 'btc' ),
'DOGE/BTC' => array ( 'id' => 'doge_btc', 'symbol' => 'DOGE/BTC', 'base' => 'DOGE', 'quote' => 'BTC', 'baseId' => 'doge', 'quoteId' => 'btc' ),
'ETH/BTC' => array ( 'id' => 'eth_btc', 'symbol' => 'ETH/BTC', 'base' => 'ETH', 'quote' => 'BTC', 'baseId' => 'eth', 'quoteId' => 'btc' ),
'LTC/BTC' => array ( 'id' => 'ltc_btc', 'symbol' => 'LTC/BTC', 'base' => 'LTC', 'quote' => 'BTC', 'baseId' => 'ltc', 'quoteId' => 'btc' ),
'NXT/BTC' => array ( 'id' => 'nxt_btc', 'symbol' => 'NXT/BTC', 'base' => 'NXT', 'quote' => 'BTC', 'baseId' => 'nxt', 'quoteId' => 'btc' ),
'XLM/BTC' => array ( 'id' => 'str_btc', 'symbol' => 'XLM/BTC', 'base' => 'XLM', 'quote' => 'BTC', 'baseId' => 'str', 'quoteId' => 'btc' ),
'XEM/BTC' => array ( 'id' => 'nem_btc', 'symbol' => 'XEM/BTC', 'base' => 'XEM', 'quote' => 'BTC', 'baseId' => 'nem', 'quoteId' => 'btc' ),
'XRP/BTC' => array ( 'id' => 'xrp_btc', 'symbol' => 'XRP/BTC', 'base' => 'XRP', 'quote' => 'BTC', 'baseId' => 'xrp', 'quoteId' => 'btc' ),
'BTC/IDR' => array ( 'id' => 'btc_idr', 'symbol' => 'BTC/IDR', 'base' => 'BTC', 'quote' => 'IDR', 'baseId' => 'btc', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.0001, 'max' => null ))),
'BCH/IDR' => array ( 'id' => 'bch_idr', 'symbol' => 'BCH/IDR', 'base' => 'BCH', 'quote' => 'IDR', 'baseId' => 'bch', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.001, 'max' => null ))),
'BTG/IDR' => array ( 'id' => 'btg_idr', 'symbol' => 'BTG/IDR', 'base' => 'BTG', 'quote' => 'IDR', 'baseId' => 'btg', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'ETH/IDR' => array ( 'id' => 'eth_idr', 'symbol' => 'ETH/IDR', 'base' => 'ETH', 'quote' => 'IDR', 'baseId' => 'eth', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'ETC/IDR' => array ( 'id' => 'etc_idr', 'symbol' => 'ETC/IDR', 'base' => 'ETC', 'quote' => 'IDR', 'baseId' => 'etc', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.1, 'max' => null ))),
'IGNIS/IDR' => array ( 'id' => 'ignis_idr', 'symbol' => 'IGNIS/IDR', 'base' => 'IGNIS', 'quote' => 'IDR', 'baseId' => 'ignis', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 1, 'max' => null ))),
'LTC/IDR' => array ( 'id' => 'ltc_idr', 'symbol' => 'LTC/IDR', 'base' => 'LTC', 'quote' => 'IDR', 'baseId' => 'ltc', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'NXT/IDR' => array ( 'id' => 'nxt_idr', 'symbol' => 'NXT/IDR', 'base' => 'NXT', 'quote' => 'IDR', 'baseId' => 'nxt', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 5, 'max' => null ))),
'WAVES/IDR' => array ( 'id' => 'waves_idr', 'symbol' => 'WAVES/IDR', 'base' => 'WAVES', 'quote' => 'IDR', 'baseId' => 'waves', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.1, 'max' => null ))),
'XRP/IDR' => array ( 'id' => 'xrp_idr', 'symbol' => 'XRP/IDR', 'base' => 'XRP', 'quote' => 'IDR', 'baseId' => 'xrp', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 10, 'max' => null ))),
'XZC/IDR' => array ( 'id' => 'xzc_idr', 'symbol' => 'XZC/IDR', 'base' => 'XZC', 'quote' => 'IDR', 'baseId' => 'xzc', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 0.1, 'max' => null ))),
'XLM/IDR' => array ( 'id' => 'str_idr', 'symbol' => 'XLM/IDR', 'base' => 'XLM', 'quote' => 'IDR', 'baseId' => 'str', 'quoteId' => 'idr', 'limits' => array ( 'amount' => array ( 'min' => 20, 'max' => null ))),
'BTS/BTC' => array ( 'id' => 'bts_btc', 'symbol' => 'BTS/BTC', 'base' => 'BTS', 'quote' => 'BTC', 'baseId' => 'bts', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'DASH/BTC' => array ( 'id' => 'drk_btc', 'symbol' => 'DASH/BTC', 'base' => 'DASH', 'quote' => 'BTC', 'baseId' => 'drk', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'DOGE/BTC' => array ( 'id' => 'doge_btc', 'symbol' => 'DOGE/BTC', 'base' => 'DOGE', 'quote' => 'BTC', 'baseId' => 'doge', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 1, 'max' => null ))),
'ETH/BTC' => array ( 'id' => 'eth_btc', 'symbol' => 'ETH/BTC', 'base' => 'ETH', 'quote' => 'BTC', 'baseId' => 'eth', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 0.001, 'max' => null ))),
'LTC/BTC' => array ( 'id' => 'ltc_btc', 'symbol' => 'LTC/BTC', 'base' => 'LTC', 'quote' => 'BTC', 'baseId' => 'ltc', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'NXT/BTC' => array ( 'id' => 'nxt_btc', 'symbol' => 'NXT/BTC', 'base' => 'NXT', 'quote' => 'BTC', 'baseId' => 'nxt', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'XLM/BTC' => array ( 'id' => 'str_btc', 'symbol' => 'XLM/BTC', 'base' => 'XLM', 'quote' => 'BTC', 'baseId' => 'str', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
'XEM/BTC' => array ( 'id' => 'nem_btc', 'symbol' => 'XEM/BTC', 'base' => 'XEM', 'quote' => 'BTC', 'baseId' => 'nem', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 1, 'max' => null ))),
'XRP/BTC' => array ( 'id' => 'xrp_btc', 'symbol' => 'XRP/BTC', 'base' => 'XRP', 'quote' => 'BTC', 'baseId' => 'xrp', 'quoteId' => 'btc', 'limits' => array ( 'amount' => array ( 'min' => 0.01, 'max' => null ))),
),
'fees' => array (
'trading' => array (
'tierBased' => false,
'percentage' => true,
'maker' => 0,
'taker' => 0.3,
),
),
));
}
Expand Down Expand Up @@ -169,9 +177,9 @@ public function parse_order ($order, $market = null) {
if (is_array ($order) && array_key_exists ('type', $order))
$side = $order['type'];
$status = $this->safe_string($order, 'status', 'open');
if ($status == 'filled') {
if ($status === 'filled') {
$status = 'closed';
} else if ($status == 'calcelled') {
} else if ($status === 'calcelled') {
$status = 'canceled';
}
$symbol = null;
Expand All @@ -184,9 +192,9 @@ public function parse_order ($order, $market = null) {
$symbol = $market['symbol'];
$quoteId = $market['quoteId'];
$baseId = $market['baseId'];
if (($market['quoteId'] == 'idr') && (is_array ($order) && array_key_exists ('order_rp', $order)))
if (($market['quoteId'] === 'idr') && (is_array ($order) && array_key_exists ('order_rp', $order)))
$quoteId = 'rp';
if (($market['baseId'] == 'idr') && (is_array ($order) && array_key_exists ('remain_rp', $order)))
if (($market['baseId'] === 'idr') && (is_array ($order) && array_key_exists ('remain_rp', $order)))
$baseId = 'rp';
$cost = $this->safe_float($order, 'order_' . $quoteId);
if ($cost) {
Expand Down Expand Up @@ -299,7 +307,7 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {

public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
$url = $this->urls['api'][$api];
if ($api == 'public') {
if ($api === 'public') {
$url .= '/' . $this->implode_params($path, $params);
} else {
$this->check_required_credentials();
Expand Down
4 changes: 2 additions & 2 deletions php/huobipro.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ public function fetch_orders ($symbol = null, $since = null, $limit = null, $par
} else if (is_array ($params) && array_key_exists ('status', $params)) {
$status = $params['status'];
} else {
throw new ExchangeError ($this->id . ' fetchOrders() requires type param or $status param for spot $market ' . $symbol . '(0 or "open" for unfilled or partial filled orders, 1 or "closed" for filled orders)');
throw new ExchangeError ($this->id . ' fetchOrders() requires a type param or $status param for spot $market ' . $symbol . ' (0 or "open" for unfilled or partial filled orders, 1 or "closed" for filled orders)');
}
if (($status === 0) || ($status === 'open')) {
$status = 'submitted,partial-filled';
} else if (($status === 1) || ($status === 'closed')) {
$status = 'filled,partial-canceled';
} else {
throw new ExchangeError ($this->id . ' fetchOrders() wrong type param or $status param for spot $market ' . $symbol . '(0 or "open" for unfilled or partial filled orders, 1 or "closed" for filled orders)');
throw new ExchangeError ($this->id . ' fetchOrders() wrong type param or $status param for spot $market ' . $symbol . ' (0 or "open" for unfilled or partial filled orders, 1 or "closed" for filled orders)');
}
$response = $this->privateGetOrderOrders (array_merge (array (
'symbol' => $market['id'],
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.858'
__version__ = '1.10.859'

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

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.858'
__version__ = '1.10.859'

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

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.858'
__version__ = '1.10.859'

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

Expand Down
21 changes: 17 additions & 4 deletions python/ccxt/async/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,26 @@ def describe(self):
},
},
},
'security': {
'recvWindow': 100 * 1000, # 100 sec
},
# exchange-specific options
'recvWindow': 100 * 1000, # 100 sec
'timeDifference': 0, # the difference between system clock and Binance clock
'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
})

def milliseconds(self):
return super(binance, self).milliseconds() - self.timeDelta

async def load_time_difference(self):
before = self.milliseconds()
response = await self.publicGetTime()
after = self.milliseconds()
self.timeDifference = (before + after) / 2 - response['serverTime']
return self.timeDifference

async def fetch_markets(self):
response = await self.publicGetExchangeInfo()
if self.adjustForTimeDifference:
await self.load_time_difference()
markets = response['symbols']
result = []
for i in range(0, len(markets)):
Expand Down Expand Up @@ -762,7 +775,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N
nonce = self.milliseconds()
query = self.urlencode(self.extend({
'timestamp': nonce,
'recvWindow': self.security['recvWindow'],
'recvWindow': self.recvWindow,
}, params))
signature = self.hmac(self.encode(query), self.encode(self.secret))
query += '&' + 'signature=' + signature
Expand Down
Loading

0 comments on commit ae3d7f0

Please sign in to comment.