-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.js
53 lines (48 loc) · 1.67 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"use strict";
import utils from "./lib/utilities.js";
import requestTypes from "./lib/types.js";
const twelvedata = (config) => {
if (!config) {
throw new Error("Missing config");
}
// Check for API Key
if (config.key === undefined) {
throw new Error("Missing config settings: key");
}
const utilities = new utils(config.key);
return {
apiUsage: utilities.createFunc("apiUsage", requestTypes.get),
complexData: utilities.createFunc("complexData", requestTypes.post),
cryptocurrencies: utilities.createFunc(
"cryptocurrencies",
requestTypes.get
),
cryptocurrencyExchanges: utilities.createFunc(
"cryptocurrencyExchanges",
requestTypes.get
),
earliestTimestamp: utilities.createFunc(
"earliestTimestamp",
requestTypes.get
),
earnings: utilities.createFunc("earnings", requestTypes.get),
earningsCalendar: utilities.createFunc(
"earningsCalendar",
requestTypes.get
),
etf: utilities.createFunc("etf", requestTypes.get),
exchanges: utilities.createFunc("exchanges", requestTypes.get),
forexPairs: utilities.createFunc("forexPairs", requestTypes.get),
indices: utilities.createFunc("indices", requestTypes.get),
price: utilities.createFunc("price", requestTypes.get),
quote: utilities.createFunc("quote", requestTypes.get),
stocks: utilities.createFunc("stocks", requestTypes.get),
symbolSearch: utilities.createFunc("symbolSearch", requestTypes.get),
technicalIndicators: utilities.createFunc(
"technicalIndicators",
requestTypes.get
),
timeSeries: utilities.createFunc("timeSeries", requestTypes.get),
};
};
export default twelvedata;