Skip to content

Commit

Permalink
1.10.415
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Dec 19, 2017
1 parent 48e1bc4 commit 7a4bdf8
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 45 deletions.
47 changes: 36 additions & 11 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.414'
const version = '1.10.415'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion ccxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.10.414';
$version = '1.10.415';

const CLASSES_DIR = __DIR__ . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR;

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.414",
"version": "1.10.415",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 90+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
12 changes: 11 additions & 1 deletion php/allcoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function fetch_markets () {
return $result;
}

public function get_order_status ($status) {
public function parse_order_status ($status) {
if ($status == -1)
return 'canceled';
if ($status == 0)
Expand All @@ -98,4 +98,14 @@ public function get_order_status ($status) {
return 'canceled';
return $status;
}

public function get_create_date_field () {
// allcoin typo create_data instead of create_date
return 'create_data';
}

public function get_orders_field () {
// allcoin typo order instead of orders (expected based on their API docs)
return 'order';
}
}
4 changes: 2 additions & 2 deletions php/gdax.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function fetch_time () {
return $this->parse8601 ($response['iso']);
}

public function get_order_status ($status) {
public function parse_order_status ($status) {
$statuses = array (
'pending' => 'open',
'active' => 'open',
Expand All @@ -319,7 +319,7 @@ public function parse_order ($order, $market = null) {
if (is_array ($this->markets_by_id) && array_key_exists ($order['product_id'], $this->markets_by_id))
$market = $this->markets_by_id[$order['product_id']];
}
$status = $this->get_order_status ($order['status']);
$status = $this->parse_order_status($order['status']);
$price = $this->safe_float($order, 'price');
$amount = $this->safe_float($order, 'size');
$filled = $this->safe_float($order, 'filled_size');
Expand Down
4 changes: 2 additions & 2 deletions php/hitbtc.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {
), $params));
}

public function get_order_status ($status) {
public function parse_order_status ($status) {
$statuses = array (
'new' => 'open',
'partiallyFilled' => 'open',
Expand All @@ -702,7 +702,7 @@ public function parse_order ($order, $market = null) {
$market = $this->markets_by_id[$order['symbol']];
$status = $this->safe_string($order, 'orderStatus');
if ($status)
$status = $this->get_order_status ($status);
$status = $this->parse_order_status($status);
$averagePrice = $this->safe_float($order, 'avgPrice', 0.0);
$price = $this->safe_float($order, 'orderPrice');
$amount = $this->safe_float($order, 'orderQuantity');
Expand Down
23 changes: 19 additions & 4 deletions php/okcoinusd.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ public function parse_order ($order, $market = null) {
if ($market)
$symbol = $market['symbol'];
$timestamp = null;
if (is_array ($order) && array_key_exists ('create_date', $order))
$timestamp = $order['create_date'];
$createDateField = $this->get_create_date_field ();
if (is_array ($order) && array_key_exists ($createDateField, $order))
$timestamp = $order[$createDateField];
$amount = $order['amount'];
$filled = $order['deal_amount'];
$remaining = $amount - $filled;
Expand All @@ -450,6 +451,18 @@ public function parse_order ($order, $market = null) {
return $result;
}

public function get_create_date_field () {
// needed for derived exchanges
// allcoin typo create_data instead of create_date
return 'create_date';
}

public function get_orders_field () {
// needed for derived exchanges
// allcoin typo order instead of orders (expected based on their API docs)
return 'orders';
}

public function fetch_order ($id, $symbol = null, $params = array ()) {
if (!$symbol)
throw new ExchangeError ($this->id . 'fetchOrders requires a $symbol parameter');
Expand All @@ -469,7 +482,8 @@ public function fetch_order ($id, $symbol = null, $params = array ()) {
}
$method .= 'OrderInfo';
$response = $this->$method (array_merge ($request, $params));
return $this->parse_order($response['orders'][0]);
$ordersField = $this->get_orders_field ();
return $this->parse_order($response[$ordersField][0]);
}

public function fetch_orders ($symbol = null, $since = null, $limit = null, $params = array ()) {
Expand Down Expand Up @@ -516,7 +530,8 @@ public function fetch_orders ($symbol = null, $since = null, $limit = null, $par
$params = $this->omit ($params, array ( 'type', 'status' ));
}
$response = $this->$method (array_merge ($request, $params));
return $this->parse_orders($response['orders'], $market, $since, $limit);
$ordersField = $this->get_orders_field ();
return $this->parse_orders($response[$ordersField], $market, $since, $limit);
}

public function fetch_open_orders ($symbol = null, $since = null, $limit = null, $params = array ()) {
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.414'
__version__ = '1.10.415'

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

Expand Down
10 changes: 9 additions & 1 deletion python/ccxt/allcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def fetch_markets(self):
})
return result

def get_order_status(self, status):
def parse_order_status(self, status):
if status == -1:
return 'canceled'
if status == 0:
Expand All @@ -94,3 +94,11 @@ def get_order_status(self, status):
if status == 10:
return 'canceled'
return status

def get_create_date_field(self):
# allcoin typo create_data instead of create_date
return 'create_data'

def get_orders_field(self):
# allcoin typo order instead of orders(expected based on their API docs)
return 'order'
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.414'
__version__ = '1.10.415'

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

Expand Down
10 changes: 9 additions & 1 deletion python/ccxt/async/allcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async def fetch_markets(self):
})
return result

def get_order_status(self, status):
def parse_order_status(self, status):
if status == -1:
return 'canceled'
if status == 0:
Expand All @@ -94,3 +94,11 @@ def get_order_status(self, status):
if status == 10:
return 'canceled'
return status

def get_create_date_field(self):
# allcoin typo create_data instead of create_date
return 'create_data'

def get_orders_field(self):
# allcoin typo order instead of orders(expected based on their API docs)
return 'order'
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.414'
__version__ = '1.10.415'

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

Expand Down
4 changes: 2 additions & 2 deletions python/ccxt/async/gdax.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ async def fetch_time(self):
response = self.publicGetTime()
return self.parse8601(response['iso'])

def get_order_status(self, status):
def parse_order_status(self, status):
statuses = {
'pending': 'open',
'active': 'open',
Expand All @@ -311,7 +311,7 @@ def parse_order(self, order, market=None):
if not market:
if order['product_id'] in self.markets_by_id:
market = self.markets_by_id[order['product_id']]
status = self.get_order_status(order['status'])
status = self.parse_order_status(order['status'])
price = self.safe_float(order, 'price')
amount = self.safe_float(order, 'size')
filled = self.safe_float(order, 'filled_size')
Expand Down
4 changes: 2 additions & 2 deletions python/ccxt/async/hitbtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ async def cancel_order(self, id, symbol=None, params={}):
'clientOrderId': id,
}, params))

def get_order_status(self, status):
def parse_order_status(self, status):
statuses = {
'new': 'open',
'partiallyFilled': 'open',
Expand All @@ -689,7 +689,7 @@ def parse_order(self, order, market=None):
market = self.markets_by_id[order['symbol']]
status = self.safe_string(order, 'orderStatus')
if status:
status = self.get_order_status(status)
status = self.parse_order_status(status)
averagePrice = self.safe_float(order, 'avgPrice', 0.0)
price = self.safe_float(order, 'orderPrice')
amount = self.safe_float(order, 'orderQuantity')
Expand Down
21 changes: 17 additions & 4 deletions python/ccxt/async/okcoinusd.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,9 @@ def parse_order(self, order, market=None):
if market:
symbol = market['symbol']
timestamp = None
if 'create_date' in order:
timestamp = order['create_date']
createDateField = self.get_create_date_field()
if createDateField in order:
timestamp = order[createDateField]
amount = order['amount']
filled = order['deal_amount']
remaining = amount - filled
Expand All @@ -425,6 +426,16 @@ def parse_order(self, order, market=None):
}
return result

def get_create_date_field(self):
# needed for derived exchanges
# allcoin typo create_data instead of create_date
return 'create_date'

def get_orders_field(self):
# needed for derived exchanges
# allcoin typo order instead of orders(expected based on their API docs)
return 'orders'

async def fetch_order(self, id, symbol=None, params={}):
if not symbol:
raise ExchangeError(self.id + 'fetchOrders requires a symbol parameter')
Expand All @@ -443,7 +454,8 @@ async def fetch_order(self, id, symbol=None, params={}):
request['contract_type'] = 'this_week' # next_week, quarter
method += 'OrderInfo'
response = await getattr(self, method)(self.extend(request, params))
return self.parse_order(response['orders'][0])
ordersField = self.get_orders_field()
return self.parse_order(response[ordersField][0])

async def fetch_orders(self, symbol=None, since=None, limit=None, params={}):
if not symbol:
Expand Down Expand Up @@ -486,7 +498,8 @@ async def fetch_orders(self, symbol=None, since=None, limit=None, params={}):
})
params = self.omit(params, ['type', 'status'])
response = await getattr(self, method)(self.extend(request, params))
return self.parse_orders(response['orders'], market, since, limit)
ordersField = self.get_orders_field()
return self.parse_orders(response[ordersField], market, since, limit)

async def fetch_open_orders(self, symbol=None, since=None, limit=None, params={}):
open = 0 # 0 for unfilled orders, 1 for filled orders
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

__version__ = '1.10.414'
__version__ = '1.10.415'

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

Expand Down
4 changes: 2 additions & 2 deletions python/ccxt/gdax.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def fetch_time(self):
response = self.publicGetTime()
return self.parse8601(response['iso'])

def get_order_status(self, status):
def parse_order_status(self, status):
statuses = {
'pending': 'open',
'active': 'open',
Expand All @@ -311,7 +311,7 @@ def parse_order(self, order, market=None):
if not market:
if order['product_id'] in self.markets_by_id:
market = self.markets_by_id[order['product_id']]
status = self.get_order_status(order['status'])
status = self.parse_order_status(order['status'])
price = self.safe_float(order, 'price')
amount = self.safe_float(order, 'size')
filled = self.safe_float(order, 'filled_size')
Expand Down
4 changes: 2 additions & 2 deletions python/ccxt/hitbtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def cancel_order(self, id, symbol=None, params={}):
'clientOrderId': id,
}, params))

def get_order_status(self, status):
def parse_order_status(self, status):
statuses = {
'new': 'open',
'partiallyFilled': 'open',
Expand All @@ -689,7 +689,7 @@ def parse_order(self, order, market=None):
market = self.markets_by_id[order['symbol']]
status = self.safe_string(order, 'orderStatus')
if status:
status = self.get_order_status(status)
status = self.parse_order_status(status)
averagePrice = self.safe_float(order, 'avgPrice', 0.0)
price = self.safe_float(order, 'orderPrice')
amount = self.safe_float(order, 'orderQuantity')
Expand Down
21 changes: 17 additions & 4 deletions python/ccxt/okcoinusd.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,9 @@ def parse_order(self, order, market=None):
if market:
symbol = market['symbol']
timestamp = None
if 'create_date' in order:
timestamp = order['create_date']
createDateField = self.get_create_date_field()
if createDateField in order:
timestamp = order[createDateField]
amount = order['amount']
filled = order['deal_amount']
remaining = amount - filled
Expand All @@ -425,6 +426,16 @@ def parse_order(self, order, market=None):
}
return result

def get_create_date_field(self):
# needed for derived exchanges
# allcoin typo create_data instead of create_date
return 'create_date'

def get_orders_field(self):
# needed for derived exchanges
# allcoin typo order instead of orders(expected based on their API docs)
return 'orders'

def fetch_order(self, id, symbol=None, params={}):
if not symbol:
raise ExchangeError(self.id + 'fetchOrders requires a symbol parameter')
Expand All @@ -443,7 +454,8 @@ def fetch_order(self, id, symbol=None, params={}):
request['contract_type'] = 'this_week' # next_week, quarter
method += 'OrderInfo'
response = getattr(self, method)(self.extend(request, params))
return self.parse_order(response['orders'][0])
ordersField = self.get_orders_field()
return self.parse_order(response[ordersField][0])

def fetch_orders(self, symbol=None, since=None, limit=None, params={}):
if not symbol:
Expand Down Expand Up @@ -486,7 +498,8 @@ def fetch_orders(self, symbol=None, since=None, limit=None, params={}):
})
params = self.omit(params, ['type', 'status'])
response = getattr(self, method)(self.extend(request, params))
return self.parse_orders(response['orders'], market, since, limit)
ordersField = self.get_orders_field()
return self.parse_orders(response[ordersField], market, since, limit)

def fetch_open_orders(self, symbol=None, since=None, limit=None, params={}):
open = 0 # 0 for unfilled orders, 1 for filled orders
Expand Down

0 comments on commit 7a4bdf8

Please sign in to comment.