Skip to content

Commit

Permalink
1.17.472
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Nov 5, 2018
1 parent 0a57f1a commit 3f3c44a
Show file tree
Hide file tree
Showing 13 changed files with 301 additions and 27 deletions.
82 changes: 77 additions & 5 deletions 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.17.471'
const version = '1.17.472'

Exchange.ccxtVersion = version

Expand Down Expand Up @@ -44556,8 +44556,46 @@ module.exports = class kraken extends Exchange {
let id = undefined;
let order = undefined;
let fee = undefined;
if (!market)
market = this.findMarketByAltnameOrId (trade['pair']);
let marketId = this.safeString (trade, 'pair');
let foundMarket = this.findMarketByAltnameOrId (marketId);
let symbol = undefined;
if (foundMarket !== undefined) {
market = foundMarket;
} else if (marketId !== undefined) {
let baseIdStart = 0;
let baseIdEnd = 3;
let quoteIdStart = 3;
let quoteIdEnd = 6;
if (marketId.length === 8) {
baseIdEnd = 4;
quoteIdStart = 4;
quoteIdEnd = 8;
} else if (marketId.length === 7) {
baseIdEnd = 4;
quoteIdStart = 4;
quoteIdEnd = 7;
}
let baseId = marketId.slice (baseIdStart, baseIdEnd);
let quoteId = marketId.slice (quoteIdStart, quoteIdEnd);
let base = baseId;
let quote = quoteId;
if (base.length > 3) {
if ((base[0] === 'X') || (base[0] === 'Z')) {
base = base.slice (1);
}
}
if (quote.length > 3) {
if ((quote[0] === 'X') || (quote[0] === 'Z')) {
quote = quote.slice (1);
}
}
base = this.commonCurrencyCode (base);
quote = this.commonCurrencyCode (quote);
symbol = base + '/' + quote;
}
if (market !== undefined) {
symbol = market['symbol'];
}
if ('ordertxid' in trade) {
order = trade['ordertxid'];
id = this.safeString2 (trade, 'id', 'postxid');
Expand Down Expand Up @@ -44585,7 +44623,6 @@ module.exports = class kraken extends Exchange {
if (tradeLength > 6)
id = trade[6]; // artificially added as per #1794
}
let symbol = (market) ? market['symbol'] : undefined;
return {
'id': id,
'order': order,
Expand All @@ -44609,7 +44646,17 @@ module.exports = class kraken extends Exchange {
let response = await this.publicGetTrades (this.extend ({
'pair': id,
}, params));
// { result: { marketid: [ ... trades ] }, last: "last_trade_id"}
//
// {
// "error": [],
// "result": {
// "XETHXXBT": [
// ["0.032310","4.28169434",1541390792.763,"s","l",""]
// ],
// "last": "1541439421200678657"
// }
// }
//
let result = response['result'];
let trades = result[id];
// trades is a sorted array: last (most recent trade) goes last
Expand Down Expand Up @@ -44785,6 +44832,31 @@ module.exports = class kraken extends Exchange {
if (since !== undefined)
request['start'] = parseInt (since / 1000);
let response = await this.privatePostTradesHistory (this.extend (request, params));
//
// {
// "error": [],
// "result": {
// "trades": {
// "GJ3NYQ-XJRTF-THZABF": {
// "ordertxid": "TKH2SE-ZIF5E-CFI7LT",
// "postxid": "OEN3VX-M7IF5-JNBJAM",
// "pair": "XICNXETH",
// "time": 1527213229.4491,
// "type": "sell",
// "ordertype": "limit",
// "price": "0.001612",
// "cost": "0.025792",
// "fee": "0.000026",
// "vol": "16.00000000",
// "margin": "0.000000",
// "misc": ""
// },
// ...
// },
// "count": 9760,
// },
// }
//
let trades = response['result']['trades'];
let ids = Object.keys (trades);
for (let i = 0; i < ids.length; i++) {
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.17.471'
const version = '1.17.472'

Exchange.ccxtVersion = version

Expand Down
2 changes: 1 addition & 1 deletion doc/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If your question is formulated in a short manner like the above, we won’t help

When asking a question:
- Use the search button for duplicates first!
- **Post your request and response in ``verbose`` mode!** It’s written and mentioned everywhere, in the `Troubleshooting <https://github.com/ccxt/ccxt/wiki/Manual#troubleshooting>`__ section, in the `README <https://github.com/ccxt/ccxt/blob/master/README.md>`__ and in many answers to similar questions among `previous issues <https://github.com/ccxt/ccxt/issues>`__ and `pull requests <https://github.com/ccxt/ccxt/pulls>`__.
- **Post your request and response in ``verbose`` mode!** It’s written and mentioned everywhere, in the `Troubleshooting <https://github.com/ccxt/ccxt/wiki/Manual#troubleshooting>`__ section, in the `README <https://github.com/ccxt/ccxt/blob/master/README.md>`__ and in many answers to similar questions among `previous issues <https://github.com/ccxt/ccxt/issues>`__ and `pull requests <https://github.com/ccxt/ccxt/pulls>`__. No excuses.
- **Post your code** to reproduce the problem. Make it a complete short runnable program, don’t swallow the lines and make it as compact as you can (5-10 lines of code), including the instantation code.
- **Surround code and output with triple backticks: \```GOOD``\`**.
- Don’t confuse the backtick symbol (`) with the quote symbol ('): ’‘’BAD’’’
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.17.471",
"version": "1.17.472",
"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.17.471';
$version = '1.17.472';

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

class Exchange {

const VERSION = '1.17.471';
const VERSION = '1.17.472';

public static $eth_units = array (
'wei' => '1',
Expand Down
80 changes: 76 additions & 4 deletions php/kraken.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,46 @@ public function parse_trade ($trade, $market = null) {
$id = null;
$order = null;
$fee = null;
if (!$market)
$market = $this->find_market_by_altname_or_id ($trade['pair']);
$marketId = $this->safe_string($trade, 'pair');
$foundMarket = $this->find_market_by_altname_or_id ($marketId);
$symbol = null;
if ($foundMarket !== null) {
$market = $foundMarket;
} else if ($marketId !== null) {
$baseIdStart = 0;
$baseIdEnd = 3;
$quoteIdStart = 3;
$quoteIdEnd = 6;
if (strlen ($marketId) === 8) {
$baseIdEnd = 4;
$quoteIdStart = 4;
$quoteIdEnd = 8;
} else if (strlen ($marketId) === 7) {
$baseIdEnd = 4;
$quoteIdStart = 4;
$quoteIdEnd = 7;
}
$baseId = mb_substr ($marketId, $baseIdStart, $baseIdEnd);
$quoteId = mb_substr ($marketId, $quoteIdStart, $quoteIdEnd);
$base = $baseId;
$quote = $quoteId;
if (strlen ($base) > 3) {
if (($base[0] === 'X') || ($base[0] === 'Z')) {
$base = mb_substr ($base, 1);
}
}
if (strlen ($quote) > 3) {
if (($quote[0] === 'X') || ($quote[0] === 'Z')) {
$quote = mb_substr ($quote, 1);
}
}
$base = $this->common_currency_code($base);
$quote = $this->common_currency_code($quote);
$symbol = $base . '/' . $quote;
}
if ($market !== null) {
$symbol = $market['symbol'];
}
if (is_array ($trade) && array_key_exists ('ordertxid', $trade)) {
$order = $trade['ordertxid'];
$id = $this->safe_string_2($trade, 'id', 'postxid');
Expand Down Expand Up @@ -561,7 +599,6 @@ public function parse_trade ($trade, $market = null) {
if ($tradeLength > 6)
$id = $trade[6]; // artificially added as per #1794
}
$symbol = ($market) ? $market['symbol'] : null;
return array (
'id' => $id,
'order' => $order,
Expand All @@ -585,7 +622,17 @@ public function fetch_trades ($symbol, $since = null, $limit = null, $params = a
$response = $this->publicGetTrades (array_merge (array (
'pair' => $id,
), $params));
// array ( $result => { marketid => array ( ... $trades ) ), last => "last_trade_id"}
//
// {
// "error" => array (),
// "$result" => {
// "XETHXXBT" => [
// ["0.032310","4.28169434",1541390792.763,"s","l",""]
// ],
// "last" => "1541439421200678657"
// }
// }
//
$result = $response['result'];
$trades = $result[$id];
// $trades is a sorted array => last (most recent trade) goes last
Expand Down Expand Up @@ -761,6 +808,31 @@ public function fetch_my_trades ($symbol = null, $since = null, $limit = null, $
if ($since !== null)
$request['start'] = intval ($since / 1000);
$response = $this->privatePostTradesHistory (array_merge ($request, $params));
//
// {
// "error" => array (),
// "$result" => array (
// "$trades" => array (
// "GJ3NYQ-XJRTF-THZABF" => array (
// "ordertxid" => "TKH2SE-ZIF5E-CFI7LT",
// "postxid" => "OEN3VX-M7IF5-JNBJAM",
// "pair" => "XICNXETH",
// "time" => 1527213229.4491,
// "type" => "sell",
// "ordertype" => "$limit",
// "price" => "0.001612",
// "cost" => "0.025792",
// "fee" => "0.000026",
// "vol" => "16.00000000",
// "margin" => "0.000000",
// "misc" => ""
// ),
// ...
// ),
// "count" => 9760,
// ),
// }
//
$trades = $response['result']['trades'];
$ids = is_array ($trades) ? array_keys ($trades) : array ();
for ($i = 0; $i < count ($ids); $i++) {
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.17.471'
__version__ = '1.17.472'

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

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.17.471'
__version__ = '1.17.472'

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

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.17.471'
__version__ = '1.17.472'

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

Expand Down
Loading

0 comments on commit 3f3c44a

Please sign in to comment.