ohlcv-ai 1.0.9 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -202
- package/dist/index.d.ts +160 -43
- package/dist/index.js +205 -32
- package/dist/index.mjs +1182 -655
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,17 +14,19 @@ export declare class AliyunAI {
|
|
|
14
14
|
/**
|
|
15
15
|
* Simplest method: single conversation
|
|
16
16
|
* @param message - User message
|
|
17
|
+
* @param i18n - Language restriction for AI response
|
|
17
18
|
* @param options - Chat options
|
|
18
19
|
* @returns AI response
|
|
19
20
|
*/
|
|
20
|
-
chat(message: string, options?: AliYunChatOptions): Promise<string>;
|
|
21
|
+
chat(message: string, i18n: 'en' | 'cn', options?: AliYunChatOptions): Promise<string>;
|
|
21
22
|
/**
|
|
22
23
|
* Multi-turn conversation
|
|
23
24
|
* @param messages - Message history
|
|
25
|
+
* @param i18n - Language restriction for AI response
|
|
24
26
|
* @param options - Chat options
|
|
25
27
|
* @returns Complete API response
|
|
26
28
|
*/
|
|
27
|
-
chatCompletion(messages: ChatMessage[], options?: {
|
|
29
|
+
chatCompletion(messages: ChatMessage[], i18n: 'en' | 'cn', options?: {
|
|
28
30
|
temperature?: number;
|
|
29
31
|
maxTokens?: number;
|
|
30
32
|
stream?: boolean;
|
|
@@ -34,13 +36,58 @@ export declare class AliyunAI {
|
|
|
34
36
|
* Streaming conversation (only supports OpenAI format)
|
|
35
37
|
* @param messages - Message history
|
|
36
38
|
* @param callback - Streaming callback function
|
|
39
|
+
* @param i18n - Language restriction for AI response
|
|
37
40
|
* @param options - Chat options
|
|
38
41
|
*/
|
|
39
|
-
chatStream(messages: ChatMessage[], callback: AliYunStreamCallback, options?: {
|
|
42
|
+
chatStream(messages: ChatMessage[], callback: AliYunStreamCallback, i18n: 'en' | 'cn', options?: {
|
|
40
43
|
temperature?: number;
|
|
41
44
|
maxTokens?: number;
|
|
42
45
|
modelType?: AliYunModelType;
|
|
43
46
|
}): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Analyze OHLCV data and return AI analysis results
|
|
49
|
+
* @param ohlcvArray - OHLCV data array
|
|
50
|
+
* @param i18n - Language restriction for AI response
|
|
51
|
+
* @param analysisType - Analysis type (optional, default: "comprehensive")
|
|
52
|
+
* - "trend": Trend analysis
|
|
53
|
+
* - "volume": Volume analysis
|
|
54
|
+
* - "technical": Technical analysis
|
|
55
|
+
* - "comprehensive": Comprehensive analysis
|
|
56
|
+
* @param message - User's subjective request or specific question (optional)
|
|
57
|
+
* @param options - Chat options
|
|
58
|
+
* @returns AI analysis result of OHLCV data (text description)
|
|
59
|
+
*/
|
|
60
|
+
analyzeOHLCV(ohlcvArray: OHLCV[], i18n: 'en' | 'cn', analysisType?: 'trend' | 'volume' | 'technical' | 'comprehensive', message?: string, options?: AliYunChatOptions): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Enhanced version: Analyze OHLCV and return structured results (optional)
|
|
63
|
+
* @param ohlcvArray - OHLCV data array
|
|
64
|
+
* @param i18n - Language restriction for AI response
|
|
65
|
+
* @param analysisType - Analysis type
|
|
66
|
+
* @param message - User's subjective request or specific question
|
|
67
|
+
* @param structured - Whether to return structured results (default: false)
|
|
68
|
+
* @param options - Chat options
|
|
69
|
+
* @returns AI analysis results
|
|
70
|
+
*/
|
|
71
|
+
analyzeOHLCVEnhanced(ohlcvArray: OHLCV[], i18n: 'en' | 'cn', analysisType?: 'trend' | 'volume' | 'technical' | 'comprehensive', message?: string, structured?: boolean, options?: AliYunChatOptions): Promise<string | {
|
|
72
|
+
summary: string;
|
|
73
|
+
details: string[];
|
|
74
|
+
recommendations: string[];
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Specialized method for processing OHLCV arrays
|
|
78
|
+
* @param ohlcvArray - OHLCV data array
|
|
79
|
+
* @param i18n - Language restriction for AI response
|
|
80
|
+
* @param instructions - Processing instructions, supports Chinese and English (optional, default: "Based on these OHLCV data, predict the next period")
|
|
81
|
+
* @param count - Number of OHLCV data items to return (optional, default: 1)
|
|
82
|
+
* @param options - Chat options
|
|
83
|
+
* @returns Predicted OHLCV array
|
|
84
|
+
*/
|
|
85
|
+
predictingOHLCV(ohlcvArray: OHLCV[], i18n: 'en' | 'cn', instructions?: string, count?: number, options?: AliYunChatOptions): Promise<OHLCV[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Parse AI returned OHLCV response
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
private parseOHLCVResponse;
|
|
44
91
|
/**
|
|
45
92
|
* Switch model
|
|
46
93
|
* @param modelType - New model type
|
|
@@ -69,20 +116,6 @@ export declare class AliyunAI {
|
|
|
69
116
|
private makeRequest;
|
|
70
117
|
private makeStreamRequest;
|
|
71
118
|
private extractContent;
|
|
72
|
-
/**
|
|
73
|
-
* Specialized method for processing OHLCV arrays
|
|
74
|
-
* @param ohlcvArray - OHLCV data array
|
|
75
|
-
* @param instructions - Processing instructions, supports Chinese and English (optional, default: "Based on these OHLCV data, predict the next period")
|
|
76
|
-
* @param count - Number of OHLCV data items to return (optional, default: 1)
|
|
77
|
-
* @param options - Chat options
|
|
78
|
-
* @returns Predicted OHLCV array
|
|
79
|
-
*/
|
|
80
|
-
predictingOHLCV(ohlcvArray: OHLCV[], instructions?: string, count?: number, options?: AliYunChatOptions): Promise<OHLCV[]>;
|
|
81
|
-
/**
|
|
82
|
-
* Parse AI returned OHLCV response
|
|
83
|
-
* @private
|
|
84
|
-
*/
|
|
85
|
-
private parseOHLCVResponse;
|
|
86
119
|
}
|
|
87
120
|
|
|
88
121
|
export declare interface AliYunChatOptions {
|
|
@@ -90,7 +123,6 @@ export declare interface AliYunChatOptions {
|
|
|
90
123
|
maxTokens?: number;
|
|
91
124
|
stream?: boolean;
|
|
92
125
|
systemPrompt?: string;
|
|
93
|
-
modelType?: AliYunModelType;
|
|
94
126
|
}
|
|
95
127
|
|
|
96
128
|
export declare interface AliyunConfig {
|
|
@@ -182,26 +214,79 @@ export declare class DeepSeekAI {
|
|
|
182
214
|
*/
|
|
183
215
|
constructor(config: DeepSeekConfig);
|
|
184
216
|
/**
|
|
185
|
-
* Simplest method: single conversation
|
|
217
|
+
* Simplest method: single conversation with i18n support
|
|
186
218
|
* @param message - User message
|
|
219
|
+
* @param i18n - Language restriction for AI response
|
|
187
220
|
* @param options - Chat options
|
|
188
221
|
* @returns AI response
|
|
189
222
|
*/
|
|
190
|
-
chat(message: string, options?: DeepSeekChatOptions): Promise<string>;
|
|
223
|
+
chat(message: string, i18n: 'en' | 'cn', options?: DeepSeekChatOptions): Promise<string>;
|
|
191
224
|
/**
|
|
192
|
-
* Multi-turn conversation
|
|
225
|
+
* Multi-turn conversation with i18n support
|
|
193
226
|
* @param messages - Message history
|
|
227
|
+
* @param i18n - Language restriction for AI response
|
|
194
228
|
* @param options - Chat options
|
|
195
229
|
* @returns Complete API response
|
|
196
230
|
*/
|
|
197
|
-
chatCompletion(messages: DeepSeekChatMessage[], options?:
|
|
231
|
+
chatCompletion(messages: DeepSeekChatMessage[], i18n: 'en' | 'cn', options?: {
|
|
232
|
+
temperature?: number;
|
|
233
|
+
maxTokens?: number;
|
|
234
|
+
stream?: boolean;
|
|
235
|
+
modelType?: DeepSeekModelType;
|
|
236
|
+
topP?: number;
|
|
237
|
+
frequencyPenalty?: number;
|
|
238
|
+
presencePenalty?: number;
|
|
239
|
+
stop?: string[];
|
|
240
|
+
tools?: any[];
|
|
241
|
+
toolChoice?: string | object;
|
|
242
|
+
}): Promise<any>;
|
|
198
243
|
/**
|
|
199
|
-
* Streaming conversation
|
|
244
|
+
* Streaming conversation with i18n support
|
|
200
245
|
* @param messages - Message history
|
|
201
246
|
* @param callback - Streaming callback function
|
|
247
|
+
* @param i18n - Language restriction for AI response
|
|
202
248
|
* @param options - Chat options
|
|
203
249
|
*/
|
|
204
|
-
chatStream(messages: DeepSeekChatMessage[], callback: DeepSeekStreamCallback, options?:
|
|
250
|
+
chatStream(messages: DeepSeekChatMessage[], callback: DeepSeekStreamCallback, i18n: 'en' | 'cn', options?: {
|
|
251
|
+
temperature?: number;
|
|
252
|
+
maxTokens?: number;
|
|
253
|
+
modelType?: DeepSeekModelType;
|
|
254
|
+
topP?: number;
|
|
255
|
+
frequencyPenalty?: number;
|
|
256
|
+
presencePenalty?: number;
|
|
257
|
+
stop?: string[];
|
|
258
|
+
tools?: any[];
|
|
259
|
+
toolChoice?: string | object;
|
|
260
|
+
}): Promise<void>;
|
|
261
|
+
/**
|
|
262
|
+
* Analyze OHLCV data and return AI analysis results (text description)
|
|
263
|
+
* @param ohlcvArray - OHLCV data array
|
|
264
|
+
* @param i18n - Language restriction for AI response
|
|
265
|
+
* @param analysisType - Analysis type (optional, default: "comprehensive")
|
|
266
|
+
* - "trend": Trend analysis
|
|
267
|
+
* - "volume": Volume analysis
|
|
268
|
+
* - "technical": Technical analysis
|
|
269
|
+
* - "comprehensive": Comprehensive analysis
|
|
270
|
+
* @param message - User's subjective request or specific question (optional)
|
|
271
|
+
* @param options - Chat options
|
|
272
|
+
* @returns AI analysis result of OHLCV data (text description)
|
|
273
|
+
*/
|
|
274
|
+
analyzeOHLCV(ohlcvArray: OHLCV[], i18n: 'en' | 'cn', analysisType?: 'trend' | 'volume' | 'technical' | 'comprehensive', message?: string, options?: DeepSeekChatOptions): Promise<string>;
|
|
275
|
+
/**
|
|
276
|
+
* Enhanced version: Analyze OHLCV and return structured results (optional)
|
|
277
|
+
* @param ohlcvArray - OHLCV data array
|
|
278
|
+
* @param i18n - Language restriction for AI response
|
|
279
|
+
* @param analysisType - Analysis type
|
|
280
|
+
* @param message - User's subjective request or specific question
|
|
281
|
+
* @param structured - Whether to return structured results (default: false)
|
|
282
|
+
* @param options - Chat options
|
|
283
|
+
* @returns AI analysis results
|
|
284
|
+
*/
|
|
285
|
+
analyzeOHLCVEnhanced(ohlcvArray: OHLCV[], i18n: 'en' | 'cn', analysisType?: 'trend' | 'volume' | 'technical' | 'comprehensive', message?: string, structured?: boolean, options?: DeepSeekChatOptions): Promise<string | {
|
|
286
|
+
summary: string;
|
|
287
|
+
details: string[];
|
|
288
|
+
recommendations: string[];
|
|
289
|
+
}>;
|
|
205
290
|
/**
|
|
206
291
|
* Specialized method for processing OHLCV arrays
|
|
207
292
|
* @param ohlcvArray - OHLCV data array
|
|
@@ -225,7 +310,7 @@ export declare class DeepSeekAI {
|
|
|
225
310
|
description?: string;
|
|
226
311
|
};
|
|
227
312
|
/**
|
|
228
|
-
* Test connection
|
|
313
|
+
* Test connection with i18n support
|
|
229
314
|
* @returns Connection test result
|
|
230
315
|
*/
|
|
231
316
|
testConnection(): Promise<{
|
|
@@ -253,13 +338,13 @@ export declare interface DeepSeekChatOptions {
|
|
|
253
338
|
maxTokens?: number;
|
|
254
339
|
stream?: boolean;
|
|
255
340
|
systemPrompt?: string;
|
|
256
|
-
modelType?: DeepSeekModelType;
|
|
257
341
|
topP?: number;
|
|
258
342
|
frequencyPenalty?: number;
|
|
259
343
|
presencePenalty?: number;
|
|
260
344
|
stop?: string[];
|
|
261
345
|
tools?: any[];
|
|
262
346
|
toolChoice?: string | object;
|
|
347
|
+
i18n?: 'en' | 'cn';
|
|
263
348
|
}
|
|
264
349
|
|
|
265
350
|
export declare interface DeepSeekConfig {
|
|
@@ -389,19 +474,21 @@ export declare class OpenAI {
|
|
|
389
474
|
*/
|
|
390
475
|
constructor(config: OpenAIConfig);
|
|
391
476
|
/**
|
|
392
|
-
* Simplest method: single conversation
|
|
477
|
+
* Simplest method: single conversation with i18n support
|
|
393
478
|
* @param message - User message
|
|
479
|
+
* @param i18n - Language restriction for AI response
|
|
394
480
|
* @param options - Chat options
|
|
395
481
|
* @returns AI response
|
|
396
482
|
*/
|
|
397
|
-
chat(message: string, options?: OpenAIChatOptions): Promise<string>;
|
|
483
|
+
chat(message: string, i18n: 'en' | 'cn', options?: OpenAIChatOptions): Promise<string>;
|
|
398
484
|
/**
|
|
399
|
-
* Multi-turn conversation
|
|
485
|
+
* Multi-turn conversation with i18n support
|
|
400
486
|
* @param messages - Message history
|
|
487
|
+
* @param i18n - Language restriction for AI response
|
|
401
488
|
* @param options - Chat options
|
|
402
489
|
* @returns Complete API response
|
|
403
490
|
*/
|
|
404
|
-
chatCompletion(messages: ChatMessage[], options?: {
|
|
491
|
+
chatCompletion(messages: ChatMessage[], i18n: 'en' | 'cn', options?: {
|
|
405
492
|
temperature?: number;
|
|
406
493
|
maxTokens?: number;
|
|
407
494
|
stream?: boolean;
|
|
@@ -412,12 +499,13 @@ export declare class OpenAI {
|
|
|
412
499
|
stop?: string[];
|
|
413
500
|
}): Promise<any>;
|
|
414
501
|
/**
|
|
415
|
-
* Streaming conversation
|
|
502
|
+
* Streaming conversation with i18n support
|
|
416
503
|
* @param messages - Message history
|
|
417
504
|
* @param callback - Streaming callback function
|
|
505
|
+
* @param i18n - Language restriction for AI response
|
|
418
506
|
* @param options - Chat options
|
|
419
507
|
*/
|
|
420
|
-
chatStream(messages: ChatMessage[], callback: OpenAIStreamCallback, options?: {
|
|
508
|
+
chatStream(messages: ChatMessage[], callback: OpenAIStreamCallback, i18n: 'en' | 'cn', options?: {
|
|
421
509
|
temperature?: number;
|
|
422
510
|
maxTokens?: number;
|
|
423
511
|
modelType?: OpenAIModelType;
|
|
@@ -426,6 +514,44 @@ export declare class OpenAI {
|
|
|
426
514
|
presencePenalty?: number;
|
|
427
515
|
stop?: string[];
|
|
428
516
|
}): Promise<void>;
|
|
517
|
+
/**
|
|
518
|
+
* Analyze OHLCV data and return AI analysis results (text description)
|
|
519
|
+
* @param ohlcvArray - OHLCV data array
|
|
520
|
+
* @param i18n - Language restriction for AI response
|
|
521
|
+
* @param analysisType - Analysis type (optional, default: "comprehensive")
|
|
522
|
+
* - "trend": Trend analysis
|
|
523
|
+
* - "volume": Volume analysis
|
|
524
|
+
* - "technical": Technical analysis
|
|
525
|
+
* - "comprehensive": Comprehensive analysis
|
|
526
|
+
* @param message - User's subjective request or specific question (optional)
|
|
527
|
+
* @param options - Chat options
|
|
528
|
+
* @returns AI analysis result of OHLCV data (text description)
|
|
529
|
+
*/
|
|
530
|
+
analyzeOHLCV(ohlcvArray: OHLCV[], i18n: 'en' | 'cn', analysisType?: 'trend' | 'volume' | 'technical' | 'comprehensive', message?: string, options?: OpenAIChatOptions): Promise<string>;
|
|
531
|
+
/**
|
|
532
|
+
* Enhanced version: Analyze OHLCV and return structured results (optional)
|
|
533
|
+
* @param ohlcvArray - OHLCV data array
|
|
534
|
+
* @param i18n - Language restriction for AI response
|
|
535
|
+
* @param analysisType - Analysis type
|
|
536
|
+
* @param message - User's subjective request or specific question
|
|
537
|
+
* @param structured - Whether to return structured results (default: false)
|
|
538
|
+
* @param options - Chat options
|
|
539
|
+
* @returns AI analysis results
|
|
540
|
+
*/
|
|
541
|
+
analyzeOHLCVEnhanced(ohlcvArray: OHLCV[], i18n: 'en' | 'cn', analysisType?: 'trend' | 'volume' | 'technical' | 'comprehensive', message?: string, structured?: boolean, options?: OpenAIChatOptions): Promise<string | {
|
|
542
|
+
summary: string;
|
|
543
|
+
details: string[];
|
|
544
|
+
recommendations: string[];
|
|
545
|
+
}>;
|
|
546
|
+
/**
|
|
547
|
+
* Specialized method for processing OHLCV arrays (predict future values)
|
|
548
|
+
* @param ohlcvArray - OHLCV data array
|
|
549
|
+
* @param instructions - Processing instructions, supports Chinese and English (optional, default: "Based on these OHLCV data, predict the next period")
|
|
550
|
+
* @param count - Number of OHLCV data items to return (optional, default: 1)
|
|
551
|
+
* @param options - Chat options
|
|
552
|
+
* @returns Predicted OHLCV array
|
|
553
|
+
*/
|
|
554
|
+
predictingOHLCV(ohlcvArray: OHLCV[], instructions?: string, count?: number, options?: OpenAIChatOptions): Promise<OHLCV[]>;
|
|
429
555
|
/**
|
|
430
556
|
* Generate images using DALL-E
|
|
431
557
|
* @param prompt - Image generation prompt
|
|
@@ -498,7 +624,7 @@ export declare class OpenAI {
|
|
|
498
624
|
description?: string;
|
|
499
625
|
};
|
|
500
626
|
/**
|
|
501
|
-
* Test connection
|
|
627
|
+
* Test connection with i18n support
|
|
502
628
|
* @returns Connection test result
|
|
503
629
|
*/
|
|
504
630
|
testConnection(): Promise<{
|
|
@@ -524,15 +650,6 @@ export declare class OpenAI {
|
|
|
524
650
|
private makeFormDataRequest;
|
|
525
651
|
private makeStreamRequest;
|
|
526
652
|
private extractContent;
|
|
527
|
-
/**
|
|
528
|
-
* Specialized method for processing OHLCV arrays
|
|
529
|
-
* @param ohlcvArray - OHLCV data array
|
|
530
|
-
* @param instructions - Processing instructions (optional, default: "Based on these OHLCV data, predict the next period")
|
|
531
|
-
* @param count - Number of OHLCV data items to return (optional, default: 1)
|
|
532
|
-
* @param options - Chat options
|
|
533
|
-
* @returns Predicted OHLCV array
|
|
534
|
-
*/
|
|
535
|
-
analyzeOHLCV(ohlcvArray: OHLCV[], instructions?: string, count?: number, options?: OpenAIChatOptions): Promise<OHLCV[]>;
|
|
536
653
|
/**
|
|
537
654
|
* Parse AI returned OHLCV response
|
|
538
655
|
* @private
|
|
@@ -547,11 +664,11 @@ export declare interface OpenAIChatOptions {
|
|
|
547
664
|
maxTokens?: number;
|
|
548
665
|
stream?: boolean;
|
|
549
666
|
systemPrompt?: string;
|
|
550
|
-
modelType?: OpenAIModelType;
|
|
551
667
|
topP?: number;
|
|
552
668
|
frequencyPenalty?: number;
|
|
553
669
|
presencePenalty?: number;
|
|
554
670
|
stop?: string[];
|
|
671
|
+
i18n?: 'en' | 'cn';
|
|
555
672
|
}
|
|
556
673
|
|
|
557
674
|
export declare interface OpenAIConfig {
|