Skip to content

Commit

Permalink
1.14.110
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed May 31, 2018
1 parent effebad commit 6a1fc6b
Show file tree
Hide file tree
Showing 11 changed files with 310 additions and 14 deletions.
85 changes: 81 additions & 4 deletions build/ccxt.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ccxt.js
Expand Up @@ -37,7 +37,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.14.109'
const version = '1.14.110'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "ccxt",
"version": "1.14.109",
"version": "1.14.110",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
2 changes: 1 addition & 1 deletion php/Exchange.php
Expand Up @@ -30,7 +30,7 @@

namespace ccxt;

$version = '1.14.109';
$version = '1.14.110';

// rounding mode
const TRUNCATE = 0;
Expand Down
79 changes: 78 additions & 1 deletion php/bitso.php
Expand Up @@ -72,6 +72,9 @@ public function describe () {
'phone_verification',
'phone_withdrawal',
'spei_withdrawal',
'ripple_withdrawal',
'bcash_withdrawal',
'litecoin_withdrawal',
),
'delete' => array (
'orders/{oid}',
Expand Down Expand Up @@ -302,9 +305,10 @@ public function cancel_order ($id, $symbol = null, $params = array ()) {
public function parse_order_status ($status) {
$statuses = array (
'partial-fill' => 'open', // this is a common substitution in ccxt
'completed' => 'closed',
);
if (is_array ($statuses) && array_key_exists ($status, $statuses))
return $statuses['status'];
return $statuses[$status];
return $status;
}

Expand Down Expand Up @@ -371,6 +375,79 @@ public function fetch_open_orders ($symbol = null, $since = null, $limit = 25, $
return $orders;
}

public function fetch_order ($id, $symbol = null, $params = array ()) {
$this->load_markets();
$market = $this->market ($symbol);
$response = $this->privateGetOrdersOid (array (
'oid' => $id,
));
$numOrders = is_array ($response['payload']) ? count ($response['payload']) : 0;
if (!gettype ($response['payload']) === 'array' && count (array_filter (array_keys ($response['payload']), 'is_string')) == 0 || ($numOrders !== 1)) {
throw new OrderNotFound ($this->id . ' => The order ' . $id . ' not found.');
}
return $this->parse_order($response['payload'][0], $market);
}

public function fetch_order_trades ($id, $symbol = null, $params = array ()) {
$this->load_markets();
$market = $this->market ($symbol);
$response = $this->privateGetOrderTradesOid (array (
'oid' => $id,
));
return $this->parse_trades($response['payload'], $market);
}

public function fetch_deposit_address ($code, $params = array ()) {
$this->load_markets();
$currency = $this->currency ($code);
$request = array (
'fund_currency' => $currency['id'],
);
$response = $this->privateGetFundingDestination (array_merge ($request, $params));
$address = $this->safe_string($response['payload'], 'account_identifier');
$tag = null;
if ($code === 'XRP') {
$parts = $address.split ('?dt=', 2);
$address = $parts[0];
$tag = $parts[1];
}
$this->check_address($address);
return array (
'currency' => $code,
'address' => $address,
'tag' => $tag,
'status' => 'ok',
'info' => $response,
);
}

public function withdraw ($code, $amount, $address, $tag = null, $params = array ()) {
$this->check_address($address);
$this->load_markets();
$methods = array (
'BTC' => 'Bitcoin',
'ETH' => 'Ether',
'XRP' => 'Ripple',
'BCH' => 'Bcash',
'LTC' => 'Litecoin',
);
$method = (is_array ($methods) && array_key_exists ($code, $methods)) ? $methods[$code] : null;
if ($method === null) {
throw new ExchangeError ($this->id . ' not valid withdraw coin => ' . $code);
}
$request = array (
'amount' => $amount,
'address' => $address,
'destination_tag' => $tag,
);
$classMethod = 'privatePost' . $method . 'Withdrawal';
$response = $this->$classMethod (array_merge ($request, $params));
return array (
'info' => $response,
'id' => $this->safe_string($response['payload'], 'wid'),
);
}

public function sign ($path, $api = 'public', $method = 'GET', $params = array (), $headers = null, $body = null) {
$endpoint = '/' . $this->version . '/' . $this->implode_params($path, $params);
$query = $this->omit ($params, $this->extract_params($path));
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/__init__.py
Expand Up @@ -22,7 +22,7 @@

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

__version__ = '1.14.109'
__version__ = '1.14.110'

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

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/__init__.py
Expand Up @@ -4,7 +4,7 @@

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

__version__ = '1.14.109'
__version__ = '1.14.110'

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

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async/base/exchange.py
Expand Up @@ -2,7 +2,7 @@

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

__version__ = '1.14.109'
__version__ = '1.14.110'

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

Expand Down
73 changes: 72 additions & 1 deletion python/ccxt/async/bitso.py
Expand Up @@ -14,6 +14,7 @@
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import OrderNotFound
from ccxt.base.errors import InvalidNonce


Expand Down Expand Up @@ -82,6 +83,9 @@ def describe(self):
'phone_verification',
'phone_withdrawal',
'spei_withdrawal',
'ripple_withdrawal',
'bcash_withdrawal',
'litecoin_withdrawal',
],
'delete': [
'orders/{oid}',
Expand Down Expand Up @@ -297,9 +301,10 @@ async def cancel_order(self, id, symbol=None, params={}):
def parse_order_status(self, status):
statuses = {
'partial-fill': 'open', # self is a common substitution in ccxt
'completed': 'closed',
}
if status in statuses:
return statuses['status']
return statuses[status]
return status

def parse_order(self, order, market=None):
Expand Down Expand Up @@ -362,6 +367,72 @@ async def fetch_open_orders(self, symbol=None, since=None, limit=25, params={}):
orders = self.parse_orders(response['payload'], market, since, limit)
return orders

async def fetch_order(self, id, symbol=None, params={}):
await self.load_markets()
market = self.market(symbol)
response = await self.privateGetOrdersOid({
'oid': id,
})
numOrders = len(response['payload'])
if not isinstance(response['payload'], list) or (numOrders != 1):
raise OrderNotFound(self.id + ': The order ' + id + ' not found.')
return self.parse_order(response['payload'][0], market)

async def fetch_order_trades(self, id, symbol=None, params={}):
await self.load_markets()
market = self.market(symbol)
response = await self.privateGetOrderTradesOid({
'oid': id,
})
return self.parse_trades(response['payload'], market)

async def fetch_deposit_address(self, code, params={}):
await self.load_markets()
currency = self.currency(code)
request = {
'fund_currency': currency['id'],
}
response = await self.privateGetFundingDestination(self.extend(request, params))
address = self.safe_string(response['payload'], 'account_identifier')
tag = None
if code == 'XRP':
parts = address.split('?dt=', 2)
address = parts[0]
tag = parts[1]
self.check_address(address)
return {
'currency': code,
'address': address,
'tag': tag,
'status': 'ok',
'info': response,
}

async def withdraw(self, code, amount, address, tag=None, params={}):
self.check_address(address)
await self.load_markets()
methods = {
'BTC': 'Bitcoin',
'ETH': 'Ether',
'XRP': 'Ripple',
'BCH': 'Bcash',
'LTC': 'Litecoin',
}
method = methods[code] if (code in list(methods.keys())) else None
if method is None:
raise ExchangeError(self.id + ' not valid withdraw coin: ' + code)
request = {
'amount': amount,
'address': address,
'destination_tag': tag,
}
classMethod = 'privatePost' + method + 'Withdrawal'
response = await getattr(self, classMethod)(self.extend(request, params))
return {
'info': response,
'id': self.safe_string(response['payload'], 'wid'),
}

def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
endpoint = '/' + self.version + '/' + self.implode_params(path, params)
query = self.omit(params, self.extract_params(path))
Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/base/exchange.py
Expand Up @@ -4,7 +4,7 @@

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

__version__ = '1.14.109'
__version__ = '1.14.110'

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

Expand Down
73 changes: 72 additions & 1 deletion python/ccxt/bitso.py
Expand Up @@ -14,6 +14,7 @@
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import OrderNotFound
from ccxt.base.errors import InvalidNonce


Expand Down Expand Up @@ -82,6 +83,9 @@ def describe(self):
'phone_verification',
'phone_withdrawal',
'spei_withdrawal',
'ripple_withdrawal',
'bcash_withdrawal',
'litecoin_withdrawal',
],
'delete': [
'orders/{oid}',
Expand Down Expand Up @@ -297,9 +301,10 @@ def cancel_order(self, id, symbol=None, params={}):
def parse_order_status(self, status):
statuses = {
'partial-fill': 'open', # self is a common substitution in ccxt
'completed': 'closed',
}
if status in statuses:
return statuses['status']
return statuses[status]
return status

def parse_order(self, order, market=None):
Expand Down Expand Up @@ -362,6 +367,72 @@ def fetch_open_orders(self, symbol=None, since=None, limit=25, params={}):
orders = self.parse_orders(response['payload'], market, since, limit)
return orders

def fetch_order(self, id, symbol=None, params={}):
self.load_markets()
market = self.market(symbol)
response = self.privateGetOrdersOid({
'oid': id,
})
numOrders = len(response['payload'])
if not isinstance(response['payload'], list) or (numOrders != 1):
raise OrderNotFound(self.id + ': The order ' + id + ' not found.')
return self.parse_order(response['payload'][0], market)

def fetch_order_trades(self, id, symbol=None, params={}):
self.load_markets()
market = self.market(symbol)
response = self.privateGetOrderTradesOid({
'oid': id,
})
return self.parse_trades(response['payload'], market)

def fetch_deposit_address(self, code, params={}):
self.load_markets()
currency = self.currency(code)
request = {
'fund_currency': currency['id'],
}
response = self.privateGetFundingDestination(self.extend(request, params))
address = self.safe_string(response['payload'], 'account_identifier')
tag = None
if code == 'XRP':
parts = address.split('?dt=', 2)
address = parts[0]
tag = parts[1]
self.check_address(address)
return {
'currency': code,
'address': address,
'tag': tag,
'status': 'ok',
'info': response,
}

def withdraw(self, code, amount, address, tag=None, params={}):
self.check_address(address)
self.load_markets()
methods = {
'BTC': 'Bitcoin',
'ETH': 'Ether',
'XRP': 'Ripple',
'BCH': 'Bcash',
'LTC': 'Litecoin',
}
method = methods[code] if (code in list(methods.keys())) else None
if method is None:
raise ExchangeError(self.id + ' not valid withdraw coin: ' + code)
request = {
'amount': amount,
'address': address,
'destination_tag': tag,
}
classMethod = 'privatePost' + method + 'Withdrawal'
response = getattr(self, classMethod)(self.extend(request, params))
return {
'info': response,
'id': self.safe_string(response['payload'], 'wid'),
}

def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
endpoint = '/' + self.version + '/' + self.implode_params(path, params)
query = self.omit(params, self.extract_params(path))
Expand Down

0 comments on commit 6a1fc6b

Please sign in to comment.