@guihz/trading-vue-editor-tes 0.1.14 → 0.1.15
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-C_5Yn3gz.js → parserTccWorker-DioKBXbA.js} +173 -173
- package/lib/assets/{scriptsRunWorker-DssGldLj.js → scriptsRunWorker-BwOwrd6j.js} +6365 -6126
- package/lib/components/editor/v3/parseScript/buildInConstants.d.ts +5 -5
- package/lib/components/editor/v3/parseScript/buildInFuncNamespace/strategy.d.ts +1 -0
- package/lib/components/editor/v4/parseScript/buildInFuncNamespace/table.d.ts +1 -0
- package/lib/components/editor/v5/parseScript/buildInFuncNamespace/strategy.d.ts +19 -2
- package/lib/components/editor/v5/parseScript/buildInFuncNamespace/strategyNew.d.ts +261 -0
- package/lib/components/editor/v5/parseScript/buildInFuncNamespace/table.d.ts +1 -0
- package/lib/trading-vue-editor.es.packages.js +79 -79
- package/lib/trading-vue-editor.umd.packages.mjs +12 -12
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { VPlotDisplay, VHlineStyle, VLocation, VPlotStyle, VAdjustment,
|
1
|
+
import { VPlotDisplay, VHlineStyle, VLocation, VPlotStyle, VAdjustment, VScale, VSession, VShape, VSize, VStrategy, VCommission, VDirection, VOca, VInputType } from './enum';
|
2
2
|
export declare const COLOR_BUILD_IN: {
|
3
3
|
aqua: string;
|
4
4
|
black: string;
|
@@ -168,10 +168,10 @@ export declare class BuildInConstants {
|
|
168
168
|
ZAR: string;
|
169
169
|
};
|
170
170
|
barmerge: {
|
171
|
-
gaps_off:
|
172
|
-
gaps_on:
|
173
|
-
lookahead_off:
|
174
|
-
lookahead_on:
|
171
|
+
gaps_off: boolean;
|
172
|
+
gaps_on: boolean;
|
173
|
+
lookahead_off: boolean;
|
174
|
+
lookahead_on: boolean;
|
175
175
|
};
|
176
176
|
true: boolean;
|
177
177
|
false: boolean;
|
@@ -65,6 +65,7 @@ interface IOrderArgs {
|
|
65
65
|
comment_loss?: string;
|
66
66
|
comment_trailing?: string;
|
67
67
|
last_commission?: number;
|
68
|
+
createTime?: number;
|
68
69
|
}
|
69
70
|
type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all' | 'close_all_short' | 'close_all_long';
|
70
71
|
export interface IOrder extends IOrderArgs {
|
@@ -103,6 +104,12 @@ export interface IOrder extends IOrderArgs {
|
|
103
104
|
out_high?: number;
|
104
105
|
isTiggerClose?: boolean;
|
105
106
|
entry_time?: number;
|
107
|
+
unid?: string;
|
108
|
+
realQty?: number;
|
109
|
+
isPartClose?: boolean;
|
110
|
+
occupancyQty?: number;
|
111
|
+
exitOrder?: IKeyObjectValue;
|
112
|
+
isEnd?: boolean;
|
106
113
|
}
|
107
114
|
interface IRisk {
|
108
115
|
allow_entry_in?: VDirection;
|
@@ -155,6 +162,7 @@ export default class Strategy {
|
|
155
162
|
calcOnOrderFillsData: IFillsData;
|
156
163
|
private _cacheArgs;
|
157
164
|
private _useSetArgs;
|
165
|
+
private _closeOrderList;
|
158
166
|
constructor(variables: BuiltInVariables, options: IKeyObjectValue, mintick: number, errorListener: TccErrorListener, id: string);
|
159
167
|
get _strategyCacheData(): IKeyObjectValue;
|
160
168
|
set _strategyCacheData(val: IKeyObjectValue);
|
@@ -221,6 +229,8 @@ export default class Strategy {
|
|
221
229
|
private _closeOrders;
|
222
230
|
private _closeOrder;
|
223
231
|
private _exitOrdersHandle;
|
232
|
+
private _updateExitOrders;
|
233
|
+
private _orderInExitHandle;
|
224
234
|
private _executesSort;
|
225
235
|
private _getLimitPrice;
|
226
236
|
private _getStopPrice;
|
@@ -233,14 +243,21 @@ export default class Strategy {
|
|
233
243
|
private _onCloseOrderHandle;
|
234
244
|
private _entryOrderHandle;
|
235
245
|
private _orderOrderHandle;
|
246
|
+
private _getHisOrderSurplusQty;
|
236
247
|
private _getCloseOrders;
|
237
248
|
private _closeOrderHandle;
|
249
|
+
private _processCloseOrdersFIFO;
|
238
250
|
private _processCloseOrders;
|
239
251
|
private _exitOrderHandle;
|
252
|
+
private _getUnCloseOrders;
|
240
253
|
private _exit;
|
241
|
-
private
|
254
|
+
private _updateExitOrder;
|
255
|
+
private _calcUpdateExitOrderQty;
|
256
|
+
private _calcExitOrderQty;
|
242
257
|
private _ordersToExit;
|
243
|
-
private
|
258
|
+
private _calcLimitPrice;
|
259
|
+
private _calcStopPrice;
|
260
|
+
private _calcActivePrice;
|
244
261
|
private _stopProfit;
|
245
262
|
private _stopLoss;
|
246
263
|
private _trailStopLoss;
|
@@ -0,0 +1,261 @@
|
|
1
|
+
import { TccErrorListener } from ".";
|
2
|
+
import { IKeyObjectValue } from "../../../type";
|
3
|
+
import { BuiltInVariables } from "../buildInVariables";
|
4
|
+
import { VCommission, VDirection, VFormatType, VOca, VScale, VStrategy } from "../enum";
|
5
|
+
import { Closedtrdes, Opentrades, Risk } from '../strategyNamespace';
|
6
|
+
export interface IStrategy {
|
7
|
+
title?: string;
|
8
|
+
shorttitle?: string;
|
9
|
+
overlay?: boolean;
|
10
|
+
format?: VFormatType;
|
11
|
+
precision?: number;
|
12
|
+
scale?: VScale;
|
13
|
+
pyramiding?: number;
|
14
|
+
calc_on_order_fills?: boolean;
|
15
|
+
calc_on_every_tick?: boolean;
|
16
|
+
max_bars_back?: number;
|
17
|
+
backtest_fill_limits_assumption?: number;
|
18
|
+
default_qty_type?: VStrategy;
|
19
|
+
default_qty_value?: number;
|
20
|
+
initial_capital: number;
|
21
|
+
currency?: string;
|
22
|
+
slippage?: number;
|
23
|
+
commission_type?: VCommission;
|
24
|
+
commission_value?: number;
|
25
|
+
process_orders_on_close?: boolean;
|
26
|
+
close_entries_rule?: CloseEntriesRuleType;
|
27
|
+
margin_long?: number;
|
28
|
+
margin_short?: number;
|
29
|
+
explicit_plot_zorder?: boolean;
|
30
|
+
max_lines_count?: number;
|
31
|
+
max_labels_count?: number;
|
32
|
+
max_boxes_count?: number;
|
33
|
+
calc_bars_count?: number;
|
34
|
+
risk_free_rate?: number;
|
35
|
+
use_bar_magnifier?: boolean;
|
36
|
+
fill_orders_on_standard_ohlc?: boolean;
|
37
|
+
max_polylines_count?: number;
|
38
|
+
scriptType?: string;
|
39
|
+
direction_short_long?: boolean;
|
40
|
+
}
|
41
|
+
interface IArgs {
|
42
|
+
value?: number;
|
43
|
+
fill_price?: number;
|
44
|
+
}
|
45
|
+
interface IOrderArgs {
|
46
|
+
id: string;
|
47
|
+
direction: VDirection;
|
48
|
+
from_entry?: string;
|
49
|
+
qty?: number;
|
50
|
+
limit?: number;
|
51
|
+
loss?: number;
|
52
|
+
stop?: number;
|
53
|
+
oca_name?: string;
|
54
|
+
oca_type?: VOca;
|
55
|
+
comment?: string;
|
56
|
+
alert_message?: string;
|
57
|
+
disable_alert?: false;
|
58
|
+
qty_percent?: number;
|
59
|
+
immediately?: boolean;
|
60
|
+
trail_price?: number;
|
61
|
+
trail_points?: number;
|
62
|
+
trail_offset?: number;
|
63
|
+
profit?: number;
|
64
|
+
comment_profit?: string;
|
65
|
+
comment_loss?: string;
|
66
|
+
comment_trailing?: string;
|
67
|
+
last_commission?: number;
|
68
|
+
}
|
69
|
+
type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all' | 'close_all_short' | 'close_all_long';
|
70
|
+
export interface IOrder extends IOrderArgs {
|
71
|
+
isMarketPrice?: boolean;
|
72
|
+
out_id?: string;
|
73
|
+
in_index?: number;
|
74
|
+
out_index?: number;
|
75
|
+
in_price: number;
|
76
|
+
out_price?: number;
|
77
|
+
in_time?: number;
|
78
|
+
out_time?: number;
|
79
|
+
out_qty?: number;
|
80
|
+
out_comment?: string;
|
81
|
+
total_profit?: number;
|
82
|
+
max_profit?: number;
|
83
|
+
trading_loss?: number;
|
84
|
+
place_order_type?: PlaceOrderType;
|
85
|
+
position_close_type?: PlaceOrderType;
|
86
|
+
isDeal?: boolean;
|
87
|
+
exitIds?: string[];
|
88
|
+
active_price?: number;
|
89
|
+
trail_stop_price?: number;
|
90
|
+
hasOrder?: boolean;
|
91
|
+
isMarketPriceLimit?: boolean;
|
92
|
+
isMarketPriceStop?: boolean;
|
93
|
+
isCancel?: boolean;
|
94
|
+
close_qty?: number;
|
95
|
+
profit_percent?: number;
|
96
|
+
max_profit_percent?: number;
|
97
|
+
trading_loss_percent?: number;
|
98
|
+
commission?: number;
|
99
|
+
original_qty?: number;
|
100
|
+
in_low?: number;
|
101
|
+
in_high?: number;
|
102
|
+
out_low?: number;
|
103
|
+
out_high?: number;
|
104
|
+
isTiggerClose?: boolean;
|
105
|
+
entry_time?: number;
|
106
|
+
unid?: string;
|
107
|
+
}
|
108
|
+
interface IRisk {
|
109
|
+
allow_entry_in?: VDirection;
|
110
|
+
max_cons_loss_days?: number;
|
111
|
+
max_drawdown?: number;
|
112
|
+
max_drawdown_type?: VStrategy;
|
113
|
+
max_intraday_filled_orders?: number;
|
114
|
+
max_intraday_loss?: number;
|
115
|
+
max_intraday_loss_type?: VStrategy;
|
116
|
+
max_position_size?: number;
|
117
|
+
isDisabledOpen?: boolean;
|
118
|
+
lossDays?: number;
|
119
|
+
totalProfit?: number;
|
120
|
+
intradayOrders?: number;
|
121
|
+
isTemporaryBan?: boolean;
|
122
|
+
preNetprofit?: number;
|
123
|
+
}
|
124
|
+
interface IData {
|
125
|
+
close: number;
|
126
|
+
high: number;
|
127
|
+
low: number;
|
128
|
+
open: number;
|
129
|
+
}
|
130
|
+
interface IFillsData {
|
131
|
+
data?: IData;
|
132
|
+
tradeData?: IData;
|
133
|
+
index: number;
|
134
|
+
currentData?: IData;
|
135
|
+
}
|
136
|
+
type CloseEntriesRuleType = 'FIFO' | 'ANY';
|
137
|
+
export default class Strategy {
|
138
|
+
private _variables;
|
139
|
+
private _options;
|
140
|
+
private _totalChangeCapital;
|
141
|
+
private _historyOrder;
|
142
|
+
private _orders;
|
143
|
+
private _exitOrders;
|
144
|
+
private _pendingOrders;
|
145
|
+
private _mintick;
|
146
|
+
private _funcOptions;
|
147
|
+
private _pendingCloseOrders;
|
148
|
+
private _errorListener;
|
149
|
+
private _risk;
|
150
|
+
private _opentrades;
|
151
|
+
private _closedtrades;
|
152
|
+
private _riskNamespace;
|
153
|
+
private _updateOptions;
|
154
|
+
private _id;
|
155
|
+
private _maxDrawdownVerifyIndex;
|
156
|
+
calcOnOrderFillsData: IFillsData;
|
157
|
+
private _cacheArgs;
|
158
|
+
private _useSetArgs;
|
159
|
+
private _posOrders;
|
160
|
+
constructor(variables: BuiltInVariables, options: IKeyObjectValue, mintick: number, errorListener: TccErrorListener, id: string);
|
161
|
+
get _strategyCacheData(): IKeyObjectValue;
|
162
|
+
set _strategyCacheData(val: IKeyObjectValue);
|
163
|
+
get orders(): IOrder[];
|
164
|
+
get historyOrders(): IOrder[];
|
165
|
+
get _freezeCapital(): number;
|
166
|
+
get opentrades(): Opentrades;
|
167
|
+
get closedtrades(): Closedtrdes;
|
168
|
+
get risk(): Risk;
|
169
|
+
get isCalcOnEveryTick(): boolean | undefined;
|
170
|
+
updateOptions(options?: IStrategy): void;
|
171
|
+
update(): void;
|
172
|
+
calcCurrentOrder(): void;
|
173
|
+
updateRisk(risk: IRisk): void;
|
174
|
+
endExecution(): void;
|
175
|
+
private _maxIntradayLoss;
|
176
|
+
private _maxIntradayFilledOrdersVerify;
|
177
|
+
private _maxConsLossDaysVerify;
|
178
|
+
private _maxDrawdownVerify;
|
179
|
+
private _riskTouchOff;
|
180
|
+
strategy(args: IKeyObjectValue, posStr: string): void;
|
181
|
+
private _updateArgToOptions;
|
182
|
+
order(args: IOrderArgs, posStr: string): void;
|
183
|
+
entry(args: IOrderArgs, posStr: string): void;
|
184
|
+
close(args: IOrder, posStr: string): void;
|
185
|
+
close_all(args: IOrder, posStr: string): void;
|
186
|
+
close_all_long(args: IOrder, posStr: string): void;
|
187
|
+
close_all_short(args: IOrder, posStr: string): void;
|
188
|
+
cancel({ id }: {
|
189
|
+
id: string;
|
190
|
+
}, posStr: string): void;
|
191
|
+
cancel_all(posStr: string): void;
|
192
|
+
exit(args: IOrderArgs, posStr: string): void;
|
193
|
+
convert_to_account({ value }: IArgs, posStr: string): number | undefined;
|
194
|
+
convert_to_symbol({ value }: IArgs, posStr: string): number | undefined;
|
195
|
+
default_entry_qty({ fill_price }: IArgs, posStr: string): number;
|
196
|
+
private _calcDefaultQty;
|
197
|
+
private _calcExitQty;
|
198
|
+
private _getCommQty;
|
199
|
+
private _getLen;
|
200
|
+
private _getCapital;
|
201
|
+
private _calcProfitAndLoss;
|
202
|
+
private _calcProfitAndLossHandle;
|
203
|
+
private _calcOrderPercent;
|
204
|
+
private _calcLiquidate;
|
205
|
+
private _marginCallOrders;
|
206
|
+
private _orderHandle;
|
207
|
+
private _orderOnCloseHandle;
|
208
|
+
private _judgeCapitalEnough;
|
209
|
+
private _getOrderProfit;
|
210
|
+
private _ocaGroupVerify;
|
211
|
+
private _processOrders;
|
212
|
+
private _addPendingOrders;
|
213
|
+
private _orderArgsParse;
|
214
|
+
private _entryHandle;
|
215
|
+
private _entryOnCloseHandle;
|
216
|
+
private _getOrders;
|
217
|
+
private _entryOrder;
|
218
|
+
private _getAvailablePositionSize;
|
219
|
+
private _getEntryOrders;
|
220
|
+
private _addPendingEntry;
|
221
|
+
private _closeAllOrders;
|
222
|
+
private _closeAllPartOrders;
|
223
|
+
private _closeOrders;
|
224
|
+
private _closeOrder;
|
225
|
+
private _exitOrdersHandle;
|
226
|
+
private _executesSort;
|
227
|
+
private _getLimitPrice;
|
228
|
+
private _getStopPrice;
|
229
|
+
private _getTrailStopPrice;
|
230
|
+
private _ordersHandle;
|
231
|
+
private _calcTrailStopPrice;
|
232
|
+
private _pendingOrderHandle;
|
233
|
+
private _pendingOrderSort;
|
234
|
+
private _pendingCloseOrderHandle;
|
235
|
+
private _onCloseOrderHandle;
|
236
|
+
private _entryOrderHandle;
|
237
|
+
private _orderOrderHandle;
|
238
|
+
private _getCloseOrders;
|
239
|
+
private _closeOrderHandle;
|
240
|
+
private _processCloseOrders;
|
241
|
+
private _exitOrderHandle;
|
242
|
+
private _exit;
|
243
|
+
private _updateExitOrders;
|
244
|
+
private _calcExitOrderQty;
|
245
|
+
private _ordersToExit;
|
246
|
+
private _addExitPendingCloseOrders;
|
247
|
+
private _stopProfit;
|
248
|
+
private _stopLoss;
|
249
|
+
private _trailStopLoss;
|
250
|
+
private _processExitOnClose;
|
251
|
+
private _processExitOrders;
|
252
|
+
private _processOrder;
|
253
|
+
private _calcPercent;
|
254
|
+
private _getCommission;
|
255
|
+
private _calcCurrentOrder;
|
256
|
+
private _calcOrderFillsHandle;
|
257
|
+
private _isNaN;
|
258
|
+
private _paramVerfiy;
|
259
|
+
_verfiyRequestFunc(posStr: string, name: string): void;
|
260
|
+
}
|
261
|
+
export {};
|