@guihz/trading-vue-editor-tes 0.1.19 → 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-BCWxJvBi.js → parserTccWorker-DoVd1Ini.js} +2749 -2726
- package/lib/assets/{scriptsRunWorker-AjKVFLY2.js → scriptsRunWorker-NE25FJXj.js} +11131 -10306
- package/lib/components/editor/type/index.d.ts +1 -0
- 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 +1 -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 +1 -0
- package/lib/components/editor/v4/parseScript/constantsRun.d.ts +2 -0
- package/lib/components/editor/v5/parseScript/buildInVarNamespace/strategy.d.ts +8 -3
- package/lib/components/editor/v5/parseScript/constants.d.ts +1 -1
- package/lib/components/editor/v5/parseScript/constantsRun.d.ts +2 -0
- package/lib/components/editor/v6/parseScript/buildInFuncNamespace/strategy.d.ts +1 -0
- package/lib/components/editor/v6/parseScript/buildInVarNamespace/strategy.d.ts +2 -0
- package/lib/components/editor/v6/parseScript/constants.d.ts +7 -0
- package/lib/components/editor/v6/parseScript/type.d.ts +0 -1
- package/lib/components/editor/v6/parseScript/utils.d.ts +0 -4
- package/lib/components/editor/v6/parseScript/visitorParser.d.ts +2 -0
- package/lib/components/editor/v6/parseScript/visitorUtils.d.ts +1 -1
- package/lib/{index-C8vqcsNB.js → index-B2LF-839.js} +122 -122
- package/lib/{monarchTokens-_UFEzBJ_.js → monarchTokens-Dzsc5GLx.js} +1 -1
- package/lib/trading-vue-editor.es.packages.js +1504 -1492
- package/lib/trading-vue-editor.umd.packages.mjs +33 -33
- package/package.json +1 -1
@@ -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;
|
@@ -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
|
}
|
@@ -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;
|
@@ -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 account_currency(): string;
|
49
54
|
get closedtrades(): number;
|
@@ -128,7 +133,7 @@ export declare class Strategy {
|
|
128
133
|
equity: number;
|
129
134
|
margin_call_long: number;
|
130
135
|
margin_call_short: number;
|
136
|
+
first_price: number | undefined;
|
131
137
|
};
|
132
138
|
private _getOrderPrices;
|
133
|
-
private _getCommission;
|
134
139
|
}
|
@@ -103,7 +103,7 @@ export declare const ERRORS_TIPS: {
|
|
103
103
|
matrixRowsColsEqErr: string;
|
104
104
|
matrixMultErr: string;
|
105
105
|
maxOpenOrdersErr: string;
|
106
|
-
|
106
|
+
maxOrdersErr: string;
|
107
107
|
};
|
108
108
|
export declare const WARNING_TIPS: {
|
109
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;
|
@@ -176,6 +176,7 @@ export default class Strategy {
|
|
176
176
|
get closedtrades(): Closedtrdes;
|
177
177
|
get risk(): Risk;
|
178
178
|
get isCalcOnEveryTick(): boolean | undefined;
|
179
|
+
getFirstIndex(): number;
|
179
180
|
updateOptions(options?: IStrategy): void;
|
180
181
|
update(): void;
|
181
182
|
calcCurrentOrder(): void;
|
@@ -39,6 +39,7 @@ export declare class Strategy {
|
|
39
39
|
openprofit_short: number;
|
40
40
|
private _firstIndex;
|
41
41
|
private _preHistoryOrderCalcResult;
|
42
|
+
private _firstPrice?;
|
42
43
|
constructor(variables: BuiltInVariables);
|
43
44
|
get _strategyCacheData(): IKeyObjectValue;
|
44
45
|
set _strategyCacheData(data: IKeyObjectValue);
|
@@ -139,6 +140,7 @@ export declare class Strategy {
|
|
139
140
|
equity: number;
|
140
141
|
margin_call_long: number;
|
141
142
|
margin_call_short: number;
|
143
|
+
first_price: number | undefined;
|
142
144
|
};
|
143
145
|
private _getOrderPrices;
|
144
146
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { IKeyValueStr } from "../../type";
|
1
2
|
import { VType } from "./enum";
|
2
3
|
export declare const ERRORS_TIPS: {
|
3
4
|
onlyInLoop: string;
|
@@ -107,6 +108,11 @@ export declare const ERRORS_TIPS: {
|
|
107
108
|
historyReferencingOperatorUseFieldErr: string;
|
108
109
|
moreSameArgErr: string;
|
109
110
|
lineWidthErr: string;
|
111
|
+
ifOrSwitchQualifiedTypeErr: string;
|
112
|
+
conditionTypeErr: string;
|
113
|
+
boolVarErr: string;
|
114
|
+
naCompareErr: string;
|
115
|
+
notConstConditionTypeErr: string;
|
110
116
|
};
|
111
117
|
export declare const WARNING_TIPS: {
|
112
118
|
repeatVar: string;
|
@@ -137,3 +143,4 @@ export declare const TCC_KEYWORDS: string[];
|
|
137
143
|
export declare const TCC_NAMESAPCES: string[];
|
138
144
|
export declare const CHANGE_VALUE_FUNCS: string[];
|
139
145
|
export declare const TRANSP_FUNCS: string[];
|
146
|
+
export declare const BUILDIN_CONST_QUALIFIERS: IKeyValueStr;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { IKeyValue } from "../../type";
|
2
2
|
import { TccErrorListener } from "./buildInFuncNamespace";
|
3
|
-
import { IShapeRatioType } from "./type";
|
4
3
|
import moment from 'moment-timezone';
|
5
4
|
export declare function replaceTemplate(template: string, replacements: IKeyValue): string;
|
6
5
|
export declare function parsePerid(period: string): (string | number)[];
|
@@ -20,6 +19,3 @@ export declare function decimalFloor(num?: number, precision?: number): number |
|
|
20
19
|
export declare function parsePeriodHandle(period?: string): string;
|
21
20
|
export declare function transformPeriod(period: string): string;
|
22
21
|
export declare function addRequestUseFuncError(errorListener: TccErrorListener, funcName: string, reqName: string, posStr: string): void;
|
23
|
-
export declare function getBalanceByInterval(startTimestamp: number, endTimestamp: number, type: IShapeRatioType): Record<string, number>;
|
24
|
-
export declare function getTimestampDayKey(time: number): string;
|
25
|
-
export declare function getTimestampMonthKey(time: number): string;
|
@@ -97,6 +97,7 @@ export default class ParserVisitor extends ParserUtils {
|
|
97
97
|
value: IKeyObjectValue;
|
98
98
|
};
|
99
99
|
visitAgainAssignName: (ctx: IKeyObjectValue) => IKeyObjectValue;
|
100
|
+
private _updateVariableType;
|
100
101
|
visitVarSingle: (ctx: IKeyObjectValue) => IKeyObjectValue;
|
101
102
|
/**
|
102
103
|
* 解析注释
|
@@ -379,4 +380,5 @@ export default class ParserVisitor extends ParserUtils {
|
|
379
380
|
* @returns 返回一个类型数组,表示该代码块可能的返回类型
|
380
381
|
*/
|
381
382
|
private _getBlockReturnTypes;
|
383
|
+
private _ifOrSwitchQualifiedTypeVerify;
|
382
384
|
}
|
@@ -12,7 +12,7 @@ export declare class ParserUtils extends TccScriptParserVisitor<any> {
|
|
12
12
|
protected _returnTypesOtherHandle(firstArg: IKeyObjectValue, returnType: string, returnTypes: string[], name: string): string[];
|
13
13
|
protected _checkMethodThisType(thisType: string[], type: string): boolean;
|
14
14
|
protected _priorityComparison(currentType: string, targetType: string): boolean;
|
15
|
-
protected _compareType(currentType: string, targetType: string
|
15
|
+
protected _compareType(currentType: string, targetType: string): boolean;
|
16
16
|
protected _compareVarType(currentType: string, targetType: string): boolean;
|
17
17
|
protected _typeAddSeries(type: string): string;
|
18
18
|
protected _typeAddConst(type: string): string;
|