@backtest-kit/sidekick 0.0.9 → 0.1.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/package.json +2 -1
- package/src/classes/PartialProfitTakingAction.mjs +20 -0
- package/src/config/validate.mjs +2 -0
- package/src/enum/ActionName.mjs +3 -0
- package/src/enum/ExchangeName.mjs +2 -2
- package/src/enum/FrameName.mjs +4 -4
- package/src/enum/RiskName.mjs +3 -3
- package/src/enum/StrategyName.mjs +2 -2
- package/src/logic/action/partial_profit_taking.action.mjs +8 -0
- package/src/logic/exchange/binance.exchange.mjs +2 -2
- package/src/logic/frame/dec_2025.frame.mjs +3 -3
- package/src/logic/frame/nov_2025.frame.mjs +3 -3
- package/src/logic/frame/oct_2025.frame.mjs +3 -3
- package/src/logic/index.mjs +2 -0
- package/src/logic/risk/rr_ratio.risk.mjs +2 -2
- package/src/logic/risk/tp_distance.risk.mjs +2 -2
- package/src/logic/strategy/main.strategy.mjs +2 -2
- package/template/package.mustache +3 -3
- package/types/backtest-kit.d.ts +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backtest-kit/sidekick",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
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
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"src",
|
|
38
38
|
"scripts",
|
|
39
39
|
"template",
|
|
40
|
+
"types",
|
|
40
41
|
"README.md"
|
|
41
42
|
],
|
|
42
43
|
"repository": {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ActionBase, Constant, commitPartialProfit } from "backtest-kit";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Scale out at Kelly-optimized levels
|
|
5
|
+
*/
|
|
6
|
+
export class PartialProfitTakingAction extends ActionBase {
|
|
7
|
+
async partialProfit({ symbol, level }) {
|
|
8
|
+
if (level === Constant.TP_LEVEL3) {
|
|
9
|
+
await commitPartialProfit(symbol, 33);
|
|
10
|
+
}
|
|
11
|
+
if (level === Constant.TP_LEVEL2) {
|
|
12
|
+
await commitPartialProfit(symbol, 33);
|
|
13
|
+
}
|
|
14
|
+
if (level === Constant.TP_LEVEL1) {
|
|
15
|
+
await commitPartialProfit(symbol, 34);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default PartialProfitTakingAction;
|
package/src/config/validate.mjs
CHANGED
|
@@ -3,10 +3,12 @@ import ExchangeName from "../enum/ExchangeName.mjs";
|
|
|
3
3
|
import FrameName from "../enum/FrameName.mjs";
|
|
4
4
|
import RiskName from "../enum/RiskName.mjs";
|
|
5
5
|
import StrategyName from "../enum/StrategyName.mjs";
|
|
6
|
+
import ActionName from "../enum/ActionName.mjs";
|
|
6
7
|
|
|
7
8
|
validate({
|
|
8
9
|
ExchangeName,
|
|
9
10
|
FrameName,
|
|
10
11
|
RiskName,
|
|
11
12
|
StrategyName,
|
|
13
|
+
ActionName,
|
|
12
14
|
})
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
BinanceExchange: "binance_exchange",
|
|
3
|
+
};
|
package/src/enum/FrameName.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
October2025: "oct_2025_frame",
|
|
3
|
+
November2025: "nov_2025_frame",
|
|
4
|
+
December2025: "dec_2025_frame",
|
|
5
|
+
};
|
package/src/enum/RiskName.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
TakeProfitDistanceRisk: "tp_distance_risk",
|
|
3
|
+
RiskRewardRatioRisk: "rr_ratio_risk",
|
|
4
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
MainStrategy: "main_strategy",
|
|
3
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { addActionSchema } from "backtest-kit";
|
|
2
|
+
import ActionName from "../../enum/ActionName.mjs";
|
|
3
|
+
import { PartialProfitTakingAction } from "../../classes/PartialProfitTakingAction.mjs";
|
|
4
|
+
|
|
5
|
+
addActionSchema({
|
|
6
|
+
actionName: ActionName.PartialProfitTakingAction,
|
|
7
|
+
handler: PartialProfitTakingAction,
|
|
8
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addExchangeSchema, roundTicks } from "backtest-kit";
|
|
2
2
|
import { getExchange } from "../../config/ccxt.mjs";
|
|
3
3
|
import ExchangeName from "../../enum/ExchangeName.mjs";
|
|
4
4
|
|
|
5
5
|
const MAX_DEPTH_LEVELS = 1_000;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
addExchangeSchema({
|
|
8
8
|
exchangeName: ExchangeName.BinanceExchange,
|
|
9
9
|
getCandles: async (symbol, interval, since, limit) => {
|
|
10
10
|
const exchange = await getExchange();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addFrameSchema } from "backtest-kit";
|
|
2
2
|
import FrameName from "../../enum/FrameName.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
addFrameSchema({
|
|
5
5
|
frameName: FrameName.December2025,
|
|
6
6
|
interval: "1m",
|
|
7
7
|
startDate: new Date("2025-12-01T00:00:00Z"),
|
|
8
8
|
endDate: new Date("2025-12-31T23:59:59Z"),
|
|
9
|
-
note: "
|
|
9
|
+
note: "Sideways movement without clear growth or decline",
|
|
10
10
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addFrameSchema } from "backtest-kit";
|
|
2
2
|
import FrameName from "../../enum/FrameName.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
addFrameSchema({
|
|
5
5
|
frameName: FrameName.November2025,
|
|
6
6
|
interval: "1m",
|
|
7
7
|
startDate: new Date("2025-11-01T00:00:00Z"),
|
|
8
8
|
endDate: new Date("2025-11-30T23:59:59Z"),
|
|
9
|
-
note: "
|
|
9
|
+
note: "Sideways movement with overall downtrend and minor bounces",
|
|
10
10
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addFrameSchema } from "backtest-kit";
|
|
2
2
|
import FrameName from "../../enum/FrameName.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
addFrameSchema({
|
|
5
5
|
frameName: FrameName.October2025,
|
|
6
6
|
interval: "1m",
|
|
7
7
|
startDate: new Date("2025-10-01T00:00:00Z"),
|
|
8
8
|
endDate: new Date("2025-10-31T23:59:59Z"),
|
|
9
|
-
note: "
|
|
9
|
+
note: "Sharp market drop from the 9th to 11th",
|
|
10
10
|
});
|
package/src/logic/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addStrategySchema } from "backtest-kit";
|
|
2
2
|
import { ollama } from "@backtest-kit/ollama";
|
|
3
3
|
|
|
4
4
|
import { commitHistorySetup } from "../../func/market.func.mjs";
|
|
@@ -6,7 +6,7 @@ import { commitHistorySetup } from "../../func/market.func.mjs";
|
|
|
6
6
|
import StrategyName from "../../enum/StrategyName.mjs";
|
|
7
7
|
import RiskName from "../../enum/RiskName.mjs";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
addStrategySchema({
|
|
10
10
|
strategyName: StrategyName.MainStrategy,
|
|
11
11
|
interval: "5m",
|
|
12
12
|
getSignal: async (symbol) => {
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@backtest-kit/ollama": "^0.0
|
|
13
|
-
"@backtest-kit/signals": "^0.0
|
|
12
|
+
"@backtest-kit/ollama": "^0.1.0",
|
|
13
|
+
"@backtest-kit/signals": "^0.1.0",
|
|
14
14
|
"@huggingface/inference": "^4.7.1",
|
|
15
15
|
"@langchain/core": "^0.3.57",
|
|
16
16
|
"@langchain/xai": "^0.0.2",
|
|
17
17
|
"agent-swarm-kit": "^1.1.181",
|
|
18
|
-
"backtest-kit": "^
|
|
18
|
+
"backtest-kit": "^2.0.3",
|
|
19
19
|
"ccxt": "^4.4.41",
|
|
20
20
|
"dotenv": "^16.4.7",
|
|
21
21
|
"functools-kit": "^1.0.95",
|