Skip to content

Commit

Permalink
1.18.102
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Jan 5, 2019
1 parent c38a1a4 commit 84f67a5
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 10 deletions.
74 changes: 73 additions & 1 deletion build/ccxt.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.18.101'
const version = '1.18.102'

Exchange.ccxtVersion = version

Expand Down Expand Up @@ -55713,6 +55713,7 @@ module.exports = class quadrigacx extends Exchange {
'fetchTickers': true,
'fetchOrder': true,
'fetchMyTrades': true,
'fetchTransactions': true,
'CORS': true,
'withdraw': true,
},
Expand Down Expand Up @@ -55809,6 +55810,77 @@ module.exports = class quadrigacx extends Exchange {
return this.parseTrades (trades, market, since, limit);
}

async fetchTransactions (symbol = undefined, since = undefined, limit = undefined, params = {}) {
let market = undefined;
let request = {};
if (symbol !== undefined) {
market = this.market (symbol);
request['book'] = market['id'];
}
if (limit !== undefined) {
request['limit'] = limit;
}
let response = await this.privatePostUserTransactions (this.extend (request, params));
let user_transactions = this.filterByArray (response, 'type', [0, 1], false);
// return user_transactions;
return this.parseTransactions (user_transactions, market, since, limit);
}

parseTransaction (transaction, currency = undefined) {
//
// {
// "btc":"0.99985260",
// "method":"Bitcoin",
// "fee":"0.00000000",
// "type":0,
// "datetime":"2018-10-08 05:26:23"
// }
//
// {
// "btc":"-0.50000000",
// "method":"Bitcoin",
// "fee":"0.00000000",
// "type":1,
// "datetime":"2018-08-27 13:50:10"
// }
//
let code = undefined;
let amount = undefined;
let omitted = this.omit (transaction, [ 'datetime', 'type', 'method', 'fee' ]);
let keys = Object.keys (omitted);
for (let i = 0; i < keys.length; i++) {
if (keys[i] in this.currencies_by_id) {
code = keys[i];
}
}
if (code !== undefined) {
amount = this.safeString (transaction, code);
}
let timestamp = this.parse8601 (this.safeString (transaction, 'datetime'));
let status = 'ok';
const fee = this.safeFloat (transaction, 'fee');
let type = this.safeInteger (transaction, 'type');
type = (type === 1) ? 'withdrawal' : 'deposit';
return {
'info': transaction,
'id': undefined,
'txid': undefined,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'address': undefined,
'tag': undefined,
'type': type,
'amount': amount,
'currency': code,
'status': status,
'updated': undefined,
'fee': {
'currency': code,
'cost': fee,
},
};
}

async fetchOrder (id, symbol = undefined, params = {}) {
let request = {
'id': id,
Expand Down
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.18.101'
const version = '1.18.102'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.18.101",
"version": "1.18.102",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges",
"main": "./ccxt.js",
"unpkg": "build/ccxt.browser.js",
Expand Down
4 changes: 2 additions & 2 deletions php/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
use kornrunner\Secp256k1;
use kornrunner\Solidity;

$version = '1.18.101';
$version = '1.18.102';

// rounding mode
const TRUNCATE = 0;
Expand All @@ -50,7 +50,7 @@

class Exchange {

const VERSION = '1.18.101';
const VERSION = '1.18.102';

public static $eth_units = array (
'wei' => '1',
Expand Down
72 changes: 72 additions & 0 deletions php/quadrigacx.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function describe () {
'fetchTickers' => true,
'fetchOrder' => true,
'fetchMyTrades' => true,
'fetchTransactions' => true,
'CORS' => true,
'withdraw' => true,
),
Expand Down Expand Up @@ -117,6 +118,77 @@ public function fetch_my_trades ($symbol = null, $since = null, $limit = null, $
return $this->parse_trades($trades, $market, $since, $limit);
}

public function fetch_transactions ($symbol = null, $since = null, $limit = null, $params = array ()) {
$market = null;
$request = array ();
if ($symbol !== null) {
$market = $this->market ($symbol);
$request['book'] = $market['id'];
}
if ($limit !== null) {
$request['limit'] = $limit;
}
$response = $this->privatePostUserTransactions (array_merge ($request, $params));
$user_transactions = $this->filter_by_array($response, 'type', [0, 1], false);
// return $user_transactions;
return $this->parseTransactions ($user_transactions, $market, $since, $limit);
}

public function parse_transaction ($transaction, $currency = null) {
//
// {
// "btc":"0.99985260",
// "method":"Bitcoin",
// "$fee":"0.00000000",
// "$type":0,
// "datetime":"2018-10-08 05:26:23"
// }
//
// {
// "btc":"-0.50000000",
// "method":"Bitcoin",
// "$fee":"0.00000000",
// "$type":1,
// "datetime":"2018-08-27 13:50:10"
// }
//
$code = null;
$amount = null;
$omitted = $this->omit ($transaction, array ( 'datetime', 'type', 'method', 'fee' ));
$keys = is_array ($omitted) ? array_keys ($omitted) : array ();
for ($i = 0; $i < count ($keys); $i++) {
if (is_array ($this->currencies_by_id) && array_key_exists ($keys[$i], $this->currencies_by_id)) {
$code = $keys[$i];
}
}
if ($code !== null) {
$amount = $this->safe_string($transaction, $code);
}
$timestamp = $this->parse8601 ($this->safe_string($transaction, 'datetime'));
$status = 'ok';
$fee = $this->safe_float($transaction, 'fee');
$type = $this->safe_integer($transaction, 'type');
$type = ($type === 1) ? 'withdrawal' : 'deposit';
return array (
'info' => $transaction,
'id' => null,
'txid' => null,
'timestamp' => $timestamp,
'datetime' => $this->iso8601 ($timestamp),
'address' => null,
'tag' => null,
'type' => $type,
'amount' => $amount,
'currency' => $code,
'status' => $status,
'updated' => null,
'fee' => array (
'currency' => $code,
'cost' => $fee,
),
);
}

public function fetch_order ($id, $symbol = null, $params = array ()) {
$request = array (
'id' => $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 @@ -22,7 +22,7 @@

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

__version__ = '1.18.101'
__version__ = '1.18.102'

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

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async_support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

__version__ = '1.18.101'
__version__ = '1.18.102'

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

Expand Down
2 changes: 1 addition & 1 deletion python/ccxt/async_support/base/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

__version__ = '1.18.101'
__version__ = '1.18.102'

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

Expand Down
65 changes: 65 additions & 0 deletions python/ccxt/async_support/quadrigacx.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def describe(self):
'fetchTickers': True,
'fetchOrder': True,
'fetchMyTrades': True,
'fetchTransactions': True,
'CORS': True,
'withdraw': True,
},
Expand Down Expand Up @@ -120,6 +121,70 @@ async def fetch_my_trades(self, symbol=None, since=None, limit=None, params={}):
trades = self.filter_by(response, 'type', 2)
return self.parse_trades(trades, market, since, limit)

async def fetch_transactions(self, symbol=None, since=None, limit=None, params={}):
market = None
request = {}
if symbol is not None:
market = self.market(symbol)
request['book'] = market['id']
if limit is not None:
request['limit'] = limit
response = await self.privatePostUserTransactions(self.extend(request, params))
user_transactions = self.filter_by_array(response, 'type', [0, 1], False)
# return user_transactions
return self.parseTransactions(user_transactions, market, since, limit)

def parse_transaction(self, transaction, currency=None):
#
# {
# "btc":"0.99985260",
# "method":"Bitcoin",
# "fee":"0.00000000",
# "type":0,
# "datetime":"2018-10-08 05:26:23"
# }
#
# {
# "btc":"-0.50000000",
# "method":"Bitcoin",
# "fee":"0.00000000",
# "type":1,
# "datetime":"2018-08-27 13:50:10"
# }
#
code = None
amount = None
omitted = self.omit(transaction, ['datetime', 'type', 'method', 'fee'])
keys = list(omitted.keys())
for i in range(0, len(keys)):
if keys[i] in self.currencies_by_id:
code = keys[i]
if code is not None:
amount = self.safe_string(transaction, code)
timestamp = self.parse8601(self.safe_string(transaction, 'datetime'))
status = 'ok'
fee = self.safe_float(transaction, 'fee')
type = self.safe_integer(transaction, 'type')
type = 'withdrawal' if (type == 1) else 'deposit'
return {
'info': transaction,
'id': None,
'txid': None,
'timestamp': timestamp,
'datetime': self.iso8601(timestamp),
'address': None,
'tag': None,
'type': type,
'amount': amount,
'currency': code,
'status': status,
'updated': None,
'fee': {
'currency': code,
'cost': fee,
},
}

async def fetch_order(self, id, symbol=None, params={}):
request = {
'id': id,
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.18.101'
__version__ = '1.18.102'

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

Expand Down
Loading

0 comments on commit 84f67a5

Please sign in to comment.