@icgio/icg-exchanges-wrapper 1.9.9 → 1.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/middleware/orders.js +5 -5
- package/package.json +3 -3
package/middleware/orders.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const _ = require('lodash')
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const uuid = require('uuidv4')
|
|
4
4
|
const Influx = require('influx')
|
|
5
5
|
|
|
6
6
|
const icg_exchanges = require('@icgio/icg-exchanges')
|
|
@@ -159,7 +159,7 @@ module.exports = class Orders {
|
|
|
159
159
|
set_exchange_assets_from_balances (balances) {
|
|
160
160
|
this.account.set_exchange_assets_from_balances(balances)
|
|
161
161
|
}
|
|
162
|
-
limit_trade (exchange, pair, method, price, amount, id=
|
|
162
|
+
limit_trade (exchange, pair, method, price, amount, id=uuid(), order_type='', limiter_on=true) {
|
|
163
163
|
price = round_price(_.upperFirst(exchange), pair, price)
|
|
164
164
|
amount = round_amount(_.upperFirst(exchange), pair, amount)
|
|
165
165
|
this.info_log('%s %s %s %s %s %s at %s', limiter_on, order_type, exchange, pair, method, amount, price)
|
|
@@ -231,14 +231,14 @@ module.exports = class Orders {
|
|
|
231
231
|
this.error_log('%s volumes do not exist')
|
|
232
232
|
return
|
|
233
233
|
}
|
|
234
|
-
let id =
|
|
234
|
+
let id = uuid()
|
|
235
235
|
let sum = _.sum(_.values(this.volumes[pair]))
|
|
236
236
|
for (let exchange of this.pair_exchanges[pair]) {
|
|
237
237
|
let amount = this.volumes[pair][exchange] / sum * total
|
|
238
238
|
this.limit_trade(exchange, pair, method, price, amount, id)
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
market_trade (exchange, pair, method, amount, id=
|
|
241
|
+
market_trade (exchange, pair, method, amount, id=uuid()) {
|
|
242
242
|
if (!this.rates[exchange][pair]) {
|
|
243
243
|
this.info_log('%s %s rates do not exist', exchange, pair)
|
|
244
244
|
return
|
|
@@ -254,7 +254,7 @@ module.exports = class Orders {
|
|
|
254
254
|
}
|
|
255
255
|
let type = method === 'buy' ? 'asks' : 'bids' // reverse because it is market order
|
|
256
256
|
let { price_exchange, vol_exchange } = utils.vol_position_combined(this.rates_combined_all[pair][type], total)
|
|
257
|
-
let id =
|
|
257
|
+
let id = uuid()
|
|
258
258
|
for (let exchange of this.pair_exchanges[pair]) {
|
|
259
259
|
if (price_exchange[exchange] && vol_exchange[exchange])
|
|
260
260
|
this.limit_trade(exchange, pair, method, price_exchange[exchange], vol_exchange[exchange], id)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@icgio/icg-exchanges": "^1.27.3",
|
|
21
|
-
"@icgio/icg-exchanges-data": "^1.6.
|
|
21
|
+
"@icgio/icg-exchanges-data": "^1.6.8",
|
|
22
22
|
"@icgio/icg-utils": "^1.7.3",
|
|
23
23
|
"influx": "^5.7.0",
|
|
24
24
|
"lodash": "^4.17.20",
|
|
25
25
|
"needle": "^2.6.0",
|
|
26
|
-
"
|
|
26
|
+
"uuidv4": "^6.2.13",
|
|
27
27
|
"ws": "^6.2.1"
|
|
28
28
|
}
|
|
29
29
|
}
|