@backtest-kit/sidekick 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 ADDED
@@ -0,0 +1,64 @@
1
+ # 🧿 @backtest-kit/sidekick
2
+
3
+ > The easiest way to create a new Backtest Kit trading bot project. Like create-react-app, but for algorithmic trading.
4
+
5
+ ![bots](https://raw.githubusercontent.com/tripolskypetr/backtest-kit/HEAD/assets/bots.png)
6
+
7
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/tripolskypetr/backtest-kit)
8
+ [![npm](https://img.shields.io/npm/v/@backtest-kit/sidekick.svg?style=flat-square)](https://npmjs.org/package/@backtest-kit/sidekick)
9
+ [![License](https://img.shields.io/npm/l/@backtest-kit/sidekick.svg)](https://github.com/tripolskypetr/backtest-kit/blob/master/LICENSE)
10
+
11
+ Create production-ready trading bots in seconds with pre-configured templates, LLM integration, and technical analysis.
12
+
13
+ 📚 **[Backtest Kit Docs](https://backtest-kit.github.io/documents/example_02_first_backtest.html)** | 🌟 **[GitHub](https://github.com/tripolskypetr/backtest-kit)**
14
+
15
+ ## ✨ Features
16
+
17
+ - 🚀 **Zero Config**: Get started with one command - no setup required
18
+ - 📦 **Complete Template**: Includes backtest strategy, risk management, and LLM integration
19
+ - 🤖 **AI-Powered**: Pre-configured with DeepSeek, Claude, and GPT-5 fallback chain
20
+ - 📊 **Technical Analysis**: Built-in 50+ indicators via @backtest-kit/signals
21
+ - 🔑 **Environment Setup**: Auto-generated .env with all API key placeholders
22
+ - 📝 **Best Practices**: Production-ready code structure with examples
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ ### Create a New Project
27
+
28
+ ```bash
29
+ npx -y @backtest-kit/sidekick my-trading-bot
30
+ cd my-trading-bot
31
+ npm start
32
+ ```
33
+
34
+ That's it! You now have a working trading bot with:
35
+ - Complete backtest setup
36
+ - LLM-powered strategy
37
+ - Multi-timeframe technical analysis
38
+ - Risk management validation
39
+ - Environment configuration
40
+
41
+ ## 💡 CLI Options
42
+
43
+ ```bash
44
+ # Create project with custom name
45
+ npx -y @backtest-kit/sidekick my-bot
46
+
47
+ # Create in current directory (must be empty)
48
+ npx -y @backtest-kit/sidekick .
49
+ ```
50
+
51
+ ## 🔗 Links
52
+
53
+ - [Backtest Kit Documentation](https://backtest-kit.github.io/documents/example_02_first_backtest.html)
54
+ - [GitHub Repository](https://github.com/tripolskypetr/backtest-kit)
55
+ - [Demo Projects](https://github.com/tripolskypetr/backtest-kit/tree/master/demo)
56
+ - [API Reference](https://backtest-kit.github.io/documents/example_02_first_backtest.html)
57
+
58
+ ## 🤝 Contribute
59
+
60
+ Found a bug or want to add a feature? [Open an issue](https://github.com/tripolskypetr/backtest-kit/issues) or submit a PR!
61
+
62
+ ## 📜 License
63
+
64
+ MIT © [tripolskypetr](https://github.com/tripolskypetr)
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@backtest-kit/sidekick",
3
+ "version": "0.0.1",
4
+ "description": "The easiest way to create a new Backtest Kit trading bot project. Like create-react-app, but for algorithmic trading with LLM integration and technical analysis.",
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
+ "create-backtest-app",
18
+ "backtest-kit",
19
+ "scaffolding",
20
+ "generator",
21
+ "cli",
22
+ "trading-bot",
23
+ "algorithmic-trading",
24
+ "backtesting",
25
+ "llm",
26
+ "ai-trading",
27
+ "technical-analysis",
28
+ "crypto",
29
+ "forex",
30
+ "quantitative-trading",
31
+ "template",
32
+ "boilerplate",
33
+ "starter-kit",
34
+ "npx"
35
+ ],
36
+ "files": [
37
+ "src",
38
+ "scripts",
39
+ "template",
40
+ "README.md"
41
+ ],
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/tripolskypetr/backtest-kit",
45
+ "documentation": "https://github.com/tripolskypetr/backtest-kit/tree/master/docs"
46
+ },
47
+ "bugs": {
48
+ "url": "https://github.com/tripolskypetr/backtest-kit/issues"
49
+ },
50
+ "main": "./src/index.mjs",
51
+ "scripts": {
52
+ "start": "node ./src/index.mjs"
53
+ },
54
+ "bin": {
55
+ "@backtest-kit/sidekick": "./scripts/init.mjs"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "type": "module",
61
+ "dependencies": {
62
+ "glob": "^11.0.1",
63
+ "log-symbols": "^7.0.0",
64
+ "mustache": "^4.2.0",
65
+ "picocolors": "^1.1.1"
66
+ }
67
+ }
68
+
@@ -0,0 +1,250 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { promises as fs } from 'fs';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { spawn } from 'child_process';
7
+ import pc from 'picocolors';
8
+ import { glob } from 'glob';
9
+ import Mustache from 'mustache';
10
+ import logSymbols from 'log-symbols';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+
15
+ const log = {
16
+ info: (msg) => console.log(`${pc.cyan(logSymbols.info)} ${msg}`),
17
+ success: (msg) => console.log(`${pc.green(logSymbols.success)} ${msg}`),
18
+ error: (msg) => console.log(`${pc.red(logSymbols.error)} ${msg}`),
19
+ warn: (msg) => console.log(`${pc.yellow(logSymbols.warning)} ${msg}`),
20
+ };
21
+
22
+ /**
23
+ * Copy files using glob patterns
24
+ */
25
+ async function copyFiles(srcDir, destDir, pattern = '**/*') {
26
+ await fs.mkdir(destDir, { recursive: true });
27
+
28
+ const files = await glob(pattern, {
29
+ cwd: srcDir,
30
+ nodir: true,
31
+ dot: true,
32
+ absolute: false,
33
+ });
34
+
35
+ for (const file of files) {
36
+ const srcPath = path.join(srcDir, file);
37
+ const destPath = path.join(destDir, file);
38
+
39
+ // Create destination directory if needed
40
+ await fs.mkdir(path.dirname(destPath), { recursive: true });
41
+
42
+ // Copy file
43
+ await fs.copyFile(srcPath, destPath);
44
+
45
+ // Log copied file
46
+ console.log(` ${pc.dim('→')} ${file}`);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Check if directory exists and is empty
52
+ */
53
+ async function isDirEmpty(dirPath) {
54
+ try {
55
+ const files = await fs.readdir(dirPath);
56
+ return files.length === 0;
57
+ } catch (error) {
58
+ if (error.code === 'ENOENT') {
59
+ return true; // Directory doesn't exist, treat as empty
60
+ }
61
+ throw error;
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Run npm install
67
+ */
68
+ function runNpmInstall(projectPath) {
69
+ return new Promise((resolve, reject) => {
70
+ log.info('Installing dependencies...');
71
+
72
+ const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
73
+ const install = spawn(npm, ['install'], {
74
+ cwd: projectPath,
75
+ stdio: 'inherit',
76
+ shell: true,
77
+ });
78
+
79
+ install.on('close', (code) => {
80
+ if (code !== 0) {
81
+ reject(new Error(`npm install exited with code ${code}`));
82
+ return;
83
+ }
84
+ resolve();
85
+ });
86
+
87
+ install.on('error', reject);
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Load and render template file
93
+ */
94
+ async function renderTemplate(templatePath, data) {
95
+ const template = await fs.readFile(templatePath, 'utf-8');
96
+ return Mustache.render(template, data);
97
+ }
98
+
99
+ /**
100
+ * Main function
101
+ */
102
+ async function main() {
103
+ console.log();
104
+ console.log(`${pc.bold(pc.blue('🧿 Backtest Kit'))}`);
105
+ console.log();
106
+
107
+ // Get project name from arguments
108
+ const args = process.argv.slice(2);
109
+ const projectName = args[0] || 'my-backtest-project';
110
+
111
+ const projectPath = path.resolve(process.cwd(), projectName);
112
+ const srcTemplatePath = path.resolve(__dirname, '..', 'src');
113
+ const templateDir = path.resolve(__dirname, '..', 'template');
114
+
115
+ // Template data for Mustache
116
+ const templateData = {
117
+ PROJECT_NAME: projectName,
118
+ };
119
+
120
+ try {
121
+ // Check if directory exists and is not empty
122
+ {
123
+ const isEmpty = await isDirEmpty(projectPath);
124
+ if (!isEmpty) {
125
+ log.error(`Directory ${projectName} already exists and is not empty.`);
126
+ process.exit(1);
127
+ }
128
+ }
129
+
130
+ {
131
+ log.info(`Creating a new Backtest Kit project in ${pc.bold(projectPath)}`);
132
+ console.log();
133
+ }
134
+
135
+ // Create project directory
136
+ {
137
+ await fs.mkdir(projectPath, { recursive: true });
138
+ log.success('Created project directory');
139
+ }
140
+
141
+ // Copy source template files using glob
142
+ {
143
+ log.info('Copying template files...');
144
+ await copyFiles(srcTemplatePath, path.join(projectPath, 'src'));
145
+ log.success('Copied template files');
146
+ }
147
+
148
+ // Create package.json from template
149
+ {
150
+ log.info('Creating package.json...');
151
+ const packageJsonContent = await renderTemplate(
152
+ path.join(templateDir, 'package.mustache'),
153
+ templateData
154
+ );
155
+ await fs.writeFile(
156
+ path.join(projectPath, 'package.json'),
157
+ packageJsonContent,
158
+ 'utf-8'
159
+ );
160
+ log.success('Created package.json');
161
+ }
162
+
163
+ // Create .env files from template
164
+ {
165
+ log.info('Creating .env template...');
166
+ const envContent = await renderTemplate(
167
+ path.join(templateDir, 'env.mustache'),
168
+ templateData
169
+ );
170
+ await fs.writeFile(
171
+ path.join(projectPath, '.env.example'),
172
+ envContent,
173
+ 'utf-8'
174
+ );
175
+ await fs.writeFile(
176
+ path.join(projectPath, '.env'),
177
+ envContent,
178
+ 'utf-8'
179
+ );
180
+ log.success('Created .env files');
181
+ }
182
+
183
+ // Create .gitignore from template
184
+ {
185
+ log.info('Creating .gitignore...');
186
+ const gitignoreContent = await renderTemplate(
187
+ path.join(templateDir, 'gitignore.mustache'),
188
+ templateData
189
+ );
190
+ await fs.writeFile(
191
+ path.join(projectPath, '.gitignore'),
192
+ gitignoreContent,
193
+ 'utf-8'
194
+ );
195
+ log.success('Created .gitignore');
196
+ }
197
+
198
+ // Create README.md from template
199
+ {
200
+ log.info('Creating README.md...');
201
+ const readmeContent = await renderTemplate(
202
+ path.join(templateDir, 'README.mustache'),
203
+ templateData
204
+ );
205
+ await fs.writeFile(
206
+ path.join(projectPath, 'README.md'),
207
+ readmeContent,
208
+ 'utf-8'
209
+ );
210
+ log.success('Created README.md');
211
+ console.log();
212
+ }
213
+
214
+ // Install dependencies
215
+ {
216
+ await runNpmInstall(projectPath);
217
+ console.log();
218
+ log.success('Installation complete!');
219
+ console.log();
220
+ }
221
+
222
+ // Display success message with instructions
223
+ {
224
+ console.log(`${pc.bold('Success!')} Created ${pc.cyan(projectName)} at ${pc.bold(projectPath)}`);
225
+ console.log();
226
+ console.log('Inside that directory, you can run several commands:');
227
+ console.log();
228
+ console.log(` ${pc.cyan('npm start')}`);
229
+ console.log(' Starts the trading bot.');
230
+ console.log();
231
+ console.log('We suggest that you begin by typing:');
232
+ console.log();
233
+ console.log(` ${pc.cyan(`cd ${projectName}`)}`);
234
+ console.log(` ${pc.cyan('npm start')}`);
235
+ console.log();
236
+ console.log(`${pc.yellow('Don\'t forget to configure your API keys in .env file!')}`);
237
+ console.log();
238
+ console.log('Happy trading! 🚀');
239
+ console.log();
240
+ }
241
+
242
+ } catch (error) {
243
+ log.error('Failed to create project:');
244
+ console.error(error);
245
+ process.exit(1);
246
+ }
247
+ }
248
+
249
+ // Run the script
250
+ main().catch(console.error);
package/src/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export const foo = "bar";
@@ -0,0 +1,49 @@
1
+ # {{PROJECT_NAME}}
2
+
3
+ A trading bot project powered by [Backtest Kit](https://github.com/tripolskypetr/backtest-kit).
4
+
5
+ ## 🚀 Getting Started
6
+
7
+ ### Configure API Keys
8
+
9
+ Edit `.env` file and add your API keys:
10
+
11
+ ```bash
12
+ # For live trading
13
+ CC_BINANCE_API_KEY=your_api_key_here
14
+ CC_BINANCE_API_SECRET=your_api_secret_here
15
+
16
+ # For AI strategies
17
+ CC_OPENAI_API_KEY=your_openai_key_here
18
+ ```
19
+
20
+ ### Run the Bot
21
+
22
+ ```bash
23
+ npm start
24
+ ```
25
+
26
+ ## 📚 Documentation
27
+
28
+ - [Backtest Kit Docs](https://backtest-kit.github.io/documents/example_02_first_backtest.html)
29
+ - [GitHub Repository](https://github.com/tripolskypetr/backtest-kit)
30
+
31
+ ## 📁 Project Structure
32
+
33
+ ```
34
+ {{PROJECT_NAME}}/
35
+ ├── src/
36
+ │ ├── index.mjs # Main entry point
37
+ │ └── utils/ # Utility functions
38
+ ├── .env # Environment variables
39
+ ├── .gitignore # Git ignore rules
40
+ └── package.json # Dependencies
41
+ ```
42
+
43
+ ## 🤝 Contributing
44
+
45
+ Feel free to submit issues and pull requests!
46
+
47
+ ## 📜 License
48
+
49
+ MIT
@@ -0,0 +1,18 @@
1
+ # Exchange API Keys (for live trading)
2
+ # CC_BINANCE_API_KEY=your_api_key_here
3
+ # CC_BINANCE_API_SECRET=your_api_secret_here
4
+
5
+ # LLM API Keys (for AI strategies)
6
+ # CC_OPENAI_API_KEY=your_openai_key_here
7
+ # CC_ANTHROPIC_API_KEY=your_anthropic_key_here
8
+ # CC_DEEPSEEK_API_KEY=your_deepseek_key_here
9
+ # CC_GROK_API_KEY=your_grok_key_here
10
+
11
+ # Ollama Configuration
12
+ # CC_OLLAMA_API_KEY=your_ollama_key_here
13
+ # CC_OLLAMA_BASE_URL=https://cloud.ollama.com
14
+
15
+ # Trading Configuration
16
+ # CC_PERCENT_SLIPPAGE=0.1
17
+ # CC_PERCENT_FEE=0.1
18
+ # CC_SCHEDULE_AWAIT_MINUTES=120
@@ -0,0 +1,29 @@
1
+ # Dependencies
2
+ node_modules
3
+
4
+ # Environment variables
5
+ .env
6
+ .env.local
7
+ .env.*.local
8
+
9
+ # Logs
10
+ logs
11
+ *.log
12
+ npm-debug.log*
13
+
14
+ # Runtime data
15
+ tmp
16
+ generated
17
+ dump
18
+ wwwroot
19
+
20
+ # OS files
21
+ .DS_Store
22
+ Thumbs.db
23
+
24
+ # IDE
25
+ .vscode
26
+ .idea
27
+ *.swp
28
+ *.swo
29
+ *~
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Backtest Kit trading bot project",
7
+ "scripts": {
8
+ "start": "node ./src/index.mjs",
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "dependencies": {
12
+ "backtest-kit": "^1.11.10",
13
+ "@backtest-kit/signals": "^0.0.1",
14
+ "@backtest-kit/ollama": "^0.0.1",
15
+ "agent-swarm-kit": "^1.1.180",
16
+ "ccxt": "^4.4.41",
17
+ "uuid": "^11.0.3",
18
+ "dotenv": "^16.4.7",
19
+ "ollama": "^0.6.0",
20
+ "openai": "^4.97.0",
21
+ "jsonrepair": "^3.12.0",
22
+ "@langchain/core": "^0.3.57",
23
+ "@langchain/xai": "^0.0.2",
24
+ "@huggingface/inference": "^4.7.1",
25
+ "sanitize-html": "^2.17.0"
26
+ },
27
+ "devDependencies": {
28
+ "dotenv-cli": "^7.4.2"
29
+ },
30
+ "keywords": [
31
+ "backtest",
32
+ "trading",
33
+ "crypto",
34
+ "bot"
35
+ ]
36
+ }