@backtest-kit/ollama 0.0.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/README.md +205 -0
- package/build/index.cjs +2918 -0
- package/build/index.mjs +2905 -0
- package/package.json +102 -0
- package/types.d.ts +204 -0
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backtest-kit/ollama",
|
|
3
|
+
"version": "0.0.1",
|
|
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/example_02_first_backtest.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
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
69
|
+
"@types/node": "22.9.0",
|
|
70
|
+
"glob": "11.0.1",
|
|
71
|
+
"rimraf": "6.0.1",
|
|
72
|
+
"rollup": "3.29.5",
|
|
73
|
+
"rollup-plugin-dts": "6.1.1",
|
|
74
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
75
|
+
"ts-morph": "27.0.2",
|
|
76
|
+
"tslib": "2.7.0",
|
|
77
|
+
"typedoc": "0.27.9",
|
|
78
|
+
"ollama": "0.6.0",
|
|
79
|
+
"openai": "4.97.0",
|
|
80
|
+
"jsonrepair": "3.12.0",
|
|
81
|
+
"@langchain/core": "0.3.57",
|
|
82
|
+
"markdownlint": "0.38.0",
|
|
83
|
+
"@langchain/xai": "0.0.2",
|
|
84
|
+
"@huggingface/inference": "4.7.1",
|
|
85
|
+
"sanitize-html": "2.17.0",
|
|
86
|
+
"worker-testbed": "1.0.12"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"agent-swarm-kit": "^1.1.180",
|
|
90
|
+
"backtest-kit": "^1.11.10",
|
|
91
|
+
"typescript": "^5.0.0"
|
|
92
|
+
},
|
|
93
|
+
"dependencies": {
|
|
94
|
+
"di-kit": "^1.0.18",
|
|
95
|
+
"di-scoped": "^1.0.20",
|
|
96
|
+
"functools-kit": "^1.0.95",
|
|
97
|
+
"get-moment-stamp": "^1.1.1"
|
|
98
|
+
},
|
|
99
|
+
"publishConfig": {
|
|
100
|
+
"access": "public"
|
|
101
|
+
}
|
|
102
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { IOutlineMessage, ISwarmCompletionArgs, ISwarmMessage, IOutlineCompletionArgs } from 'agent-swarm-kit';
|
|
2
|
+
import * as di_scoped from 'di-scoped';
|
|
3
|
+
|
|
4
|
+
declare const ollama: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
position: "long" | "short";
|
|
7
|
+
minuteEstimatedTime: number;
|
|
8
|
+
priceStopLoss: number;
|
|
9
|
+
priceTakeProfit: number;
|
|
10
|
+
note: string;
|
|
11
|
+
priceOpen: number;
|
|
12
|
+
}>;
|
|
13
|
+
declare const grok: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
14
|
+
id: string;
|
|
15
|
+
position: "long" | "short";
|
|
16
|
+
minuteEstimatedTime: number;
|
|
17
|
+
priceStopLoss: number;
|
|
18
|
+
priceTakeProfit: number;
|
|
19
|
+
note: string;
|
|
20
|
+
priceOpen: number;
|
|
21
|
+
}>;
|
|
22
|
+
declare const hf: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
23
|
+
id: string;
|
|
24
|
+
position: "long" | "short";
|
|
25
|
+
minuteEstimatedTime: number;
|
|
26
|
+
priceStopLoss: number;
|
|
27
|
+
priceTakeProfit: number;
|
|
28
|
+
note: string;
|
|
29
|
+
priceOpen: number;
|
|
30
|
+
}>;
|
|
31
|
+
declare const claude: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
32
|
+
id: string;
|
|
33
|
+
position: "long" | "short";
|
|
34
|
+
minuteEstimatedTime: number;
|
|
35
|
+
priceStopLoss: number;
|
|
36
|
+
priceTakeProfit: number;
|
|
37
|
+
note: string;
|
|
38
|
+
priceOpen: number;
|
|
39
|
+
}>;
|
|
40
|
+
declare const gpt5: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
41
|
+
id: string;
|
|
42
|
+
position: "long" | "short";
|
|
43
|
+
minuteEstimatedTime: number;
|
|
44
|
+
priceStopLoss: number;
|
|
45
|
+
priceTakeProfit: number;
|
|
46
|
+
note: string;
|
|
47
|
+
priceOpen: number;
|
|
48
|
+
}>;
|
|
49
|
+
declare const deepseek: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
50
|
+
id: string;
|
|
51
|
+
position: "long" | "short";
|
|
52
|
+
minuteEstimatedTime: number;
|
|
53
|
+
priceStopLoss: number;
|
|
54
|
+
priceTakeProfit: number;
|
|
55
|
+
note: string;
|
|
56
|
+
priceOpen: number;
|
|
57
|
+
}>;
|
|
58
|
+
declare const mistral: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
59
|
+
id: string;
|
|
60
|
+
position: "long" | "short";
|
|
61
|
+
minuteEstimatedTime: number;
|
|
62
|
+
priceStopLoss: number;
|
|
63
|
+
priceTakeProfit: number;
|
|
64
|
+
note: string;
|
|
65
|
+
priceOpen: number;
|
|
66
|
+
}>;
|
|
67
|
+
declare const perplexity: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
68
|
+
id: string;
|
|
69
|
+
position: "long" | "short";
|
|
70
|
+
minuteEstimatedTime: number;
|
|
71
|
+
priceStopLoss: number;
|
|
72
|
+
priceTakeProfit: number;
|
|
73
|
+
note: string;
|
|
74
|
+
priceOpen: number;
|
|
75
|
+
}>;
|
|
76
|
+
declare const cohere: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
77
|
+
id: string;
|
|
78
|
+
position: "long" | "short";
|
|
79
|
+
minuteEstimatedTime: number;
|
|
80
|
+
priceStopLoss: number;
|
|
81
|
+
priceTakeProfit: number;
|
|
82
|
+
note: string;
|
|
83
|
+
priceOpen: number;
|
|
84
|
+
}>;
|
|
85
|
+
declare const alibaba: (messages: IOutlineMessage[], model: string, apiKey?: string | string[]) => Promise<{
|
|
86
|
+
id: string;
|
|
87
|
+
position: "long" | "short";
|
|
88
|
+
minuteEstimatedTime: number;
|
|
89
|
+
priceStopLoss: number;
|
|
90
|
+
priceTakeProfit: number;
|
|
91
|
+
note: string;
|
|
92
|
+
priceOpen: number;
|
|
93
|
+
}>;
|
|
94
|
+
|
|
95
|
+
interface ILogger {
|
|
96
|
+
log(topic: string, ...args: any[]): void;
|
|
97
|
+
debug(topic: string, ...args: any[]): void;
|
|
98
|
+
info(topic: string, ...args: any[]): void;
|
|
99
|
+
warn(topic: string, ...args: any[]): void;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
declare const setLogger: (logger: ILogger) => void;
|
|
103
|
+
|
|
104
|
+
declare enum InferenceName {
|
|
105
|
+
OllamaInference = "ollama_inference",
|
|
106
|
+
GrokInference = "grok_inference",
|
|
107
|
+
HfInference = "hf_inference",
|
|
108
|
+
ClaudeInference = "claude_inference",
|
|
109
|
+
GPT5Inference = "gpt5_inference",
|
|
110
|
+
DeepseekInference = "deepseek_inference",
|
|
111
|
+
MistralInference = "mistral_inference",
|
|
112
|
+
PerplexityInference = "perplexity_inference",
|
|
113
|
+
CohereInference = "cohere_inference",
|
|
114
|
+
AlibabaInference = "alibaba_inference"
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface IContext {
|
|
118
|
+
inference: InferenceName;
|
|
119
|
+
model: string;
|
|
120
|
+
apiKey: string | string[];
|
|
121
|
+
}
|
|
122
|
+
declare const ContextService: (new () => {
|
|
123
|
+
readonly context: IContext;
|
|
124
|
+
}) & Omit<{
|
|
125
|
+
new (context: IContext): {
|
|
126
|
+
readonly context: IContext;
|
|
127
|
+
};
|
|
128
|
+
}, "prototype"> & di_scoped.IScopedClassRun<[context: IContext]>;
|
|
129
|
+
type TContextService = InstanceType<typeof ContextService>;
|
|
130
|
+
|
|
131
|
+
interface IProvider {
|
|
132
|
+
getCompletion(params: ISwarmCompletionArgs): Promise<ISwarmMessage>;
|
|
133
|
+
getStreamCompletion(params: ISwarmCompletionArgs): Promise<ISwarmMessage>;
|
|
134
|
+
getOutlineCompletion(params: IOutlineCompletionArgs): Promise<IOutlineMessage>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type RunnerClass = new (contextService: TContextService, logger: ILogger) => IProvider;
|
|
138
|
+
declare class RunnerPrivateService implements IProvider {
|
|
139
|
+
private readonly contextService;
|
|
140
|
+
private readonly loggerService;
|
|
141
|
+
private _registry;
|
|
142
|
+
private getRunner;
|
|
143
|
+
getCompletion: (params: ISwarmCompletionArgs) => Promise<ISwarmMessage>;
|
|
144
|
+
getStreamCompletion: (params: ISwarmCompletionArgs) => Promise<ISwarmMessage>;
|
|
145
|
+
getOutlineCompletion: (params: IOutlineCompletionArgs) => Promise<IOutlineMessage>;
|
|
146
|
+
registerRunner: (name: InferenceName, runner: RunnerClass) => void;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare class RunnerPublicService {
|
|
150
|
+
private readonly runnerPrivateService;
|
|
151
|
+
private readonly loggerService;
|
|
152
|
+
getCompletion: (params: ISwarmCompletionArgs, context: IContext) => Promise<ISwarmMessage>;
|
|
153
|
+
getStreamCompletion: (params: ISwarmCompletionArgs, context: IContext) => Promise<ISwarmMessage>;
|
|
154
|
+
getOutlineCompletion: (params: IOutlineCompletionArgs, context: IContext) => Promise<IOutlineMessage>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
declare class LoggerService implements ILogger {
|
|
158
|
+
private _commonLogger;
|
|
159
|
+
log: (topic: string, ...args: any[]) => Promise<void>;
|
|
160
|
+
debug: (topic: string, ...args: any[]) => Promise<void>;
|
|
161
|
+
info: (topic: string, ...args: any[]) => Promise<void>;
|
|
162
|
+
warn: (topic: string, ...args: any[]) => Promise<void>;
|
|
163
|
+
setLogger: (logger: ILogger) => void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
declare class OutlinePrivateService {
|
|
167
|
+
private readonly loggerService;
|
|
168
|
+
getCompletion: (messages: IOutlineMessage[]) => Promise<{
|
|
169
|
+
id: string;
|
|
170
|
+
position: "long" | "short";
|
|
171
|
+
minuteEstimatedTime: number;
|
|
172
|
+
priceStopLoss: number;
|
|
173
|
+
priceTakeProfit: number;
|
|
174
|
+
note: string;
|
|
175
|
+
priceOpen: number;
|
|
176
|
+
}>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
declare class OutlinePublicService {
|
|
180
|
+
private readonly loggerService;
|
|
181
|
+
private readonly outlinePrivateService;
|
|
182
|
+
getCompletion: (messages: IOutlineMessage[], inference: InferenceName, model: string, apiKey?: string | string[]) => Promise<{
|
|
183
|
+
id: string;
|
|
184
|
+
position: "long" | "short";
|
|
185
|
+
minuteEstimatedTime: number;
|
|
186
|
+
priceStopLoss: number;
|
|
187
|
+
priceTakeProfit: number;
|
|
188
|
+
note: string;
|
|
189
|
+
priceOpen: number;
|
|
190
|
+
}>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare const engine: {
|
|
194
|
+
runnerPublicService: RunnerPublicService;
|
|
195
|
+
outlinePublicService: OutlinePublicService;
|
|
196
|
+
runnerPrivateService: RunnerPrivateService;
|
|
197
|
+
outlinePrivateService: OutlinePrivateService;
|
|
198
|
+
contextService: {
|
|
199
|
+
readonly context: IContext;
|
|
200
|
+
};
|
|
201
|
+
loggerService: LoggerService;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export { alibaba, claude, cohere, deepseek, gpt5, grok, hf, engine as lib, mistral, ollama, perplexity, setLogger };
|