Skip to content

Commit

Permalink
1.12.37
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Mar 29, 2018
1 parent e093fae commit aff1613
Show file tree
Hide file tree
Showing 11 changed files with 373 additions and 225 deletions.
152 changes: 94 additions & 58 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.12.36'
const version = '1.12.37'

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

// rounding mode
const TRUNCATE = 0;
Expand Down
148 changes: 92 additions & 56 deletions php/kucoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,28 @@ public function fetch_order ($id, $symbol = null, $params = array ()) {
$response = $this->privateGetOrderDetail (array_merge ($request, $params));
if (!$response['data'])
throw new OrderNotFound ($this->id . ' ' . $this->json ($response));
$order = $this->parse_order($response['data'], $market);
$orderId = $order['id'];
if (is_array ($this->orders) && array_key_exists ($orderId, $this->orders))
$order['status'] = $this->orders[$orderId]['status'];
$this->orders[$orderId] = $order;
return $order;
//
// the caching part to be removed
//
// $order = $this->parse_order($response['data'], $market);
// $orderId = $order['id'];
// if (is_array ($this->orders) && array_key_exists ($orderId, $this->orders))
// $order['status'] = $this->orders[$orderId]['status'];
// $this->orders[$orderId] = $order;
//
return $this->parse_order($response['data'], $market);
}

public function parse_orders_by_status ($orders, $market, $since, $limit, $status) {
$result = array ();
for ($i = 0; $i < count ($orders); $i++) {
$order = $this->parse_order(array_merge ($orders[$i], array (
'status' => $status,
)), $market);
$result[] = $order;
}
$symbol = ($market !== null) ? $market['symbol'] : null;
return $this->filter_by_symbol_since_limit($result, $symbol, $since, $limit);
}

public function fetch_open_orders ($symbol = null, $since = null, $limit = null, $params = array ()) {
Expand All @@ -497,18 +513,23 @@ public function fetch_open_orders ($symbol = null, $since = null, $limit = null,
if ($buy === null)
$buy = array ();
$orders = $this->array_concat($sell, $buy);
for ($i = 0; $i < count ($orders); $i++) {
$order = $this->parse_order(array_merge ($orders[$i], array (
'status' => 'open',
)), $market);
$orderId = $order['id'];
if (is_array ($this->orders) && array_key_exists ($orderId, $this->orders))
if ($this->orders[$orderId]['status'] !== 'open')
$order['status'] = $this->orders[$orderId]['status'];
$this->orders[$order['id']] = $order;
}
$openOrders = $this->filter_by($this->orders, 'status', 'open');
return $this->filter_by_symbol_since_limit($openOrders, $symbol, $since, $limit);
//
// the caching part to be removed
//
// for ($i = 0; $i < count ($orders); $i++) {
// $order = $this->parse_order(array_merge ($orders[$i], array (
// 'status' => 'open',
// )), $market);
// $orderId = $order['id'];
// if (is_array ($this->orders) && array_key_exists ($orderId, $this->orders))
// if ($this->orders[$orderId]['status'] !== 'open')
// $order['status'] = $this->orders[$orderId]['status'];
// $this->orders[$order['id']] = $order;
// }
// $openOrders = $this->filter_by($this->orders, 'status', 'open');
// return $this->filter_by_symbol_since_limit($openOrders, $symbol, $since, $limit);
//
return $this->parse_orders_by_status ($orders, $market, $since, $limit, 'open');
}

public function fetch_closed_orders ($symbol = null, $since = null, $limit = 20, $params = array ()) {
Expand All @@ -525,18 +546,23 @@ public function fetch_closed_orders ($symbol = null, $since = null, $limit = 20,
$request['limit'] = $limit;
$response = $this->privateGetOrderDealt (array_merge ($request, $params));
$orders = $response['data']['datas'];
for ($i = 0; $i < count ($orders); $i++) {
$order = $this->parse_order(array_merge ($orders[$i], array (
'status' => 'closed',
)), $market);
$orderId = $order['id'];
if (is_array ($this->orders) && array_key_exists ($orderId, $this->orders))
if ($this->orders[$orderId]['status'] === 'canceled')
$order['status'] = $this->orders[$orderId]['status'];
$this->orders[$order['id']] = $order;
}
$closedOrders = $this->filter_by($this->orders, 'status', 'closed');
return $this->filter_by_symbol_since_limit($closedOrders, $symbol, $since, $limit);
//
// the caching part to be removed
//
// for ($i = 0; $i < count ($orders); $i++) {
// $order = $this->parse_order(array_merge ($orders[$i], array (
// 'status' => 'closed',
// )), $market);
// $orderId = $order['id'];
// if (is_array ($this->orders) && array_key_exists ($orderId, $this->orders))
// if ($this->orders[$orderId]['status'] === 'canceled')
// $order['status'] = $this->orders[$orderId]['status'];
// $this->orders[$order['id']] = $order;
// }
// $closedOrders = $this->filter_by($this->orders, 'status', 'closed');
// return $this->filter_by_symbol_since_limit($closedOrders, $symbol, $since, $limit);
//
return $this->parse_orders_by_status ($orders, $market, $since, $limit, 'closed');
}

public function create_order ($symbol, $type, $side, $amount, $price = null, $params = array ()) {
Expand Down Expand Up @@ -592,14 +618,19 @@ public function cancel_orders ($symbol = null, $params = array ()) {
$request['type'] = strtoupper ($params['type']);
$params = $this->omit ($params, 'type');
}
$response = $this->privatePostOrderCancelAll (array_merge ($request, $params));
$openOrders = $this->filter_by($this->orders, 'status', 'open');
for ($i = 0; $i < count ($openOrders); $i++) {
$order = $openOrders[$i];
$orderId = $order['id'];
$this->orders[$orderId]['status'] = 'canceled';
}
return $response;
//
// the caching part to be removed
//
// $response = $this->privatePostOrderCancelAll (array_merge ($request, $params));
// $openOrders = $this->filter_by($this->orders, 'status', 'open');
// for ($i = 0; $i < count ($openOrders); $i++) {
// $order = $openOrders[$i];
// $orderId = $order['id'];
// $this->orders[$orderId]['status'] = 'canceled';
// }
// return $response;
//
return $this->privatePostOrderCancelAll (array_merge ($request, $params));
}

public function cancel_order ($id, $symbol = null, $params = array ()) {
Expand All @@ -617,24 +648,29 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {
} else {
throw new ExchangeError ($this->id . ' cancelOrder requires parameter type=["BUY"|"SELL"]');
}
$response = $this->privatePostCancelOrder (array_merge ($request, $params));
if (is_array ($this->orders) && array_key_exists ($id, $this->orders)) {
$this->orders[$id]['status'] = 'canceled';
} else {
// store it in cache for further references
$timestamp = $this->milliseconds ();
$side = strtolower ($request['type']);
$this->orders[$id] = array (
'id' => $id,
'timestamp' => $timestamp,
'datetime' => $this->iso8601 ($timestamp),
'type' => null,
'side' => $side,
'symbol' => $symbol,
'status' => 'canceled',
);
}
return $response;
//
// the caching part to be removed
//
// $response = $this->privatePostCancelOrder (array_merge ($request, $params));
// if (is_array ($this->orders) && array_key_exists ($id, $this->orders)) {
// $this->orders[$id]['status'] = 'canceled';
// } else {
// // store it in cache for further references
// $timestamp = $this->milliseconds ();
// $side = strtolower ($request['type']);
// $this->orders[$id] = array (
// 'id' => $id,
// 'timestamp' => $timestamp,
// 'datetime' => $this->iso8601 ($timestamp),
// 'type' => null,
// 'side' => $side,
// 'symbol' => $symbol,
// 'status' => 'canceled',
// );
// }
// return $response;
//
return $this->privatePostCancelOrder (array_merge ($request, $params));
}

public function parse_ticker ($ticker, $market = null) {
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

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

__version__ = '1.12.36'
__version__ = '1.12.37'

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

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.12.36'
__version__ = '1.12.37'

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

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.12.36'
__version__ = '1.12.37'

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

Expand Down
Loading

0 comments on commit aff1613

Please sign in to comment.