forked from tradex-app/TradeX-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtalib3.js
More file actions
36 lines (25 loc) · 714 Bytes
/
talib3.js
File metadata and controls
36 lines (25 loc) · 714 Bytes
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
import * as talib from './node_modules/talib-web/lib/index.esm'
import data from './data/1minute.js'
import { isPromise } from './src/utils/typeChecks';
const wasm = "./node_modules/talib-web/lib/talib.wasm"
// async function main() {
// try {
// const wait = function(v, cb) {
// if (!isPromise(v)) cb(v)
// set
// }
const ta = talib.init(wasm);
if(isPromise(ta)) console.log("ta === promise")
const inReal = []
let i = 0
for (let v of data.ohlcv) {
if (i++ > 9)
inReal.push(v[4])
}
const result = talib.MACD({inReal: inReal})
document.write(JSON.stringify(result))
// } catch (e) {
// console.error(e)
// }
// };
await main()