@guihz/trading-vue-editor-tes 0.1.20 → 0.1.21
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/lib/assets/{parserTccWorker-DzdECu81.js → parserTccWorker-DoVd1Ini.js} +44291 -25566
- package/lib/assets/{scriptsRunWorker-DO_0NAgb.js → scriptsRunWorker-NE25FJXj.js} +24876 -15587
- package/lib/components/editor/type/index.d.ts +2 -0
- package/lib/components/editor/utils/parserTccWorker.d.ts +1 -25
- package/lib/components/editor/utils/runTools.d.ts +4 -0
- package/lib/components/editor/utils/tools.d.ts +1 -4
- package/lib/components/editor/v3/parseScript/buildInFuncNamespace/strategy.d.ts +18 -2
- package/lib/components/editor/v3/parseScript/buildInVarNamespace/strategy.d.ts +8 -2
- package/lib/components/editor/v3/parseScript/buildInVariables.d.ts +1 -0
- package/lib/components/editor/v3/parseScript/constants.d.ts +3 -0
- package/lib/components/editor/v3/parseScript/constantsRun.d.ts +2 -0
- package/lib/components/editor/v4/parseScript/buildInFuncNamespace/strategy.d.ts +19 -2
- package/lib/components/editor/v4/parseScript/buildInVarNamespace/strategy.d.ts +8 -4
- package/lib/components/editor/v4/parseScript/constants.d.ts +3 -0
- package/lib/components/editor/v4/parseScript/constantsRun.d.ts +2 -0
- package/lib/components/editor/v5/parseScript/buildInConstants.d.ts +2 -0
- package/lib/components/editor/v5/parseScript/buildInVarNamespace/strategy.d.ts +8 -6
- package/lib/components/editor/v5/parseScript/constants.d.ts +2 -0
- package/lib/components/editor/v5/parseScript/constantsRun.d.ts +2 -0
- package/lib/components/editor/v5/parseScript/constants_en.d.ts +134 -0
- package/lib/components/editor/v5/parseScript/parseToJs.d.ts +2 -0
- package/lib/components/editor/v6/config/monarchTokens.d.ts +205 -0
- package/lib/components/editor/v6/constants/contents_zh.d.ts +6 -0
- package/lib/components/editor/v6/constants/index.d.ts +41 -0
- package/lib/components/editor/v6/parseScript/buildInConstants.d.ts +310 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/array.d.ts +109 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/box.d.ts +83 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/chartPoint.d.ts +26 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/color.d.ts +25 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/errorListener.d.ts +9 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/index.d.ts +25 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/input.d.ts +57 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/label.d.ts +66 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/line.d.ts +74 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/linefill.d.ts +36 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/log.d.ts +39 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/map.d.ts +51 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/math.d.ts +49 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/matrix.d.ts +98 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/polyline.d.ts +32 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/runtime.d.ts +10 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/strategy.d.ts +279 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/string.d.ts +55 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/syminfo.d.ts +9 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/ta.d.ts +125 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/table.d.ts +89 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/timeframe.d.ts +22 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/barstate.d.ts +22 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/chart.d.ts +21 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/dividends.d.ts +8 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/earnings.d.ts +9 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/index.d.ts +9 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/session.d.ts +12 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/strategy.d.ts +146 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/syminfo.d.ts +49 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/ta.d.ts +32 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/timeframe.d.ts +16 -0
- package/lib/components/editor/v6/parseScript/constants.d.ts +146 -0
- package/lib/components/editor/v6/parseScript/constantsRun.d.ts +5 -0
- package/lib/components/editor/v6/parseScript/enum.d.ts +302 -0
- package/lib/components/editor/v6/parseScript/parseToJs.d.ts +78 -0
- package/lib/components/editor/v6/parseScript/parseToLibJs.d.ts +71 -0
- package/lib/components/editor/v6/parseScript/strategyNamespace/closedtrades.d.ts +28 -0
- package/lib/components/editor/v6/parseScript/strategyNamespace/index.d.ts +4 -0
- package/lib/components/editor/v6/parseScript/strategyNamespace/opentrades.d.ts +25 -0
- package/lib/components/editor/v6/parseScript/strategyNamespace/risk.d.ts +22 -0
- package/lib/components/editor/v6/parseScript/type.d.ts +39 -0
- package/lib/components/editor/v6/parseScript/userTypeClass.d.ts +12 -0
- package/lib/components/editor/v6/parseScript/utils.d.ts +21 -0
- package/lib/components/editor/v6/parseScript/visitorParser.d.ts +384 -0
- package/lib/components/editor/v6/parseScript/visitorUtils.d.ts +31 -0
- package/lib/components/editor/v6/parserTccWorker.d.ts +40 -0
- package/lib/components/editor/v6/scriptsRunWorker.d.ts +11 -0
- package/lib/components/editor/v6/tccParser/LexerBase.d.ts +19 -0
- package/lib/components/editor/v6/tccParser/tccScriptParserVisitor.d.ts +507 -0
- package/lib/index-B2LF-839.js +61958 -0
- package/lib/{monarchTokens-D-73EVQs.js → monarchTokens-BNkQaBBZ.js} +22 -22
- package/lib/monarchTokens-Dzsc5GLx.js +563 -0
- package/lib/packages/index.d.ts +1 -1
- package/lib/trading-vue-editor.es.packages.js +1520 -1495
- package/lib/trading-vue-editor.umd.packages.mjs +110 -45
- package/package.json +2 -2
- package/lib/{index-DLIhM_y0.js → index-Clupi1hX.js} +24 -24
@@ -90,6 +90,7 @@ export interface IDocValue {
|
|
90
90
|
disallowedInTemplate?: boolean;
|
91
91
|
expectsTemplate?: boolean;
|
92
92
|
realName?: string;
|
93
|
+
isUserFields?: boolean;
|
93
94
|
}
|
94
95
|
export interface IDetailedDesc {
|
95
96
|
desc: string[];
|
@@ -121,4 +122,5 @@ export interface IImportLibrary {
|
|
121
122
|
types: IDocValue[];
|
122
123
|
methods: IDocValue[];
|
123
124
|
}
|
125
|
+
export type IShapeRatioType = "D" | "M" | "NONE";
|
124
126
|
export {};
|
@@ -1,29 +1,5 @@
|
|
1
1
|
import { IKeyObjectValue } from "../type";
|
2
|
-
export declare function parseTcc(program: string, hasTranscoding: boolean, getImportLibraryFunc: (obj: IKeyObjectValue) => IKeyObjectValue, keyObjs: IKeyObjectValue, version: number): Promise<
|
3
|
-
errors: any[];
|
4
|
-
functions: {
|
5
|
-
[k: string]: import("../type").IDocValue[];
|
6
|
-
};
|
7
|
-
variables: {
|
8
|
-
[k: string]: import("../type").IDocValue[];
|
9
|
-
};
|
10
|
-
types: {
|
11
|
-
[k: string]: import("../type").IDocValue[];
|
12
|
-
};
|
13
|
-
methods: {
|
14
|
-
[k: string]: import("../type").IDocValue[];
|
15
|
-
};
|
16
|
-
overloadsFuncs: import("../type").IKeyValue[];
|
17
|
-
imports: {
|
18
|
-
[k: string]: IKeyObjectValue;
|
19
|
-
};
|
20
|
-
enums: {
|
21
|
-
[k: string]: import("../type").IDocValue[];
|
22
|
-
};
|
23
|
-
codeStr: string;
|
24
|
-
preParserCode: string | undefined;
|
25
|
-
config: IKeyObjectValue;
|
26
|
-
}>;
|
2
|
+
export declare function parseTcc(program: string, hasTranscoding: boolean, getImportLibraryFunc: (obj: IKeyObjectValue) => IKeyObjectValue, keyObjs: IKeyObjectValue, version: number): Promise<IKeyObjectValue>;
|
27
3
|
export declare function parseLibraryCode(program: string, libTitle: string, getImportLibraryFunc: (obj: IKeyObjectValue) => IKeyObjectValue, keyObjs: IKeyObjectValue): Promise<{
|
28
4
|
description: string;
|
29
5
|
codeStr: string;
|
@@ -1 +1,5 @@
|
|
1
|
+
import { IShapeRatioType } from "../type";
|
1
2
|
export declare function getFullTimezoneNameCN(timezone: string): string;
|
3
|
+
export declare function getBalanceByInterval(startTimestamp: number, endTimestamp: number, type: IShapeRatioType): Record<string, number>;
|
4
|
+
export declare function getTimestampDayKey(time: number): string;
|
5
|
+
export declare function getTimestampMonthKey(time: number): string;
|
@@ -1,9 +1,6 @@
|
|
1
1
|
import { editor } from "monaco-editor";
|
2
|
-
import { IKeyValue } from "../type";
|
3
2
|
export declare function getTypeOriginName(type: string): string;
|
4
3
|
export declare function removeContextMenu(editor: editor.IStandaloneCodeEditor): void;
|
5
|
-
export declare function replaceTemplate(template: string, replacements: IKeyValue): string;
|
6
|
-
export declare function encode(str: string): string;
|
7
|
-
export declare function decode(base64: string): string;
|
8
4
|
export declare function getContents(version?: number): Promise<typeof import("../v3/constants") | undefined>;
|
9
5
|
export declare function getMonarchTokens(version?: number): Promise<typeof import("../v3/config/monarchTokens") | undefined>;
|
6
|
+
export declare function getCurrentVersionFirstName(version: number, prefix?: string): string;
|
@@ -63,6 +63,7 @@ interface IOrderArgs {
|
|
63
63
|
last_commission?: number;
|
64
64
|
when?: boolean;
|
65
65
|
long?: boolean;
|
66
|
+
createTime?: number;
|
66
67
|
}
|
67
68
|
type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all';
|
68
69
|
export interface IOrder extends IOrderArgs {
|
@@ -101,6 +102,12 @@ export interface IOrder extends IOrderArgs {
|
|
101
102
|
out_high?: number;
|
102
103
|
isTiggerClose?: boolean;
|
103
104
|
entry_time?: number;
|
105
|
+
unid?: string;
|
106
|
+
realQty?: number;
|
107
|
+
isPartClose?: boolean;
|
108
|
+
occupancyQty?: number;
|
109
|
+
exitOrder?: IKeyObjectValue;
|
110
|
+
isEnd?: boolean;
|
104
111
|
}
|
105
112
|
interface IRisk {
|
106
113
|
allow_entry_in?: VDirection;
|
@@ -151,6 +158,7 @@ export default class Strategy {
|
|
151
158
|
private _cacheArgs;
|
152
159
|
private _useSetArgs;
|
153
160
|
private _id;
|
161
|
+
private _closeOrderList;
|
154
162
|
constructor(variables: BuiltInVariables, options: IKeyObjectValue, mintick: number, errorListener: TccErrorListener, id: string);
|
155
163
|
get _strategyCacheData(): IKeyObjectValue;
|
156
164
|
set _strategyCacheData(val: IKeyObjectValue);
|
@@ -207,6 +215,7 @@ export default class Strategy {
|
|
207
215
|
private _closeOrders;
|
208
216
|
private _closeOrder;
|
209
217
|
private _exitOrdersHandle;
|
218
|
+
private _updateExitOrders;
|
210
219
|
private _orderInExitHandle;
|
211
220
|
private _executesSort;
|
212
221
|
private _getLimitPrice;
|
@@ -220,14 +229,21 @@ export default class Strategy {
|
|
220
229
|
private _onCloseOrderHandle;
|
221
230
|
private _entryOrderHandle;
|
222
231
|
private _orderOrderHandle;
|
232
|
+
private _getHisOrderSurplusQty;
|
223
233
|
private _getCloseOrders;
|
224
234
|
private _closeOrderHandle;
|
235
|
+
private _processCloseOrdersFIFO;
|
225
236
|
private _processCloseOrders;
|
226
237
|
private _exitOrderHandle;
|
238
|
+
private _getUnCloseOrders;
|
227
239
|
private _exit;
|
228
|
-
private
|
240
|
+
private _updateExitOrder;
|
241
|
+
private _calcUpdateExitOrderQty;
|
242
|
+
private _calcExitOrderQty;
|
229
243
|
private _ordersToExit;
|
230
|
-
private
|
244
|
+
private _calcLimitPrice;
|
245
|
+
private _calcStopPrice;
|
246
|
+
private _calcActivePrice;
|
231
247
|
private _stopProfit;
|
232
248
|
private _stopLoss;
|
233
249
|
private _trailStopLoss;
|
@@ -3,7 +3,6 @@ import { IOrder, IStrategy } from "../runType";
|
|
3
3
|
import { BuiltInVariables } from "../buildInVariables";
|
4
4
|
export declare class Strategy {
|
5
5
|
private _orders;
|
6
|
-
private _historyOrders;
|
7
6
|
private _options?;
|
8
7
|
private _max_contracts_held_all;
|
9
8
|
private _max_contracts_held_long;
|
@@ -37,12 +36,18 @@ export declare class Strategy {
|
|
37
36
|
position_size_total: number;
|
38
37
|
openprofit_long: number;
|
39
38
|
openprofit_short: number;
|
39
|
+
private _preHistoryOrderCalcResult;
|
40
|
+
private _firstPrice?;
|
40
41
|
constructor(variables: BuiltInVariables);
|
42
|
+
get _strategyCacheData(): IKeyObjectValue;
|
43
|
+
set _strategyCacheData(data: IKeyObjectValue);
|
41
44
|
update(data: IKeyObjectValue): void;
|
42
45
|
private _calcMaxDrawdownAndMaxRunup;
|
43
46
|
updateOrders(orders: IOrder[]): void;
|
44
47
|
private _calcMaxContracts;
|
45
|
-
|
48
|
+
updateHistoryOrderCalcData(): void;
|
49
|
+
private _createBalanceByInterval;
|
50
|
+
updateHistoryOrder(order?: IOrder): void;
|
46
51
|
updateStrategyOptions(options: IStrategy): void;
|
47
52
|
get account_currency(): string;
|
48
53
|
get closedtrades(): number;
|
@@ -121,6 +126,7 @@ export declare class Strategy {
|
|
121
126
|
equity: number;
|
122
127
|
margin_call_long: number;
|
123
128
|
margin_call_short: number;
|
129
|
+
first_price: number | undefined;
|
124
130
|
};
|
125
131
|
private _getOrderPrices;
|
126
132
|
}
|
@@ -33,6 +33,7 @@ export declare class BuiltInVariables extends Ta {
|
|
33
33
|
cacheSpace: IKeyObjectValue;
|
34
34
|
taCacheData: IKeyObjectValue;
|
35
35
|
barstateCacheData: IKeyObjectValue;
|
36
|
+
strategyCacheData: IKeyObjectValue;
|
36
37
|
};
|
37
38
|
setVarCacheData(data: IKeyObjectValue): void;
|
38
39
|
get bar_index(): number;
|
@@ -93,6 +93,9 @@ export declare const ERRORS_TIPS: {
|
|
93
93
|
optionsRepeatErr: string;
|
94
94
|
scriptLongTimeErr: string;
|
95
95
|
plotFillForceOverlayErr: string;
|
96
|
+
constModifyErr: string;
|
97
|
+
maxOpenOrdersErr: string;
|
98
|
+
maxOrdersErr: string;
|
96
99
|
};
|
97
100
|
export declare const WARNING_TIPS: {
|
98
101
|
repeatVar: string;
|
@@ -1,3 +1,5 @@
|
|
1
1
|
export declare const PERIOD_MAP: Record<string, string>;
|
2
2
|
export declare const PERIOD_UNIT_MAP: Record<string, string>;
|
3
3
|
export declare const SYMBOL_MAP: Record<string, string>;
|
4
|
+
export declare const MAX_STRATEGY_ORDERS_COUNT = 9000;
|
5
|
+
export declare const MAX_STRATEGY_OPEN_ORDERS_COUNT = 3000;
|
@@ -63,6 +63,7 @@ interface IOrderArgs {
|
|
63
63
|
last_commission?: number;
|
64
64
|
when?: boolean;
|
65
65
|
long?: boolean;
|
66
|
+
createTime?: number;
|
66
67
|
}
|
67
68
|
type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all';
|
68
69
|
export interface IOrder extends IOrderArgs {
|
@@ -101,6 +102,12 @@ export interface IOrder extends IOrderArgs {
|
|
101
102
|
out_high?: number;
|
102
103
|
isTiggerClose?: boolean;
|
103
104
|
entry_time?: number;
|
105
|
+
unid?: string;
|
106
|
+
realQty?: number;
|
107
|
+
isPartClose?: boolean;
|
108
|
+
occupancyQty?: number;
|
109
|
+
exitOrder?: IKeyObjectValue;
|
110
|
+
isEnd?: boolean;
|
104
111
|
}
|
105
112
|
interface IRisk {
|
106
113
|
allow_entry_in?: VDirection;
|
@@ -151,6 +158,7 @@ export default class Strategy {
|
|
151
158
|
calcOnOrderFillsData: IFillsData;
|
152
159
|
private _cacheArgs;
|
153
160
|
private _useSetArgs;
|
161
|
+
private _closeOrderList;
|
154
162
|
constructor(variables: BuiltInVariables, options: IKeyObjectValue, mintick: number, errorListener: TccErrorListener, id: string);
|
155
163
|
get _strategyCacheData(): IKeyObjectValue;
|
156
164
|
set _strategyCacheData(val: IKeyObjectValue);
|
@@ -207,6 +215,8 @@ export default class Strategy {
|
|
207
215
|
private _closeOrders;
|
208
216
|
private _closeOrder;
|
209
217
|
private _exitOrdersHandle;
|
218
|
+
private _updateExitOrders;
|
219
|
+
private _orderInExitHandle;
|
210
220
|
private _executesSort;
|
211
221
|
private _getLimitPrice;
|
212
222
|
private _getStopPrice;
|
@@ -219,14 +229,21 @@ export default class Strategy {
|
|
219
229
|
private _onCloseOrderHandle;
|
220
230
|
private _entryOrderHandle;
|
221
231
|
private _orderOrderHandle;
|
232
|
+
private _getHisOrderSurplusQty;
|
222
233
|
private _getCloseOrders;
|
223
234
|
private _closeOrderHandle;
|
235
|
+
private _processCloseOrdersFIFO;
|
224
236
|
private _processCloseOrders;
|
225
237
|
private _exitOrderHandle;
|
238
|
+
private _getUnCloseOrders;
|
226
239
|
private _exit;
|
227
|
-
private
|
240
|
+
private _updateExitOrder;
|
241
|
+
private _calcUpdateExitOrderQty;
|
242
|
+
private _calcExitOrderQty;
|
228
243
|
private _ordersToExit;
|
229
|
-
private
|
244
|
+
private _calcLimitPrice;
|
245
|
+
private _calcStopPrice;
|
246
|
+
private _calcActivePrice;
|
230
247
|
private _stopProfit;
|
231
248
|
private _stopLoss;
|
232
249
|
private _trailStopLoss;
|
@@ -3,7 +3,6 @@ import { IOrder, IStrategy } from "../buildInFuncNamespace";
|
|
3
3
|
import { BuiltInVariables } from "../buildInVariables";
|
4
4
|
export declare class Strategy {
|
5
5
|
private _orders;
|
6
|
-
private _historyOrders;
|
7
6
|
private _options?;
|
8
7
|
private _max_contracts_held_all;
|
9
8
|
private _max_contracts_held_long;
|
@@ -38,12 +37,18 @@ export declare class Strategy {
|
|
38
37
|
position_size_total: number;
|
39
38
|
openprofit_long: number;
|
40
39
|
openprofit_short: number;
|
40
|
+
private _preHistoryOrderCalcResult;
|
41
|
+
private _firstPrice?;
|
41
42
|
constructor(variables: BuiltInVariables);
|
43
|
+
get _strategyCacheData(): IKeyObjectValue;
|
44
|
+
set _strategyCacheData(data: IKeyObjectValue);
|
42
45
|
update(data: IKeyObjectValue): void;
|
43
46
|
private _calcMaxDrawdownAndMaxRunup;
|
44
47
|
updateOrders(orders: IOrder[]): void;
|
45
48
|
private _calcMaxContracts;
|
46
|
-
|
49
|
+
updateHistoryOrderCalcData(): void;
|
50
|
+
private _createBalanceByInterval;
|
51
|
+
updateHistoryOrder(order?: IOrder): void;
|
47
52
|
updateStrategyOptions(options: IStrategy): void;
|
48
53
|
get long(): boolean;
|
49
54
|
get short(): boolean;
|
@@ -120,7 +125,6 @@ export declare class Strategy {
|
|
120
125
|
equity: number;
|
121
126
|
margin_call_long: number;
|
122
127
|
margin_call_short: number;
|
128
|
+
first_price: number | undefined;
|
123
129
|
};
|
124
|
-
private _getOrderPrices;
|
125
|
-
private _getCommission;
|
126
130
|
}
|
@@ -93,6 +93,9 @@ export declare const ERRORS_TIPS: {
|
|
93
93
|
optionsRepeatErr: string;
|
94
94
|
scriptLongTimeErr: string;
|
95
95
|
plotFillForceOverlayErr: string;
|
96
|
+
constModifyErr: string;
|
97
|
+
maxOpenOrdersErr: string;
|
98
|
+
maxOrdersErr: string;
|
96
99
|
};
|
97
100
|
export declare const WARNING_TIPS: {
|
98
101
|
repeatVar: string;
|
@@ -1,3 +1,5 @@
|
|
1
1
|
export declare const PERIOD_MAP: Record<string, string>;
|
2
2
|
export declare const PERIOD_UNIT_MAP: Record<string, string>;
|
3
3
|
export declare const SYMBOL_MAP: Record<string, string>;
|
4
|
+
export declare const MAX_STRATEGY_ORDERS_COUNT = 9000;
|
5
|
+
export declare const MAX_STRATEGY_OPEN_ORDERS_COUNT = 3000;
|
@@ -1,10 +1,8 @@
|
|
1
1
|
import { IKeyObjectValue } from "../../../type";
|
2
2
|
import { IOrder, IStrategy } from "../buildInFuncNamespace";
|
3
3
|
import { BuiltInVariables } from "../buildInVariables";
|
4
|
-
import { VDirection } from "../enum";
|
5
4
|
export declare class Strategy {
|
6
5
|
private _orders;
|
7
|
-
private _historyOrders;
|
8
6
|
private _options?;
|
9
7
|
private _max_contracts_held_all;
|
10
8
|
private _max_contracts_held_long;
|
@@ -39,15 +37,19 @@ export declare class Strategy {
|
|
39
37
|
position_size_total: number;
|
40
38
|
openprofit_long: number;
|
41
39
|
openprofit_short: number;
|
40
|
+
private _preHistoryOrderCalcResult;
|
41
|
+
private _firstPrice?;
|
42
42
|
constructor(variables: BuiltInVariables);
|
43
|
+
get _strategyCacheData(): IKeyObjectValue;
|
44
|
+
set _strategyCacheData(data: IKeyObjectValue);
|
43
45
|
update(data: IKeyObjectValue): void;
|
44
46
|
private _calcMaxDrawdownAndMaxRunup;
|
45
47
|
updateOrders(orders: IOrder[]): void;
|
46
48
|
private _calcMaxContracts;
|
47
|
-
|
49
|
+
updateHistoryOrderCalcData(): void;
|
50
|
+
private _createBalanceByInterval;
|
51
|
+
updateHistoryOrder(order?: IOrder): void;
|
48
52
|
updateStrategyOptions(options: IStrategy): void;
|
49
|
-
get long(): VDirection;
|
50
|
-
get short(): VDirection;
|
51
53
|
get account_currency(): string;
|
52
54
|
get closedtrades(): number;
|
53
55
|
get opentrades(): {
|
@@ -131,7 +133,7 @@ export declare class Strategy {
|
|
131
133
|
equity: number;
|
132
134
|
margin_call_long: number;
|
133
135
|
margin_call_short: number;
|
136
|
+
first_price: number | undefined;
|
134
137
|
};
|
135
138
|
private _getOrderPrices;
|
136
|
-
private _getCommission;
|
137
139
|
}
|
@@ -102,6 +102,8 @@ export declare const ERRORS_TIPS: {
|
|
102
102
|
matrixSetValueErr: string;
|
103
103
|
matrixRowsColsEqErr: string;
|
104
104
|
matrixMultErr: string;
|
105
|
+
maxOpenOrdersErr: string;
|
106
|
+
maxOrdersErr: string;
|
105
107
|
};
|
106
108
|
export declare const WARNING_TIPS: {
|
107
109
|
repeatVar: string;
|
@@ -1,3 +1,5 @@
|
|
1
1
|
export declare const PERIOD_MAP: Record<string, string>;
|
2
2
|
export declare const PERIOD_UNIT_MAP: Record<string, string>;
|
3
3
|
export declare const SYMBOL_MAP: Record<string, string>;
|
4
|
+
export declare const MAX_STRATEGY_ORDERS_COUNT = 9000;
|
5
|
+
export declare const MAX_STRATEGY_OPEN_ORDERS_COUNT = 3000;
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import { VType } from "./enum";
|
2
|
+
export declare const ERRORS_TIPS: {
|
3
|
+
onlyInLoop: string;
|
4
|
+
invalidType: string;
|
5
|
+
typeUseError: string;
|
6
|
+
notTypeKeyword: string;
|
7
|
+
undeclared: string;
|
8
|
+
repeatVar: string;
|
9
|
+
typeRepeatErr: string;
|
10
|
+
typeMismatch: string;
|
11
|
+
assignTypeMismatch: string;
|
12
|
+
voidNotVar: string;
|
13
|
+
declareTypeErr: string;
|
14
|
+
mapKeyValErr: string;
|
15
|
+
inputSourceErr: string;
|
16
|
+
buildInUseErr: string;
|
17
|
+
argsLenErr: string;
|
18
|
+
requiredParamErr: string;
|
19
|
+
argsSyntaxErr: string;
|
20
|
+
requestArgsErr: string;
|
21
|
+
mapKeyErr: string;
|
22
|
+
templateErr: string;
|
23
|
+
templateNoSupportErr: string;
|
24
|
+
ifOrSwitchTypeErr: string;
|
25
|
+
argsNameErr: string;
|
26
|
+
noFiledErr: string;
|
27
|
+
methodNotExistErr: string;
|
28
|
+
tupleVarErr: string;
|
29
|
+
tupleLeftVarErr: string;
|
30
|
+
tupleRightVarErr: string;
|
31
|
+
tempateTypeErr: string;
|
32
|
+
qualifierErr: string;
|
33
|
+
notFindFuncErr: string;
|
34
|
+
naVarErr: string;
|
35
|
+
notHistoryErr: string;
|
36
|
+
defaultValueErr: string;
|
37
|
+
defaultValueTypeErr: string;
|
38
|
+
typeFieldErr: string;
|
39
|
+
unaryErr: string;
|
40
|
+
funcArgAssignErr: string;
|
41
|
+
declaredErr: string;
|
42
|
+
globalFuncErr: string;
|
43
|
+
onlyStatementErr: string;
|
44
|
+
modifyGlobalVarErr: string;
|
45
|
+
inputDefvalErr: string;
|
46
|
+
objectIsNaErr: string;
|
47
|
+
buidinAssignErr: string;
|
48
|
+
buidinVarErr: string;
|
49
|
+
useNaErr: string;
|
50
|
+
libraryTitleErr: string;
|
51
|
+
exportFuncArgErr: string;
|
52
|
+
indiRunErr: string;
|
53
|
+
libraryExportErr: string;
|
54
|
+
strategyRunErr: string;
|
55
|
+
exportUseErr: string;
|
56
|
+
funcRepeatErr: string;
|
57
|
+
importMultipleErr: string;
|
58
|
+
importNotExitErr: string;
|
59
|
+
importNameRepeatErr: string;
|
60
|
+
exportFuncHasInputErr: string;
|
61
|
+
libraryTitleIsKeywordErr: string;
|
62
|
+
exportFuncUseGlobalVarErr: string;
|
63
|
+
loopRuntimeErr: string;
|
64
|
+
paramsErr: string;
|
65
|
+
displayErr: string;
|
66
|
+
exportFuncUseReqErr: string;
|
67
|
+
requestExprErr: string;
|
68
|
+
argDefaultErr: string;
|
69
|
+
overloadFuncErr: string;
|
70
|
+
againAssignErr: string;
|
71
|
+
requestUserInLoopErr: string;
|
72
|
+
enumVarNameErr: string;
|
73
|
+
enumVarNameBuiltinErr: string;
|
74
|
+
typeNameErr: string;
|
75
|
+
enumUseErr: string;
|
76
|
+
conditionalErr: string;
|
77
|
+
fortoErr: string;
|
78
|
+
indicatorUseStrategyFuncErr: string;
|
79
|
+
arrEmptyErr: string;
|
80
|
+
arrLengthDiffErr: string;
|
81
|
+
arrTypeErr: string;
|
82
|
+
inputOptErr: string;
|
83
|
+
mathRandomErr: string;
|
84
|
+
matrixRehapeErr: string;
|
85
|
+
strategyExitErr: string;
|
86
|
+
arrLenErr: string;
|
87
|
+
mergeCellErr: string;
|
88
|
+
minOrMaxErr: string;
|
89
|
+
requestsNumErr: string;
|
90
|
+
undeterminedTypeMethodErr: string;
|
91
|
+
requestUseFuncErr: string;
|
92
|
+
requestLowerTfPeriodErr: string;
|
93
|
+
optionsRepeatErr: string;
|
94
|
+
scriptLongTimeErr: string;
|
95
|
+
plotFillForceOverlayErr: string;
|
96
|
+
constModifyErr: string;
|
97
|
+
arrMaxLenErr: string;
|
98
|
+
arrSetValueErr: string;
|
99
|
+
matrixMaxLenErr: string;
|
100
|
+
matrixToFromErr: string;
|
101
|
+
matrixAddRowColErr: string;
|
102
|
+
matrixSetValueErr: string;
|
103
|
+
matrixRowsColsEqErr: string;
|
104
|
+
matrixMultErr: string;
|
105
|
+
};
|
106
|
+
export declare const WARNING_TIPS: {
|
107
|
+
repeatVar: string;
|
108
|
+
typeMismatch: string;
|
109
|
+
moreSameArg: string;
|
110
|
+
localScopeGetHistory: string;
|
111
|
+
localScopeWarning: string;
|
112
|
+
strategyCalcTickWarn: string;
|
113
|
+
conditionWarning: string;
|
114
|
+
lineWidthWarning: string;
|
115
|
+
boolVarNumWarning: string;
|
116
|
+
transpDeprecatedTips: string;
|
117
|
+
};
|
118
|
+
export declare const DRAW_TYPES: VType[];
|
119
|
+
export declare const QUALIFIERS: VType[];
|
120
|
+
export declare const BASE_TYPE: VType[];
|
121
|
+
export declare const PLOT_DISPLAY_TYPES: string[];
|
122
|
+
export declare const ONLY_STATEMENTS: string[];
|
123
|
+
export declare const GLOBAL_DRAW_FUNCS: string[];
|
124
|
+
export declare const GLOBAL_FUNCS: string[];
|
125
|
+
export declare const INDICATOR_NEED_DRAW_FUNCS: string[];
|
126
|
+
export declare const STRATEGY_NEED_FUNCS: string[];
|
127
|
+
export declare const NAMESPACE_CALL_SELF_FUNCS: string[];
|
128
|
+
export declare const SOURCE_TYPE_BUILTIN: string[];
|
129
|
+
export declare const COMMENTS_DESC_REG: RegExp;
|
130
|
+
export declare const JS_KEYWORDS: string[];
|
131
|
+
export declare const TCC_KEYWORDS: string[];
|
132
|
+
export declare const TCC_NAMESAPCES: string[];
|
133
|
+
export declare const CHANGE_VALUE_FUNCS: string[];
|
134
|
+
export declare const TRANSP_FUNCS: string[];
|
@@ -20,7 +20,9 @@ export default class ParseToJs {
|
|
20
20
|
private _dependsObj;
|
21
21
|
private _enums;
|
22
22
|
private _preRunMembers;
|
23
|
+
private _isInConditionalStmt;
|
23
24
|
private _preRunMembersFuncs;
|
25
|
+
private _preRunMemberFuncsCount;
|
24
26
|
private __count;
|
25
27
|
preParseCode: string;
|
26
28
|
private _hasLeftVisibleBarTime;
|