@icgio/icg-exchanges-wrapper 1.14.216 → 1.14.218
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/account.js +8 -7
- package/middleware/orders.js +4 -4
- package/package.json +1 -1
package/middleware/account.js
CHANGED
|
@@ -35,11 +35,12 @@ module.exports = class Account {
|
|
|
35
35
|
|
|
36
36
|
console.log('exchange_assets_benchmarks', this.exchange_assets_benchmarks)
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
this.forex_rates = {}
|
|
39
39
|
forex_rate.get_forex_rate_usd(['CNY', 'HKD', 'KRW'], (res) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
console.log('forex_rates', res)
|
|
41
|
+
this.forex_rates['CNYUSD'] = res['CNY']
|
|
42
|
+
this.forex_rates['HKDUSD'] = res['HKD']
|
|
43
|
+
this.forex_rates['KRWUSD'] = res['KRW']
|
|
43
44
|
})
|
|
44
45
|
}
|
|
45
46
|
get_depth(rates, cmc_rates, percentages) {
|
|
@@ -129,11 +130,11 @@ module.exports = class Account {
|
|
|
129
130
|
if (_.includes(constants.stablecoins, cur)) {
|
|
130
131
|
profit.USD += position
|
|
131
132
|
} else if (_.includes(['KRW'], cur)) {
|
|
132
|
-
profit.USD += position /
|
|
133
|
+
profit.USD += position / this.forex_rates['KRWUSD']
|
|
133
134
|
} else if (_.includes(['HKD'], cur)) {
|
|
134
|
-
profit.USD += position /
|
|
135
|
+
profit.USD += position / this.forex_rates['HKDUSD']
|
|
135
136
|
} else if (_.includes(['CNYT'], cur)) {
|
|
136
|
-
profit.USD += position /
|
|
137
|
+
profit.USD += position / this.forex_rates['CNYUSD']
|
|
137
138
|
} else {
|
|
138
139
|
if (!cmc_rates[cur]) {
|
|
139
140
|
console.log('get_exchange_profit rates_cmc %s does not exist', cur)
|
package/middleware/orders.js
CHANGED
|
@@ -1439,14 +1439,14 @@ module.exports = class Orders {
|
|
|
1439
1439
|
for (let exchange in exchange_pairs) {
|
|
1440
1440
|
for (let pair of exchange_pairs[exchange]) {
|
|
1441
1441
|
if (Exchanges[exchange].ohlcv) {
|
|
1442
|
-
|
|
1443
|
-
|
|
1442
|
+
const ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS).getTime()
|
|
1443
|
+
const ohlcv_to_timestamp = new Date().floorHours(1).getTime()
|
|
1444
1444
|
Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, (res) => {
|
|
1445
1445
|
ohlcv_handler(exchange, pair, res)
|
|
1446
1446
|
})
|
|
1447
1447
|
setInterval(() => {
|
|
1448
|
-
|
|
1449
|
-
|
|
1448
|
+
const ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS).getTime()
|
|
1449
|
+
const ohlcv_to_timestamp = new Date().floorHours(1).getTime()
|
|
1450
1450
|
Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, (res) => {
|
|
1451
1451
|
ohlcv_handler(exchange, pair, res)
|
|
1452
1452
|
})
|