Skip to content

Commit

Permalink
1.34.19
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Travis CI committed Sep 12, 2020
1 parent cc1bbd3 commit 77677f2
Show file tree
Hide file tree
Showing 16 changed files with 318 additions and 88 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,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].18/dist/ccxt.browser.js
* unpkg: https://unpkg.com/[email protected].18/dist/ccxt.browser.js
* jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].19/dist/ccxt.browser.js
* unpkg: https://unpkg.com/[email protected].19/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].18/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].19/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.34.18'
const version = '1.34.19'

Exchange.ccxtVersion = version

Expand Down
101 changes: 81 additions & 20 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.34.18'
const version = '1.34.19'

Exchange.ccxtVersion = version

Expand Down Expand Up @@ -76123,8 +76123,10 @@ module.exports = class independentreserve extends Exchange {
'CORS': false,
'createOrder': true,
'fetchBalance': true,
'fetchClosedOrders': true,
'fetchMarkets': true,
'fetchMyTrades': true,
'fetchOpenOrders': true,
'fetchOrder': true,
'fetchOrderBook': true,
'fetchTicker': true,
Expand Down Expand Up @@ -76291,6 +76293,8 @@ module.exports = class independentreserve extends Exchange {
}

parseOrder (order, market = undefined) {
//
// fetchOrder
//
// {
// "OrderGuid": "c7347e4c-b865-4c94-8f74-d934d4b0b177",
Expand All @@ -76306,9 +76310,26 @@ module.exports = class independentreserve extends Exchange {
// "SecondaryCurrencyCode": "Usd"
// }
//
// fetchOpenOrders & fetchClosedOrders
//
// {
// "OrderGuid": "b8f7ad89-e4e4-4dfe-9ea3-514d38b5edb3",
// "CreatedTimestampUtc": "2020-09-08T03:04:18.616367Z",
// "OrderType": "LimitOffer",
// "Volume": 0.0005,
// "Outstanding": 0.0005,
// "Price": 113885.83,
// "AvgPrice": 113885.83,
// "Value": 56.94,
// "Status": "Open",
// "PrimaryCurrencyCode": "Xbt",
// "SecondaryCurrencyCode": "Usd",
// "FeePercent": 0.005,
// }
//
let symbol = undefined;
const baseId = this.safeString (order, 'PrimaryCurrencyCode');
const quoteId = this.safeString (order, 'PrimaryCurrencyCode');
const quoteId = this.safeString (order, 'SecondaryCurrencyCode');
let base = undefined;
let quote = undefined;
if ((baseId !== undefined) && (quoteId !== undefined)) {
Expand All @@ -76320,34 +76341,36 @@ module.exports = class independentreserve extends Exchange {
base = market['base'];
quote = market['quote'];
}
let orderType = this.safeValue (order, 'Type');
if (orderType.indexOf ('Market') >= 0) {
orderType = 'market';
} else if (orderType.indexOf ('Limit') >= 0) {
orderType = 'limit';
}
let orderType = this.safeString2 (order, 'Type', 'OrderType');
let side = undefined;
if (orderType.indexOf ('Bid') >= 0) {
side = 'buy';
} else if (orderType.indexOf ('Offer') >= 0) {
side = 'sell';
}
if (orderType.indexOf ('Market') >= 0) {
orderType = 'market';
} else if (orderType.indexOf ('Limit') >= 0) {
orderType = 'limit';
}
const timestamp = this.parse8601 (this.safeString (order, 'CreatedTimestampUtc'));
let amount = this.safeFloat (order, 'VolumeOrdered');
if (amount === undefined) {
amount = this.safeFloat (order, 'Volume');
const amount = this.safeFloat2 (order, 'VolumeOrdered', 'Volume');
let filled = this.safeFloat (order, 'VolumeFilled');
let remaining = this.safeFloat (order, 'Outstanding');
if (filled === undefined) {
if ((remaining !== undefined) && (amount !== undefined)) {
filled = Math.max (0, amount - remaining);
}
}
if (remaining === undefined) {
if ((filled !== undefined) && (amount !== undefined)) {
remaining = Math.max (0, amount - filled);
}
}
const filled = this.safeFloat (order, 'VolumeFilled');
let remaining = undefined;
const feeRate = this.safeFloat (order, 'FeePercent');
let feeCost = undefined;
if (amount !== undefined) {
if (filled !== undefined) {
remaining = amount - filled;
if (feeRate !== undefined) {
feeCost = feeRate * filled;
}
}
if (feeRate !== undefined) {
feeCost = feeRate * filled;
}
const fee = {
'rate': feeRate,
Expand Down Expand Up @@ -76406,6 +76429,44 @@ module.exports = class independentreserve extends Exchange {
return this.parseOrder (response, market);
}

async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const request = this.ordered ({});
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
request['primaryCurrencyCode'] = market['baseId'];
request['secondaryCurrencyCode'] = market['quoteId'];
}
if (limit === undefined) {
limit = 50;
}
request['pageIndex'] = 1;
request['pageSize'] = limit;
const response = await this.privatePostGetOpenOrders (this.extend (request, params));
const data = this.safeValue (response, 'Data', []);
return this.parseOrders (data, market, since, limit);
}

async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
await this.loadMarkets ();
const request = this.ordered ({});
let market = undefined;
if (symbol !== undefined) {
market = this.market (symbol);
request['primaryCurrencyCode'] = market['baseId'];
request['secondaryCurrencyCode'] = market['quoteId'];
}
if (limit === undefined) {
limit = 50;
}
request['pageIndex'] = 1;
request['pageSize'] = limit;
const response = await this.privatePostGetClosedOrders (this.extend (request, params));
const data = this.safeValue (response, 'Data', []);
return this.parseOrders (data, market, since, limit);
}

async fetchMyTrades (symbol = undefined, since = undefined, limit = 50, params = {}) {
await this.loadMarkets ();
const pageIndex = this.safeInteger (params, 'pageIndex', 1);
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.34.18",
"version": "1.34.19",
"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 @@ -36,7 +36,7 @@
use Elliptic\EdDSA;
use BN\BN;

$version = '1.34.18';
$version = '1.34.19';

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

class Exchange {

const VERSION = '1.34.18';
const VERSION = '1.34.19';

private static $base58_alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
private static $base58_encoder = null;
Expand Down
99 changes: 80 additions & 19 deletions php/independentreserve.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public function describe() {
'CORS' => false,
'createOrder' => true,
'fetchBalance' => true,
'fetchClosedOrders' => true,
'fetchMarkets' => true,
'fetchMyTrades' => true,
'fetchOpenOrders' => true,
'fetchOrder' => true,
'fetchOrderBook' => true,
'fetchTicker' => true,
Expand Down Expand Up @@ -188,6 +190,8 @@ public function fetch_ticker($symbol, $params = array ()) {
}

public function parse_order($order, $market = null) {
//
// fetchOrder
//
// {
// "OrderGuid" => "c7347e4c-b865-4c94-8f74-d934d4b0b177",
Expand All @@ -203,9 +207,26 @@ public function parse_order($order, $market = null) {
// "SecondaryCurrencyCode" => "Usd"
// }
//
// fetchOpenOrders & fetchClosedOrders
//
// {
// "OrderGuid" => "b8f7ad89-e4e4-4dfe-9ea3-514d38b5edb3",
// "CreatedTimestampUtc" => "2020-09-08T03:04:18.616367Z",
// "OrderType" => "LimitOffer",
// "Volume" => 0.0005,
// "Outstanding" => 0.0005,
// "Price" => 113885.83,
// "AvgPrice" => 113885.83,
// "Value" => 56.94,
// "Status" => "Open",
// "PrimaryCurrencyCode" => "Xbt",
// "SecondaryCurrencyCode" => "Usd",
// "FeePercent" => 0.005,
// }
//
$symbol = null;
$baseId = $this->safe_string($order, 'PrimaryCurrencyCode');
$quoteId = $this->safe_string($order, 'PrimaryCurrencyCode');
$quoteId = $this->safe_string($order, 'SecondaryCurrencyCode');
$base = null;
$quote = null;
if (($baseId !== null) && ($quoteId !== null)) {
Expand All @@ -217,34 +238,36 @@ public function parse_order($order, $market = null) {
$base = $market['base'];
$quote = $market['quote'];
}
$orderType = $this->safe_value($order, 'Type');
if (mb_strpos($orderType, 'Market') !== false) {
$orderType = 'market';
} else if (mb_strpos($orderType, 'Limit') !== false) {
$orderType = 'limit';
}
$orderType = $this->safe_string_2($order, 'Type', 'OrderType');
$side = null;
if (mb_strpos($orderType, 'Bid') !== false) {
$side = 'buy';
} else if (mb_strpos($orderType, 'Offer') !== false) {
$side = 'sell';
}
$timestamp = $this->parse8601($this->safe_string($order, 'CreatedTimestampUtc'));
$amount = $this->safe_float($order, 'VolumeOrdered');
if ($amount === null) {
$amount = $this->safe_float($order, 'Volume');
if (mb_strpos($orderType, 'Market') !== false) {
$orderType = 'market';
} else if (mb_strpos($orderType, 'Limit') !== false) {
$orderType = 'limit';
}
$timestamp = $this->parse8601($this->safe_string($order, 'CreatedTimestampUtc'));
$amount = $this->safe_float_2($order, 'VolumeOrdered', 'Volume');
$filled = $this->safe_float($order, 'VolumeFilled');
$remaining = null;
$remaining = $this->safe_float($order, 'Outstanding');
if ($filled === null) {
if (($remaining !== null) && ($amount !== null)) {
$filled = max (0, $amount - $remaining);
}
}
if ($remaining === null) {
if (($filled !== null) && ($amount !== null)) {
$remaining = max (0, $amount - $filled);
}
}
$feeRate = $this->safe_float($order, 'FeePercent');
$feeCost = null;
if ($amount !== null) {
if ($filled !== null) {
$remaining = $amount - $filled;
if ($feeRate !== null) {
$feeCost = $feeRate * $filled;
}
}
if ($feeRate !== null) {
$feeCost = $feeRate * $filled;
}
$fee = array(
'rate' => $feeRate,
Expand Down Expand Up @@ -303,6 +326,44 @@ public function fetch_order($id, $symbol = null, $params = array ()) {
return $this->parse_order($response, $market);
}

public function fetch_open_orders($symbol = null, $since = null, $limit = null, $params = array ()) {
$this->load_markets();
$request = $this->ordered(array());
$market = null;
if ($symbol !== null) {
$market = $this->market($symbol);
$request['primaryCurrencyCode'] = $market['baseId'];
$request['secondaryCurrencyCode'] = $market['quoteId'];
}
if ($limit === null) {
$limit = 50;
}
$request['pageIndex'] = 1;
$request['pageSize'] = $limit;
$response = $this->privatePostGetOpenOrders (array_merge($request, $params));
$data = $this->safe_value($response, 'Data', array());
return $this->parse_orders($data, $market, $since, $limit);
}

public function fetch_closed_orders($symbol = null, $since = null, $limit = null, $params = array ()) {
$this->load_markets();
$request = $this->ordered(array());
$market = null;
if ($symbol !== null) {
$market = $this->market($symbol);
$request['primaryCurrencyCode'] = $market['baseId'];
$request['secondaryCurrencyCode'] = $market['quoteId'];
}
if ($limit === null) {
$limit = 50;
}
$request['pageIndex'] = 1;
$request['pageSize'] = $limit;
$response = $this->privatePostGetClosedOrders (array_merge($request, $params));
$data = $this->safe_value($response, 'Data', array());
return $this->parse_orders($data, $market, $since, $limit);
}

public function fetch_my_trades($symbol = null, $since = null, $limit = 50, $params = array ()) {
$this->load_markets();
$pageIndex = $this->safe_integer($params, 'pageIndex', 1);
Expand Down
6 changes: 3 additions & 3 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,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].18/dist/ccxt.browser.js
* unpkg: https://unpkg.com/[email protected].18/dist/ccxt.browser.js
* jsDelivr: https://cdn.jsdelivr.net/npm/[email protected].19/dist/ccxt.browser.js
* unpkg: https://unpkg.com/[email protected].19/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].18/dist/ccxt.browser.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected].19/dist/ccxt.browser.js"></script>
```

Creates a global `ccxt` object:
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.34.18'
__version__ = '1.34.19'

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

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.34.18'
__version__ = '1.34.19'

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

Expand Down
Loading

0 comments on commit 77677f2

Please sign in to comment.