-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·42 lines (38 loc) · 995 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* @name index.js
* @author Christopher Konopka
* @version v0.0.1
* @summary Unofficial Coinglass API for Node.js
*/
/**
* Libraries
*/
const fs = require("fs");
const axios = require('axios');
/**
* coinglass
*/
function getCoinglassData(obj) {
console.log("getCoinglassData - Start - " + obj.route);
var output = new Promise(async(resolve, reject) => {
try {
response = await axios.get("https://open-api.coinglass.com/api/pro/v1/" + obj.route + "/" + obj.query, {
headers: {
'coinglassSecret': obj.key,
},
params: obj
});
} catch (ex) {
response = null;
ohta.fukuisan.info(ex);
reject(ex);
}
if (response) {
const json = response.data;
resolve(json);
}
});
console.log("getCoinglassData - End - " + obj.route);
return output
}
module.exports = { getCoinglassData }