-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
37 lines (32 loc) · 1.1 KB
/
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
const { sympolPrice } = require('./module/price/price')
const { historicalPrice } = require('./module/historical/historical')
const { predict } = require('./lab/brain')
const { get } = require('./helper/fetch')
const link = 'https://min-api.cryptocompare.com/data/'
const data = {
day: link + 'histoday',
hour: link + 'histohour',
minute: link + 'histominute'
}
module.exports = {
MKT: function (api) {
// This Function for initialize the api
this.apikey = () => {
return `&apikey=${api}`
}
// this Function fireup exchange query for make request using your api and your query and return promise reponse
// you can access reponse data with then((response)=>Json.stringify(response.data))
this.exchange = dict => {
const requestLink = link + sympolPrice(dict) + this.apikey()
return get(requestLink)
}
this.historical = dict => {
const historicalType = data[dict.apiType]
const requestLink = historicalType + historicalPrice(dict) + this.apikey()
return get(requestLink)
}
this.predict = options => {
return predict(options)
}
}
}