-
-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathindex.d.ts
More file actions
187 lines (169 loc) · 4.23 KB
/
index.d.ts
File metadata and controls
187 lines (169 loc) · 4.23 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/**
* node-talib - Technical Analysis Library
* TypeScript definitions
*/
declare module 'talib' {
/**
* TA-Lib version string
*/
export const version: string;
/**
* Moving Average Types
*/
export enum MAType {
SMA = 0, // Simple Moving Average
EMA = 1, // Exponential Moving Average
WMA = 2, // Weighted Moving Average
DEMA = 3, // Double Exponential Moving Average
TEMA = 4, // Triple Exponential Moving Average
TRIMA = 5, // Triangular Moving Average
KAMA = 6, // Kaufman Adaptive Moving Average
MAMA = 7, // MESA Adaptive Moving Average
T3 = 8 // Triple Exponential Moving Average (T3)
}
/**
* Function Unstable Period IDs
*/
export enum FunctionUnstId {
TA_FUNC_UNST_ADX = 0,
TA_FUNC_UNST_ADXR = 1,
TA_FUNC_UNST_ATR = 2,
TA_FUNC_UNST_CMO = 3,
TA_FUNC_UNST_DX = 4,
TA_FUNC_UNST_EMA = 5,
TA_FUNC_UNST_HT_DCPERIOD = 6,
TA_FUNC_UNST_HT_DCPHASE = 7,
TA_FUNC_UNST_HT_PHASOR = 8,
TA_FUNC_UNST_HT_SINE = 9,
TA_FUNC_UNST_HT_TRENDLINE = 10,
TA_FUNC_UNST_HT_TRENDMODE = 11,
TA_FUNC_UNST_IMI = 12,
TA_FUNC_UNST_KAMA = 13,
TA_FUNC_UNST_MAMA = 14,
TA_FUNC_UNST_MFI = 15,
TA_FUNC_UNST_MINUS_DI = 16,
TA_FUNC_UNST_MINUS_DM = 17,
TA_FUNC_UNST_NATR = 18,
TA_FUNC_UNST_PLUS_DI = 19,
TA_FUNC_UNST_PLUS_DM = 20,
TA_FUNC_UNST_RSI = 21,
TA_FUNC_UNST_STOCHRSI = 22,
TA_FUNC_UNST_T3 = 23,
TA_FUNC_UNST_ALL = 24,
TA_FUNC_UNST_NONE = -1
}
/**
* Market data input
*/
export interface MarketData {
open?: number[];
high?: number[];
low?: number[];
close?: number[];
volume?: number[];
openInterest?: number[];
}
/**
* Function input parameter info
*/
export interface InputParameterInfo {
name: string;
type: 'price' | 'real' | 'integer';
flags?: string[];
}
/**
* Function optional input parameter info
*/
export interface OptInputParameterInfo {
name: string;
displayName: string;
defaultValue: number;
hint: string;
type: 'real_range' | 'real_list' | 'integer_range' | 'integer_list';
flags?: string[];
}
/**
* Function output parameter info
*/
export interface OutputParameterInfo {
name: string;
type: 'real' | 'integer';
flags?: string[];
}
/**
* Function explanation
*/
export interface FunctionExplanation {
name: string;
group: string;
hint: string;
inputs: InputParameterInfo[];
optInputs: OptInputParameterInfo[];
outputs: OutputParameterInfo[];
}
/**
* Execute parameters
*/
export interface ExecuteParameters extends MarketData {
name: string;
startIdx: number;
endIdx: number;
[key: string]: any; // For optional parameters like optInTimePeriod
}
/**
* Execute result
*/
export interface ExecuteResult {
begIndex: number;
nbElement: number;
result: {
[key: string]: number[];
};
}
/**
* Execute error result
*/
export interface ExecuteError {
error: string;
}
/**
* Array of all available functions
*/
export const functions: FunctionExplanation[];
/**
* Object containing function unstable period IDs
*/
export const functionUnstIds: Record<string, number>;
/**
* Explain a function's parameters and usage
* @param functionName - Name of the TA-Lib function
* @returns Function explanation object
*/
export function explain(functionName: string): FunctionExplanation;
/**
* Execute a TA-Lib function (async with callback)
* @param params - Execution parameters
* @param callback - Callback function
*/
export function execute(
params: ExecuteParameters,
callback: (err: ExecuteError | null, result?: ExecuteResult) => void
): void;
/**
* Execute a TA-Lib function (synchronous)
* @param params - Execution parameters
* @returns Execution result
*/
export function execute(params: ExecuteParameters): ExecuteResult;
/**
* Set unstable period for a function
* @param functionUnstId - Function unstable ID
* @param unstablePeriod - Unstable period value
* @returns Success boolean
*/
export function setUnstablePeriod(
functionUnstId: number,
unstablePeriod: number
): boolean;
}
export = talib;