Skip to content

Commit

Permalink
1.20.82
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Dec 15, 2019
1 parent c7884ea commit 19a3eea
Show file tree
Hide file tree
Showing 17 changed files with 434 additions and 78 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ console.log (ccxt.exchanges) // print all available exchanges

All-in-one browser bundle (dependencies included), served from a CDN of your choice:

* jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].81/dist/ccxt.browser.js
* unpkg: https://unpkg.com/[email protected].81/dist/ccxt.browser.js
* jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].82/dist/ccxt.browser.js
* unpkg: https://unpkg.com/[email protected].82/dist/ccxt.browser.js

CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.

```HTML
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].81/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].82/dist/ccxt.browser.js"></script>
```

Creates a global `ccxt` object:
Expand Down
2 changes: 1 addition & 1 deletion ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.20.81'
const version = '1.20.82'

Exchange.ccxtVersion = version

Expand Down
122 changes: 107 additions & 15 deletions dist/ccxt.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Exchange = require ('./js/base/Exchange')
//-----------------------------------------------------------------------------
// this is updated by vss.js when building

const version = '1.20.81'
const version = '1.20.82'

Exchange.ccxtVersion = version

Expand Down Expand Up @@ -76726,7 +76726,19 @@ module.exports = class poloniex extends Exchange {
// category: 'exchange'
// }
//
const id = this.safeString (trade, 'globalTradeID');
// createOrder (taker trades)
//
// {
// 'amount': '200.00000000',
// 'date': '2019-12-15 16:04:10',
// 'rate': '0.00000355',
// 'total': '0.00071000',
// 'tradeID': '119871',
// 'type': 'buy',
// 'takerAdjustment': '200.00000000'
// }
//
const id = this.safeString2 (trade, 'globalTradeID', 'tradeID');
const orderId = this.safeString (trade, 'orderNumber');
const timestamp = this.parse8601 (this.safeString (trade, 'date'));
let symbol = undefined;
Expand Down Expand Up @@ -76773,6 +76785,11 @@ module.exports = class poloniex extends Exchange {
'currency': currency,
};
}
let takerOrMaker = undefined;
const takerAdjustment = this.safeFloat (trade, 'takerAdjustment');
if (takerAdjustment !== undefined) {
takerOrMaker = 'taker';
}
return {
'id': id,
'info': trade,
Expand All @@ -76782,7 +76799,7 @@ module.exports = class poloniex extends Exchange {
'order': orderId,
'type': 'limit',
'side': side,
'takerOrMaker': undefined,
'takerOrMaker': takerOrMaker,
'price': price,
'amount': amount,
'cost': cost,
Expand Down Expand Up @@ -76945,6 +76962,33 @@ module.exports = class poloniex extends Exchange {
// margin: 0,
// }
//
// createOrder
//
// {
// 'orderNumber': '9805453960',
// 'resultingTrades': [
// {
// 'amount': '200.00000000',
// 'date': '2019-12-15 16:04:10',
// 'rate': '0.00000355',
// 'total': '0.00071000',
// 'tradeID': '119871',
// 'type': 'buy',
// 'takerAdjustment': '200.00000000',
// },
// ],
// 'fee': '0.00000000',
// 'currencyPair': 'BTC_MANA',
// // ---------------------------------------------------------
// // the following fields are injected by createOrder
// 'timestamp': timestamp,
// 'status': 'open',
// 'type': type,
// 'side': side,
// 'price': price,
// 'amount': amount,
// }
//
let timestamp = this.safeInteger (order, 'timestamp');
if (!timestamp) {
timestamp = this.parse8601 (order['date']);
Expand All @@ -76960,8 +77004,8 @@ module.exports = class poloniex extends Exchange {
symbol = market['symbol'];
}
const price = this.safeFloat2 (order, 'price', 'rate');
const remaining = this.safeFloat (order, 'amount');
const amount = this.safeFloat (order, 'startingAmount', remaining);
let remaining = this.safeFloat (order, 'amount');
let amount = this.safeFloat (order, 'startingAmount');
let filled = undefined;
let cost = 0;
if (amount !== undefined) {
Expand All @@ -76971,44 +77015,73 @@ module.exports = class poloniex extends Exchange {
cost = filled * price;
}
}
} else {
amount = remaining;
}
let status = this.parseOrderStatus (this.safeString (order, 'status'));
let average = undefined;
let lastTradeTimestamp = undefined;
if (filled === undefined) {
if (trades !== undefined) {
filled = 0;
cost = 0;
for (let i = 0; i < trades.length; i++) {
const trade = trades[i];
const tradeAmount = trade['amount'];
const tradePrice = trade['price'];
filled = this.sum (filled, tradeAmount);
cost += tradePrice * tradeAmount;
const tradesLength = trades.length;
if (tradesLength > 0) {
lastTradeTimestamp = trades[0]['timestamp'];
for (let i = 0; i < tradesLength; i++) {
const trade = trades[i];
const tradeAmount = trade['amount'];
const tradePrice = trade['price'];
filled = this.sum (filled, tradeAmount);
cost = this.sum (cost, tradePrice * tradeAmount);
lastTradeTimestamp = Math.max (lastTradeTimestamp, trade['timestamp']);
}
}
remaining = Math.max (amount - filled, 0);
if (filled >= amount) {
status = 'closed';
}
}
}
const status = this.parseOrderStatus (this.safeString (order, 'status'));
if ((filled !== undefined) && (cost !== undefined) && (filled > 0)) {
average = cost / filled;
}
let type = this.safeString (order, 'type');
const side = this.safeString (order, 'side', type);
if (type === side) {
type = undefined;
}
const id = this.safeString (order, 'orderNumber');
let fee = undefined;
const feeCost = this.safeFloat (order, 'fee');
if (feeCost !== undefined) {
let feeCurrencyCode = undefined;
if (market !== undefined) {
feeCurrencyCode = (side === 'buy') ? market['base'] : market['quote'];
}
fee = {
'cost': feeCost,
'currency': feeCurrencyCode,
};
}
return {
'info': order,
'id': id,
'timestamp': timestamp,
'datetime': this.iso8601 (timestamp),
'lastTradeTimestamp': undefined,
'lastTradeTimestamp': lastTradeTimestamp,
'status': status,
'symbol': symbol,
'type': type,
'side': side,
'price': price,
'cost': cost,
'average': average,
'amount': amount,
'filled': filled,
'remaining': remaining,
'trades': trades,
'fee': undefined,
'fee': fee,
};
}

Expand Down Expand Up @@ -77133,8 +77206,27 @@ module.exports = class poloniex extends Exchange {
'rate': this.priceToPrecision (symbol, price),
'amount': this.amountToPrecision (symbol, amount),
};
const response = await this[method] (this.extend (request, params));
// remember the timestamp before issuing the request
const timestamp = this.milliseconds ();
const response = await this[method] (this.extend (request, params));
//
// {
// 'orderNumber': '9805453960',
// 'resultingTrades': [
// {
// 'amount': '200.00000000',
// 'date': '2019-12-15 16:04:10',
// 'rate': '0.00000355',
// 'total': '0.00071000',
// 'tradeID': '119871',
// 'type': 'buy',
// 'takerAdjustment': '200.00000000',
// },
// ],
// 'fee': '0.00000000',
// 'currencyPair': 'BTC_MANA',
// }
//
const order = this.parseOrder (this.extend ({
'timestamp': timestamp,
'status': 'open',
Expand Down
6 changes: 3 additions & 3 deletions doc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@ JavaScript (for use with the ``<script>`` tag):

All-in-one browser bundle (dependencies included), served from a CDN of your choice:

- jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].81/dist/ccxt.browser.js
- unpkg: https://unpkg.com/[email protected].81/dist/ccxt.browser.js
- jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].82/dist/ccxt.browser.js
- unpkg: https://unpkg.com/[email protected].82/dist/ccxt.browser.js

CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.

.. code:: html

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].81/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].82/dist/ccxt.browser.js"></script>

Creates a global ``ccxt`` object:

Expand Down
6 changes: 3 additions & 3 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ JavaScript (for use with the ``<script>`` tag):

All-in-one browser bundle (dependencies included), served from a CDN of your choice:

- jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].81/dist/ccxt.browser.js
- unpkg: https://unpkg.com/[email protected].81/dist/ccxt.browser.js
- jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].82/dist/ccxt.browser.js
- unpkg: https://unpkg.com/[email protected].82/dist/ccxt.browser.js

You can obtain a live-updated version of the bundle by removing the version number from the URL (the ``@a.b.c`` thing) — however, we do not recommend to do that, as it may break your app eventually. Also, please keep in mind that we are not responsible for the correct operation of those CDN servers.

.. code:: html

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].81/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].82/dist/ccxt.browser.js"></script>

Creates a global ``ccxt`` object:

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.20.81",
"version": "1.20.82",
"description": "A JavaScript / Python / PHP cryptocurrency trading library with support for 130+ exchanges",
"main": "./ccxt.js",
"unpkg": "dist/ccxt.browser.js",
Expand Down
4 changes: 2 additions & 2 deletions php/base/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
use Elliptic\EC;
use BN\BN;

$version = '1.20.81';
$version = '1.20.82';

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

class Exchange {

const VERSION = '1.20.81';
const VERSION = '1.20.82';

public static $eth_units = array (
'wei' => '1',
Expand Down
Loading

0 comments on commit 19a3eea

Please sign in to comment.