@backtest-kit/ollama 14.1.0 → 15.0.0
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/README.md +287 -287
- package/build/index.cjs +224 -160
- package/build/index.mjs +226 -162
- package/package.json +114 -112
- package/types.d.ts +16 -14
package/package.json
CHANGED
|
@@ -1,112 +1,114 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@backtest-kit/ollama",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Multi-provider LLM inference library for AI-powered trading strategies. Supports 10+ providers including OpenAI, Claude, DeepSeek, Grok, Mistral with unified API and automatic token rotation.",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Petr Tripolsky",
|
|
7
|
-
"email": "tripolskypetr@gmail.com",
|
|
8
|
-
"url": "https://github.com/tripolskypetr"
|
|
9
|
-
},
|
|
10
|
-
"funding": {
|
|
11
|
-
"type": "individual",
|
|
12
|
-
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
-
},
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"homepage": "https://backtest-kit.github.io/documents/article_07_ai_news_trading_signals.html",
|
|
16
|
-
"keywords": [
|
|
17
|
-
"llm",
|
|
18
|
-
"openai",
|
|
19
|
-
"claude",
|
|
20
|
-
"deepseek",
|
|
21
|
-
"grok",
|
|
22
|
-
"mistral",
|
|
23
|
-
"perplexity",
|
|
24
|
-
"cohere",
|
|
25
|
-
"ollama",
|
|
26
|
-
"huggingface",
|
|
27
|
-
"ai",
|
|
28
|
-
"machine-learning",
|
|
29
|
-
"trading-bot",
|
|
30
|
-
"algorithmic-trading",
|
|
31
|
-
"quantitative-trading",
|
|
32
|
-
"cryptocurrency",
|
|
33
|
-
"trading-signals",
|
|
34
|
-
"multi-provider",
|
|
35
|
-
"inference",
|
|
36
|
-
"structured-output",
|
|
37
|
-
"token-rotation",
|
|
38
|
-
"backtest",
|
|
39
|
-
"risk-management"
|
|
40
|
-
],
|
|
41
|
-
"files": [
|
|
42
|
-
"build",
|
|
43
|
-
"types.d.ts",
|
|
44
|
-
"README.md"
|
|
45
|
-
],
|
|
46
|
-
"repository": {
|
|
47
|
-
"type": "git",
|
|
48
|
-
"url": "https://github.com/tripolskypetr/backtest-kit",
|
|
49
|
-
"documentation": "https://github.com/tripolskypetr/backtest-kit/tree/master/docs"
|
|
50
|
-
},
|
|
51
|
-
"bugs": {
|
|
52
|
-
"url": "https://github.com/tripolskypetr/backtest-kit/issues"
|
|
53
|
-
},
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "rollup -c"
|
|
56
|
-
},
|
|
57
|
-
"main": "build/index.cjs",
|
|
58
|
-
"module": "build/index.mjs",
|
|
59
|
-
"source": "src/index.ts",
|
|
60
|
-
"types": "./types.d.ts",
|
|
61
|
-
"exports": {
|
|
62
|
-
"require": "./build/index.cjs",
|
|
63
|
-
"types": "./types.d.ts",
|
|
64
|
-
"import": "./build/index.mjs",
|
|
65
|
-
"default": "./build/index.cjs"
|
|
66
|
-
},
|
|
67
|
-
"devDependencies": {
|
|
68
|
-
"@huggingface/inference": "4.7.1",
|
|
69
|
-
"@langchain/core": "0.3.57",
|
|
70
|
-
"@langchain/xai": "0.0.2",
|
|
71
|
-
"@rollup/plugin-typescript": "11.1.6",
|
|
72
|
-
"@types/node": "22.9.0",
|
|
73
|
-
"glob": "11.0.1",
|
|
74
|
-
"ollama": "0.6.0",
|
|
75
|
-
"openai": "4.97.0",
|
|
76
|
-
"groq-sdk": "0.37.0",
|
|
77
|
-
"rimraf": "6.0.1",
|
|
78
|
-
"rollup": "3.29.5",
|
|
79
|
-
"rollup-plugin-dts": "6.1.1",
|
|
80
|
-
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
81
|
-
"ts-morph": "27.0.2",
|
|
82
|
-
"tslib": "2.7.0",
|
|
83
|
-
"typedoc": "0.27.9",
|
|
84
|
-
"backtest-kit": "
|
|
85
|
-
"worker-testbed": "
|
|
86
|
-
},
|
|
87
|
-
"peerDependencies": {
|
|
88
|
-
"@huggingface/inference": "^4.7.1",
|
|
89
|
-
"@langchain/core": "^0.3.57",
|
|
90
|
-
"@langchain/
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@backtest-kit/ollama",
|
|
3
|
+
"version": "15.0.0",
|
|
4
|
+
"description": "Multi-provider LLM inference library for AI-powered trading strategies. Supports 10+ providers including OpenAI, Claude, DeepSeek, Grok, Mistral with unified API and automatic token rotation.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Petr Tripolsky",
|
|
7
|
+
"email": "tripolskypetr@gmail.com",
|
|
8
|
+
"url": "https://github.com/tripolskypetr"
|
|
9
|
+
},
|
|
10
|
+
"funding": {
|
|
11
|
+
"type": "individual",
|
|
12
|
+
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://backtest-kit.github.io/documents/article_07_ai_news_trading_signals.html",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"llm",
|
|
18
|
+
"openai",
|
|
19
|
+
"claude",
|
|
20
|
+
"deepseek",
|
|
21
|
+
"grok",
|
|
22
|
+
"mistral",
|
|
23
|
+
"perplexity",
|
|
24
|
+
"cohere",
|
|
25
|
+
"ollama",
|
|
26
|
+
"huggingface",
|
|
27
|
+
"ai",
|
|
28
|
+
"machine-learning",
|
|
29
|
+
"trading-bot",
|
|
30
|
+
"algorithmic-trading",
|
|
31
|
+
"quantitative-trading",
|
|
32
|
+
"cryptocurrency",
|
|
33
|
+
"trading-signals",
|
|
34
|
+
"multi-provider",
|
|
35
|
+
"inference",
|
|
36
|
+
"structured-output",
|
|
37
|
+
"token-rotation",
|
|
38
|
+
"backtest",
|
|
39
|
+
"risk-management"
|
|
40
|
+
],
|
|
41
|
+
"files": [
|
|
42
|
+
"build",
|
|
43
|
+
"types.d.ts",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/tripolskypetr/backtest-kit",
|
|
49
|
+
"documentation": "https://github.com/tripolskypetr/backtest-kit/tree/master/docs"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/tripolskypetr/backtest-kit/issues"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "rollup -c"
|
|
56
|
+
},
|
|
57
|
+
"main": "build/index.cjs",
|
|
58
|
+
"module": "build/index.mjs",
|
|
59
|
+
"source": "src/index.ts",
|
|
60
|
+
"types": "./types.d.ts",
|
|
61
|
+
"exports": {
|
|
62
|
+
"require": "./build/index.cjs",
|
|
63
|
+
"types": "./types.d.ts",
|
|
64
|
+
"import": "./build/index.mjs",
|
|
65
|
+
"default": "./build/index.cjs"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@huggingface/inference": "4.7.1",
|
|
69
|
+
"@langchain/core": "0.3.57",
|
|
70
|
+
"@langchain/xai": "0.0.2",
|
|
71
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
72
|
+
"@types/node": "22.9.0",
|
|
73
|
+
"glob": "11.0.1",
|
|
74
|
+
"ollama": "0.6.0",
|
|
75
|
+
"openai": "4.97.0",
|
|
76
|
+
"groq-sdk": "0.37.0",
|
|
77
|
+
"rimraf": "6.0.1",
|
|
78
|
+
"rollup": "3.29.5",
|
|
79
|
+
"rollup-plugin-dts": "6.1.1",
|
|
80
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
81
|
+
"ts-morph": "27.0.2",
|
|
82
|
+
"tslib": "2.7.0",
|
|
83
|
+
"typedoc": "0.27.9",
|
|
84
|
+
"backtest-kit": "15.0.0",
|
|
85
|
+
"worker-testbed": "3.0.0"
|
|
86
|
+
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"@huggingface/inference": "^4.7.1",
|
|
89
|
+
"@langchain/core": "^0.3.57",
|
|
90
|
+
"@langchain/openai": "^0.4.9",
|
|
91
|
+
"@langchain/xai": "^0.0.2",
|
|
92
|
+
"backtest-kit": "^15.0.0",
|
|
93
|
+
"groq-sdk": "^0.37.0",
|
|
94
|
+
"ollama": "^0.6.0",
|
|
95
|
+
"openai": "^4.97.0",
|
|
96
|
+
"typescript": "^5.0.0"
|
|
97
|
+
},
|
|
98
|
+
"dependencies": {
|
|
99
|
+
"agent-swarm-kit": "^4.0.0",
|
|
100
|
+
"lodash-es": "^4.17.21",
|
|
101
|
+
"di-kit": "^1.1.1",
|
|
102
|
+
"di-scoped": "^1.0.21",
|
|
103
|
+
"functools-kit": "^4.0.0",
|
|
104
|
+
"get-moment-stamp": "^2.0.0",
|
|
105
|
+
"jsonrepair": "^3.12.0",
|
|
106
|
+
"markdown-it": "^14.1.0",
|
|
107
|
+
"markdownlint": "^0.38.0",
|
|
108
|
+
"sanitize-html": "^2.17.0",
|
|
109
|
+
"zod": "^3.25.76"
|
|
110
|
+
},
|
|
111
|
+
"publishConfig": {
|
|
112
|
+
"access": "public"
|
|
113
|
+
}
|
|
114
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -214,46 +214,46 @@ declare const cohere: <T extends (...args: any[]) => Promise<any>>(fn: T, model:
|
|
|
214
214
|
*/
|
|
215
215
|
declare const alibaba: <T extends (...args: any[]) => Promise<any>>(fn: T, model: string, apiKey?: string | string[]) => T;
|
|
216
216
|
/**
|
|
217
|
-
* Wrap async function with
|
|
217
|
+
* Wrap async function with Groq inference context.
|
|
218
218
|
*
|
|
219
219
|
* Creates a higher-order function that executes the provided async function
|
|
220
|
-
* within a
|
|
220
|
+
* within a Groq inference context.
|
|
221
221
|
*
|
|
222
222
|
* @template T - Async function type
|
|
223
223
|
* @param fn - Async function to wrap
|
|
224
|
-
* @param model -
|
|
224
|
+
* @param model - Groq model name (e.g., "llama-3.3-70b-versatile")
|
|
225
225
|
* @param apiKey - Single API key or array of keys
|
|
226
226
|
* @returns Wrapped function with same signature as input
|
|
227
227
|
*
|
|
228
228
|
* @example
|
|
229
229
|
* ```typescript
|
|
230
|
-
* import {
|
|
230
|
+
* import { groq } from '@backtest-kit/ollama';
|
|
231
231
|
*
|
|
232
|
-
* const wrappedFn =
|
|
232
|
+
* const wrappedFn = groq(myAsyncFn, 'llama-3.3-70b-versatile', process.env.GROQ_API_KEY);
|
|
233
233
|
* const result = await wrappedFn(args);
|
|
234
234
|
* ```
|
|
235
235
|
*/
|
|
236
|
+
declare const groq: <T extends (...args: any[]) => Promise<any>>(fn: T, model: string, apiKey?: string | string[]) => T;
|
|
236
237
|
/**
|
|
237
|
-
* Wrap async function with
|
|
238
|
+
* Wrap async function with Zhipu AI GLM-4 inference context.
|
|
238
239
|
*
|
|
239
240
|
* Creates a higher-order function that executes the provided async function
|
|
240
|
-
* within a
|
|
241
|
+
* within a Zhipu AI GLM-4 inference context via OpenAI-compatible Z.ai API.
|
|
241
242
|
*
|
|
242
243
|
* @template T - Async function type
|
|
243
244
|
* @param fn - Async function to wrap
|
|
244
|
-
* @param model -
|
|
245
|
+
* @param model - GLM-4 model name (e.g., "glm-4-plus", "glm-4-air")
|
|
245
246
|
* @param apiKey - Single API key or array of keys
|
|
246
247
|
* @returns Wrapped function with same signature as input
|
|
247
248
|
*
|
|
248
249
|
* @example
|
|
249
250
|
* ```typescript
|
|
250
|
-
* import {
|
|
251
|
+
* import { glm4 } from '@backtest-kit/ollama';
|
|
251
252
|
*
|
|
252
|
-
* const wrappedFn =
|
|
253
|
+
* const wrappedFn = glm4(myAsyncFn, 'glm-4-plus', process.env.ZAI_API_KEY);
|
|
253
254
|
* const result = await wrappedFn(args);
|
|
254
255
|
* ```
|
|
255
256
|
*/
|
|
256
|
-
declare const groq: <T extends (...args: any[]) => Promise<any>>(fn: T, model: string, apiKey?: string | string[]) => T;
|
|
257
257
|
declare const glm4: <T extends (...args: any[]) => Promise<any>>(fn: T, model: string, apiKey?: string | string[]) => T;
|
|
258
258
|
|
|
259
259
|
/**
|
|
@@ -389,7 +389,8 @@ interface MessageModel {
|
|
|
389
389
|
*
|
|
390
390
|
* @example
|
|
391
391
|
* ```typescript
|
|
392
|
-
* import {
|
|
392
|
+
* import { getCandles } from "backtest-kit";
|
|
393
|
+
* import { dumpSignal } from "@backtest-kit/ollama";
|
|
393
394
|
* import { v4 as uuid } from "uuid";
|
|
394
395
|
*
|
|
395
396
|
* addStrategy({
|
|
@@ -769,7 +770,8 @@ interface IOptimizerStrategy {
|
|
|
769
770
|
*/
|
|
770
771
|
symbol: string;
|
|
771
772
|
/**
|
|
772
|
-
*
|
|
773
|
+
* Strategy name: the training range note when provided,
|
|
774
|
+
* otherwise joined source names (e.g. "news+backtests").
|
|
773
775
|
* Used in callbacks and logging.
|
|
774
776
|
*/
|
|
775
777
|
name: string;
|
|
@@ -1248,7 +1250,7 @@ declare function getOptimizerSchema(optimizerName: OptimizerName): IOptimizerSch
|
|
|
1248
1250
|
*
|
|
1249
1251
|
* @example
|
|
1250
1252
|
* ```typescript
|
|
1251
|
-
* import { listOptimizers, addOptimizer } from "backtest-kit";
|
|
1253
|
+
* import { listOptimizers, addOptimizer } from "@backtest-kit/ollama";
|
|
1252
1254
|
*
|
|
1253
1255
|
* addOptimizer({
|
|
1254
1256
|
* optimizerName: "llm-strategy-generator",
|