@icgio/icg-exchanges-wrapper 1.8.6
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/README.md +1 -0
- package/functions/get-exchanges-balance.js +32 -0
- package/functions/get-exchanges-open-orders.js +0 -0
- package/functions/get-exchanges-rates-market-history.js +113 -0
- package/functions/get-exchanges-trades.js +0 -0
- package/index.js +16 -0
- package/middleware/account.js +102 -0
- package/middleware/orders.js +1024 -0
- package/middleware/websocket.js +69 -0
- package/package.json +29 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// const _ = require('lodash')
|
|
2
|
+
|
|
3
|
+
// const WebSocket = require('ws')
|
|
4
|
+
|
|
5
|
+
// const Orders = require('./orders.js')
|
|
6
|
+
|
|
7
|
+
// const wss = new WebSocket.Server({ port: 1688 })
|
|
8
|
+
|
|
9
|
+
// let orders
|
|
10
|
+
|
|
11
|
+
// wss.on('connection', (ws) => {
|
|
12
|
+
// ws.send_json = (json) => {
|
|
13
|
+
// ws.send(JSON.stringify(json))
|
|
14
|
+
// }
|
|
15
|
+
// ws.on('message', (message) => {
|
|
16
|
+
// try {
|
|
17
|
+
// message = JSON.parse(message)
|
|
18
|
+
// } catch (error) {
|
|
19
|
+
// ws.send_json('parse message error: %j', error)
|
|
20
|
+
// }
|
|
21
|
+
// if (message.action && message.action === 'new') {
|
|
22
|
+
// let { exchange_basecur_curs, cd, settings } = message.params
|
|
23
|
+
// if (!exchange_basecur_curs || !cd || !settings) {
|
|
24
|
+
// ws.send_json('exchange_basecur_curs or cd or settings do not exist: %s %s %s', exchange_basecur_curs, cd, settings)
|
|
25
|
+
// return
|
|
26
|
+
// }
|
|
27
|
+
// orders = new Orders(exchange_basecur_curs, cd, settings)
|
|
28
|
+
// } else if (!orders) {
|
|
29
|
+
// ws.send_json('need to create an Orders object first')
|
|
30
|
+
// } else if (message.action && message.action === 'limit-trade') {
|
|
31
|
+
// let { exchange, pair, method, price, amount } = message.params
|
|
32
|
+
// if (!exchange || !pair || !method || !price || !amount) {
|
|
33
|
+
// ws.send_json('limit trade params (exchange, pair, method, price, amount) required')
|
|
34
|
+
// return
|
|
35
|
+
// }
|
|
36
|
+
// orders.limit_trade(exchange, pair, method, price, amount)
|
|
37
|
+
// } else if (message.action && message.action === 'limit-trade-all') {
|
|
38
|
+
// let { pair, method, price, amount } = message.params
|
|
39
|
+
// if (!pair || !method || !price || !amount) {
|
|
40
|
+
// ws.send_json('limit trade all params (pair, method, price, amount) required')
|
|
41
|
+
// return
|
|
42
|
+
// }
|
|
43
|
+
// orders.limit_trade_all(pair, method, price, amount)
|
|
44
|
+
// } else if (message.action && message.action === 'market-trade') {
|
|
45
|
+
// let { exchange, pair, method, amount } = message.params
|
|
46
|
+
// if (!exchange || !pair || !method || !amount) {
|
|
47
|
+
// ws.send_json('market trade params (exchange, pair, method, amount) required')
|
|
48
|
+
// return
|
|
49
|
+
// }
|
|
50
|
+
// orders.market_trade(exchange, pair, method, amount)
|
|
51
|
+
// } else if (message.action && message.action === 'market-trade-all') {
|
|
52
|
+
// let { pair, method, amount } = message.params
|
|
53
|
+
// if (!pair || !method || !amount) {
|
|
54
|
+
// ws.send_json('limit trade all params (pair, method, amount) required')
|
|
55
|
+
// return
|
|
56
|
+
// }
|
|
57
|
+
// orders.market_trade_all(pair, method, amount)
|
|
58
|
+
// } else if (message.action && message.action === 'cancel-order') {
|
|
59
|
+
// let { exchange, order } = message.params
|
|
60
|
+
// if (!exchange || !order) {
|
|
61
|
+
// ws.send_json('cancel order params (exchange, order) required')
|
|
62
|
+
// return
|
|
63
|
+
// }
|
|
64
|
+
// orders.cancel_order(exchange, order)
|
|
65
|
+
// } else if (message.action && message.action === 'get-order-info-all') {
|
|
66
|
+
// ws.send_json(orders.get_order_info_all())
|
|
67
|
+
// }
|
|
68
|
+
// })
|
|
69
|
+
// })
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
+
"version": "1.8.6",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/icgio/icg-exchanges-wrapper.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/icgio/icg-exchanges-wrapper/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@icgio/icg-exchanges": "^1.25.11",
|
|
21
|
+
"@icgio/icg-exchanges-data": "^1.5.25",
|
|
22
|
+
"@icgio/icg-utils": "^1.6.21",
|
|
23
|
+
"influx": "^5.7.0",
|
|
24
|
+
"lodash": "^4.17.20",
|
|
25
|
+
"needle": "^2.6.0",
|
|
26
|
+
"uuid": "^3.4.0",
|
|
27
|
+
"ws": "^6.2.1"
|
|
28
|
+
}
|
|
29
|
+
}
|