Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Fork #3

Merged
merged 30 commits into from
Oct 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dd575c5
hitbtc2: added taker/maker fees
mkutny Oct 20, 2017
da18e66
hitbtc2: fix for fetchOpenOrders()
mkutny Oct 20, 2017
9d20d2b
hitbtc2: switched to 'parseOrders()' of base class
mkutny Oct 20, 2017
d88d644
hitbtc2: parseOrder adapted for v2
mkutny Oct 20, 2017
dfc012b
fixing python transpilation errors
mkutny Oct 20, 2017
75a7bc2
fixing some more python transpilation errors...
mkutny Oct 20, 2017
96b8b29
btctradeua: fetchBalance(): error checking fixed
mkutny Oct 20, 2017
23025fc
btctradeua: nonce() is compatible with ratelimit
mkutny Oct 20, 2017
94af0a6
btctradeua: fetchOpenOrders() implemented
mkutny Oct 20, 2017
8c7a166
cex.io: maker/taker fees, presition, limits added and nonce() fixed
mkutny Oct 20, 2017
9f97d40
btctradeua: seems like copypasting error during cherrypicking...
mkutny Oct 20, 2017
9b19180
error reporting in tests fixed
kroitor Oct 20, 2017
6309437
Merge branch 'master' of https://github.com/ccxt-dev/ccxt
kroitor Oct 20, 2017
b03a980
bter fix
kroitor Oct 20, 2017
a406e17
1.9.216
Oct 20, 2017
8d8fd51
Merge pull request #363 from mkutny/btctradeua
kroitor Oct 20, 2017
ca7cb2f
1.9.217
Oct 20, 2017
a2969c7
added Math.log* support to transpiler, #362, #364
kroitor Oct 20, 2017
e8e3995
Merge branch 'master' of https://github.com/ccxt-dev/ccxt
kroitor Oct 20, 2017
8a0c37b
1.9.218
Oct 20, 2017
3eaa440
Merge pull request #362 from mkutny/hitbtc2
kroitor Oct 20, 2017
50fd4c9
hitbtc2 quickfix for python #362
kroitor Oct 20, 2017
0b97e88
1.9.219
Oct 20, 2017
eede78e
nested arrays transpile fix to hitbtc2 for php #362
kroitor Oct 20, 2017
b1d2a08
Merge branch 'master' of https://github.com/ccxt-dev/ccxt
kroitor Oct 20, 2017
1738bd2
1.9.220
Oct 20, 2017
b2297f9
Merge branch 'cexio' of https://github.com/mkutny/ccxt into mkutny-cexio
kroitor Oct 20, 2017
fbbed63
minor edit for php to survive #364
kroitor Oct 20, 2017
a41c9c7
Merge branch 'mkutny-cexio'
kroitor Oct 20, 2017
07c48e5
1.9.221
Oct 20, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 129 additions & 21 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

148 changes: 128 additions & 20 deletions build/ccxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DDoSProtection extends NetworkError {}
class RequestTimeout extends NetworkError {}
class ExchangeNotAvailable extends NetworkError {}

$version = '1.9.215';
$version = '1.9.221';

$curl_errors = array (
0 => 'CURLE_OK',
Expand Down Expand Up @@ -9434,12 +9434,6 @@ public function sign_in () {

public function fetch_balance ($params = array ()) {
$response = $this->privatePostBalance ();
if (array_key_exists ('status', $response)) {
if (!$response['status'])
throw new ExchangeError ($this->id . ' ' . $this->json ($response));
} else {
throw new ExchangeError ($this->id . ' ' . $this->json ($response));
}
$result = array ( 'info' => $response );
if (array_key_exists ('accounts', $response)) {
$accounts = $response['accounts'];
Expand Down Expand Up @@ -9579,6 +9573,40 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {
return $this->privatePostRemoveOrderId (array ( 'id' => $id ));
}

public function parse_order ($trade, $market) {
$timestamp = $this->milliseconds;
return array (
'id' => $trade['id'],
'timestamp' => $timestamp, // until they fix their $timestamp
'datetime' => $this->iso8601 ($timestamp),
'status' => 'open',
'symbol' => $market['symbol'],
'type' => null,
'side' => $trade['type'],
'price' => $trade['price'],
'amount' => $trade['amnt_trade'],
'filled' => 0,
'remaining' => $trade['amnt_trade'],
'trades' => null,
'info' => $trade,
);
}

public function fetch_open_orders ($symbol = null, $params = array ()) {
if (!$symbol)
throw new ExchangeError ($this->id . ' fetchOpenOrders requires a $symbol param');
$market = $this->market ($symbol);
$response = $this->privatePostMyOrdersSymbol (array_merge (array (
'symbol' => $market['id'],
), $params));
$orders = $response['your_open_orders'];
return $this->parse_orders ($orders, $market);
}

public function nonce () {
return $this->milliseconds ();
}

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));
Expand Down Expand Up @@ -9991,7 +10019,7 @@ public function fetch_ticker ($symbol, $params = array ()) {
}

public function parse_trade ($trade, $market) {
$timestamp = intval ($trade['timestamp']) * 1000;
$timestamp = $this->parse8601 ($trade['date']);
return array (
'id' => $trade['tradeID'],
'info' => $trade,
Expand Down Expand Up @@ -10636,6 +10664,12 @@ public function __construct ($options = array ()) {
),
)
),
'fees' => array (
'trading' => array (
'maker' => 0,
'taker' => 0.2 / 100,
),
),
), $options));
}

Expand All @@ -10647,11 +10681,29 @@ public function fetch_markets () {
$id = $market['symbol1'] . '/' . $market['symbol2'];
$symbol = $id;
list ($base, $quote) = explode ('/', $symbol);
$precision = array (
'price' => 4,
'amount' => -1 * log10 ($market['minLotSize']),
);
$amountLimits = array (
'min' => $market['minLotSize'],
'max' => $market['maxLotSize'],
);
$priceLimits = array (
'min' => $market['minPrice'],
'max' => $market['maxPrice'],
);
$limits = array (
'amount' => $amountLimits,
'price' => $priceLimits,
);
$result[] = array (
'id' => $id,
'symbol' => $symbol,
'base' => $base,
'quote' => $quote,
'precision' => $precision,
'limits' => $limits,
'info' => $market,
);
}
Expand Down Expand Up @@ -10919,6 +10971,10 @@ public function fetch_open_orders ($symbol = null, $params = array ()) {
return $this->parse_orders ($orders, $market);
}

public function nonce () {
return $this->milliseconds ();
}

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));
Expand Down Expand Up @@ -15206,17 +15262,6 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {
), $params));
}

public function parse_orders ($orders, $market = null) {
$result = array ();
$ids = array_keys ($orders);
for ($i = 0; $i < count ($ids); $i++) {
$id = $ids[$i];
$order = array_merge (array ( 'id' => $id ), $orders[$id]);
$result[] = $this->parse_order ($order, $market);
}
return $result;
}

public function getOrderStatus ($status) {
$statuses = array (
'new' => 'open',
Expand Down Expand Up @@ -15440,6 +15485,12 @@ public function __construct ($options = array ()) {
),
),
),
'fees' => array (
'trading' => array (
'maker' => 0.0 / 100,
'taker' => 0.1 / 100,
),
),
), $options));
}

Expand All @@ -15452,10 +15503,16 @@ public function fetch_markets () {
$base = $market['baseCurrency'];
$quote = $market['quoteCurrency'];
$lot = $market['quantityIncrement'];
$step = $market['tickSize'];
$step = floatval ($market['tickSize']);
$base = $this->common_currency_code ($base);
$quote = $this->common_currency_code ($quote);
$symbol = $base . '/' . $quote;
$precision = array (
'price' => 2,
'amount' => -1 * log10($step),
);
$amountLimits = array ( 'min' => $lot );
$limits = array ( 'amount' => $amountLimits );
$result[] = array (
'id' => $id,
'symbol' => $symbol,
Expand All @@ -15464,6 +15521,8 @@ public function fetch_markets () {
'lot' => $lot,
'step' => $step,
'info' => $market,
'precision' => $precision,
'limits' => $limits,
);
}
return $result;
Expand Down Expand Up @@ -15604,6 +15663,55 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {
), $params));
}

public function parse_order ($order, $market = null) {
$lastTime = $this->parse8601 ($order['updatedAt']);
$timestamp = $lastTime.getTime();

if (!$market)
$market = $this->markets_by_id[$order['symbol']];
$symbol = $market['symbol'];

$amount = $order['quantity'];
$filled = $order['cumQuantity'];
$remaining = $amount - $filled;

return array (
'id' => (string) $order['clientOrderId'],
'timestamp' => $timestamp,
'datetime' => $this->iso8601 ($timestamp),
'status' => $order['status'],
'symbol' => $symbol,
'type' => $order['type'],
'side' => $order['side'],
'price' => $order['price'],
'amount' => $amount,
'filled' => $filled,
'remaining' => $remaining,
'fee' => null,
'info' => $order,
);
}

public function fetch_order ($id, $symbol = null, $params = array ()) {
$this->load_markets ();
$response = $this->privateGetOrder (array_merge (array (
'client_order_id' => $id,
), $params));
return $this->parse_order ($response['orders'][0]);
}

public function fetch_open_orders ($symbol = null, $params = array ()) {
$this->load_markets ();
$market = null;
if ($symbol) {
$market = $this->market ($symbol);
$params = array_merge (array ('symbol' => $market['id']));
}
$response = $this->privateGetOrder ($params);

return $this->parse_orders ($response, $market);
}

public function withdraw ($currency, $amount, $address, $params = array ()) {
$this->load_markets ();
$amount = floatval ($amount);
Expand Down
Loading