@icgio/icg-exchanges-wrapper 1.9.168 → 1.9.170
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 +25 -22
- package/package.json +1 -1
package/middleware/orders.js
CHANGED
|
@@ -137,60 +137,65 @@ module.exports = class Orders {
|
|
|
137
137
|
this.buy_sell_limits_against_reserve_balance = {}
|
|
138
138
|
this.order_info = {}
|
|
139
139
|
this.order_info_status = {}
|
|
140
|
-
this.
|
|
140
|
+
this.function_enabled = settings.function_enabled || {
|
|
141
141
|
info_log: true,
|
|
142
142
|
error_log: true,
|
|
143
143
|
balances_check: true,
|
|
144
144
|
positions_check: false,
|
|
145
145
|
open_orders_check: true,
|
|
146
146
|
trades_check: true,
|
|
147
|
-
query_order_check:
|
|
147
|
+
query_order_check: true,
|
|
148
|
+
query_order_check_exchange: {},
|
|
148
149
|
rates_check: true,
|
|
149
150
|
market_history_check: true,
|
|
150
151
|
ohlcv_check: false,
|
|
151
152
|
cmc_rates_check: true,
|
|
152
153
|
}
|
|
153
154
|
this.info_log = (...args) => {
|
|
154
|
-
if (this.
|
|
155
|
+
if (this.function_enabled.info_log) console.log(...args)
|
|
155
156
|
}
|
|
156
157
|
this.error_log = (...args) => {
|
|
157
|
-
if (this.
|
|
158
|
+
if (this.function_enabled.info_log) console.error(...args)
|
|
158
159
|
}
|
|
159
|
-
if (this.
|
|
160
|
+
if (this.function_enabled.balances_check) {
|
|
160
161
|
this.check_balances()
|
|
161
162
|
}
|
|
162
|
-
if (this.
|
|
163
|
+
if (this.function_enabled.positions_check) {
|
|
163
164
|
this.check_positions()
|
|
164
165
|
}
|
|
165
|
-
if (this.
|
|
166
|
+
if (this.function_enabled.open_orders_check) {
|
|
166
167
|
this.check_open_orders()
|
|
167
168
|
}
|
|
168
|
-
if (this.
|
|
169
|
+
if (this.function_enabled.trades_check) {
|
|
169
170
|
this.trades_amount_past_hour = {}
|
|
170
171
|
this.check_trades()
|
|
171
172
|
}
|
|
172
|
-
if (this.
|
|
173
|
-
this.
|
|
173
|
+
if (this.function_enabled.query_order_check) {
|
|
174
|
+
for (let exchange in this.Exchanges) {
|
|
175
|
+
if (this.function_enabled.query_order_check_exchange[exchange]) {
|
|
176
|
+
this.check_query_order(exchange)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
174
179
|
}
|
|
175
|
-
if (this.
|
|
180
|
+
if (this.function_enabled.rates_check) {
|
|
176
181
|
this.check_rates()
|
|
177
182
|
}
|
|
178
|
-
if (this.
|
|
183
|
+
if (this.function_enabled.market_history_check) {
|
|
179
184
|
this.check_market_history()
|
|
180
185
|
}
|
|
181
|
-
if (this.
|
|
186
|
+
if (this.function_enabled.ohlcv_check) {
|
|
182
187
|
this.check_ohlcv()
|
|
183
188
|
}
|
|
184
|
-
if (this.
|
|
189
|
+
if (this.function_enabled.cmc_rates_check) {
|
|
185
190
|
this.check_cmc_rates(this.cmc_curs, 'curs')
|
|
186
191
|
}
|
|
187
|
-
if (this.
|
|
192
|
+
if (this.function_enabled.balances_check && this.function_enabled.open_orders_check && this.function_enabled.trades_check) {
|
|
188
193
|
setInterval(() => {
|
|
189
194
|
this.process_trades(this.trades)
|
|
190
195
|
this.process_open_orders(this.open_orders)
|
|
191
196
|
}, PROCESS_INTERVAL)
|
|
192
197
|
}
|
|
193
|
-
if (this.
|
|
198
|
+
if (this.function_enabled.query_order_check) {
|
|
194
199
|
setInterval(() => {
|
|
195
200
|
this.process_query_order(this.query_order)
|
|
196
201
|
}, PROCESS_INTERVAL)
|
|
@@ -1069,7 +1074,7 @@ module.exports = class Orders {
|
|
|
1069
1074
|
}
|
|
1070
1075
|
get_trades_all(this.Exchanges, this.exchange_pairs, this.interval_dict)
|
|
1071
1076
|
}
|
|
1072
|
-
check_query_order() {
|
|
1077
|
+
check_query_order(exchange) {
|
|
1073
1078
|
// const QUERY_ORDER_TIME_IN_MS = 30 * 60 * 1000
|
|
1074
1079
|
const QUERY_ORDER_TIME_IN_MS = 0
|
|
1075
1080
|
let query_order_handler = (exchange, pair, res) => {
|
|
@@ -1115,11 +1120,9 @@ module.exports = class Orders {
|
|
|
1115
1120
|
}
|
|
1116
1121
|
}
|
|
1117
1122
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
query_order(exchange, pair)
|
|
1122
|
-
}
|
|
1123
|
+
if (Exchanges[exchange].query_order) {
|
|
1124
|
+
for (let pair of exchange_pairs[exchange]) {
|
|
1125
|
+
query_order(exchange, pair)
|
|
1123
1126
|
}
|
|
1124
1127
|
}
|
|
1125
1128
|
}
|