@backtest-kit/pinets 0.0.5 → 0.0.6
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/build/index.cjs +5 -4
- package/build/index.mjs +5 -4
- package/package.json +1 -1
- package/types.d.ts +4 -3
package/build/index.cjs
CHANGED
|
@@ -690,10 +690,10 @@ function setLogger(logger) {
|
|
|
690
690
|
pine.loggerService.setLogger(logger);
|
|
691
691
|
}
|
|
692
692
|
|
|
693
|
-
function toSignalDto(data) {
|
|
693
|
+
function toSignalDto(id, data) {
|
|
694
694
|
if (data.position === 1) {
|
|
695
695
|
return {
|
|
696
|
-
id:
|
|
696
|
+
id: String(id),
|
|
697
697
|
position: "long",
|
|
698
698
|
priceOpen: data.priceOpen,
|
|
699
699
|
priceTakeProfit: data.priceTakeProfit,
|
|
@@ -703,7 +703,7 @@ function toSignalDto(data) {
|
|
|
703
703
|
}
|
|
704
704
|
if (data.position === -1) {
|
|
705
705
|
return {
|
|
706
|
-
id:
|
|
706
|
+
id: String(id),
|
|
707
707
|
position: "short",
|
|
708
708
|
priceOpen: data.priceOpen,
|
|
709
709
|
priceTakeProfit: data.priceTakeProfit,
|
|
@@ -744,8 +744,9 @@ async function getSignal(source, { symbol, timeframe, limit }) {
|
|
|
744
744
|
limit,
|
|
745
745
|
});
|
|
746
746
|
const { plots } = await pine.pineJobService.run(await GET_SOURCE_FN(source), symbol, timeframe, limit);
|
|
747
|
+
const resultId = functoolsKit.randomString();
|
|
747
748
|
const data = pine.pineDataService.extract(plots, SIGNAL_SCHEMA);
|
|
748
|
-
return toSignalDto(data);
|
|
749
|
+
return toSignalDto(resultId, data);
|
|
749
750
|
}
|
|
750
751
|
|
|
751
752
|
const DUMP_SIGNAL_METHOD_NAME = "dump.dumpSignal";
|
package/build/index.mjs
CHANGED
|
@@ -687,10 +687,10 @@ function setLogger(logger) {
|
|
|
687
687
|
pine.loggerService.setLogger(logger);
|
|
688
688
|
}
|
|
689
689
|
|
|
690
|
-
function toSignalDto(data) {
|
|
690
|
+
function toSignalDto(id, data) {
|
|
691
691
|
if (data.position === 1) {
|
|
692
692
|
return {
|
|
693
|
-
id:
|
|
693
|
+
id: String(id),
|
|
694
694
|
position: "long",
|
|
695
695
|
priceOpen: data.priceOpen,
|
|
696
696
|
priceTakeProfit: data.priceTakeProfit,
|
|
@@ -700,7 +700,7 @@ function toSignalDto(data) {
|
|
|
700
700
|
}
|
|
701
701
|
if (data.position === -1) {
|
|
702
702
|
return {
|
|
703
|
-
id:
|
|
703
|
+
id: String(id),
|
|
704
704
|
position: "short",
|
|
705
705
|
priceOpen: data.priceOpen,
|
|
706
706
|
priceTakeProfit: data.priceTakeProfit,
|
|
@@ -741,8 +741,9 @@ async function getSignal(source, { symbol, timeframe, limit }) {
|
|
|
741
741
|
limit,
|
|
742
742
|
});
|
|
743
743
|
const { plots } = await pine.pineJobService.run(await GET_SOURCE_FN(source), symbol, timeframe, limit);
|
|
744
|
+
const resultId = randomString();
|
|
744
745
|
const data = pine.pineDataService.extract(plots, SIGNAL_SCHEMA);
|
|
745
|
-
return toSignalDto(data);
|
|
746
|
+
return toSignalDto(resultId, data);
|
|
746
747
|
}
|
|
747
748
|
|
|
748
749
|
const DUMP_SIGNAL_METHOD_NAME = "dump.dumpSignal";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backtest-kit/pinets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Run TradingView Pine Script strategies in Node.js self hosted environment. Execute existing Pine Script indicators and generate trading signals with 1:1 syntax compatibility via PineTS runtime.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
package/types.d.ts
CHANGED
|
@@ -83,9 +83,10 @@ interface IParams {
|
|
|
83
83
|
}
|
|
84
84
|
declare function getSignal(source: File | Code, { symbol, timeframe, limit }: IParams): Promise<ISignalDto | null>;
|
|
85
85
|
|
|
86
|
-
type ResultId$
|
|
87
|
-
declare function dumpPlotData(signalId: ResultId$
|
|
86
|
+
type ResultId$2 = string | number;
|
|
87
|
+
declare function dumpPlotData(signalId: ResultId$2, plots: PlotModel, taName: string, outputDir?: string): Promise<void>;
|
|
88
88
|
|
|
89
|
+
type ResultId$1 = string | number;
|
|
89
90
|
interface SignalData {
|
|
90
91
|
position: number;
|
|
91
92
|
priceOpen: number;
|
|
@@ -96,7 +97,7 @@ interface SignalData {
|
|
|
96
97
|
interface Signal extends ISignalDto {
|
|
97
98
|
id: string;
|
|
98
99
|
}
|
|
99
|
-
declare function toSignalDto(data: SignalData): Signal | null;
|
|
100
|
+
declare function toSignalDto(id: ResultId$1, data: SignalData): Signal | null;
|
|
100
101
|
|
|
101
102
|
interface CandleModel {
|
|
102
103
|
openTime: number;
|