@guihz/trading-vue-editor-tes 0.0.301 → 0.1.1

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.
Files changed (167) hide show
  1. package/lib/assets/editor.worker-BxEYBjj-.js +7352 -0
  2. package/lib/assets/parserTccWorker-D5cq4N-Y.js +80540 -0
  3. package/lib/assets/scriptsRunWorker-CaEvEpNA.js +37748 -0
  4. package/lib/components/diffEditor/index.d.ts +1 -0
  5. package/lib/components/editor/config/monarchTokens.d.ts +2 -4
  6. package/lib/components/editor/constants/common.d.ts +38 -0
  7. package/lib/components/editor/constants/locals.d.ts +1 -0
  8. package/lib/components/editor/index.d.ts +1 -0
  9. package/lib/components/editor/tokenizer/utils.d.ts +0 -16
  10. package/lib/components/editor/type/index.d.ts +32 -1
  11. package/lib/components/editor/utils/completions.d.ts +3 -1
  12. package/lib/components/editor/utils/importLibrary.d.ts +2 -160
  13. package/lib/components/editor/utils/initEditor.d.ts +3 -0
  14. package/lib/components/editor/utils/parse.d.ts +2 -0
  15. package/lib/components/editor/utils/parserTccWorker.d.ts +1 -7
  16. package/lib/components/editor/utils/scriptsRunWorker.d.ts +1 -1
  17. package/lib/components/editor/utils/signatureHelp.d.ts +2 -0
  18. package/lib/components/editor/utils/tools.d.ts +6 -0
  19. package/lib/components/editor/v3/config/monarchTokens.d.ts +3 -0
  20. package/lib/components/editor/v3/constants/contents_zh.d.ts +6 -0
  21. package/lib/components/editor/{constants/contents.d.ts → v3/constants/index.d.ts} +1 -5
  22. package/lib/components/editor/v3/parseScript/buildInConstants.d.ts +179 -0
  23. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/index.d.ts +9 -0
  24. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/input.d.ts +43 -0
  25. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/math.d.ts +50 -0
  26. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/strategy.d.ts +243 -0
  27. package/lib/components/editor/v3/parseScript/buildInFuncNamespace/ta.d.ts +102 -0
  28. package/lib/components/editor/{parseScript → v3/parseScript}/buildInFuncNamespace/timeframe.d.ts +1 -1
  29. package/lib/components/editor/v3/parseScript/buildInVarNamespace/barstate.d.ts +19 -0
  30. package/lib/components/editor/v3/parseScript/buildInVarNamespace/index.d.ts +4 -0
  31. package/lib/components/editor/v3/parseScript/buildInVarNamespace/strategy.d.ts +126 -0
  32. package/lib/components/editor/v3/parseScript/buildInVarNamespace/syminfo.d.ts +22 -0
  33. package/lib/components/editor/v3/parseScript/buildInVarNamespace/ta.d.ts +17 -0
  34. package/lib/components/editor/v3/parseScript/buildInVariables.d.ts +96 -0
  35. package/lib/components/editor/v3/parseScript/constants.d.ts +119 -0
  36. package/lib/components/editor/v3/parseScript/enum.d.ts +283 -0
  37. package/lib/components/editor/v3/parseScript/parseToJs.d.ts +65 -0
  38. package/lib/components/editor/v3/parseScript/runType.d.ts +119 -0
  39. package/lib/components/editor/v3/parseScript/strategyNamespace/index.d.ts +2 -0
  40. package/lib/components/editor/{parseScript → v3/parseScript}/type.d.ts +1 -1
  41. package/lib/components/editor/v3/parseScript/utils.d.ts +21 -0
  42. package/lib/components/editor/v3/parseScript/visitorParser.d.ts +321 -0
  43. package/lib/components/editor/v3/parseScript/visitorUtils.d.ts +25 -0
  44. package/lib/components/editor/v3/parserTccWorker.d.ts +32 -0
  45. package/lib/components/editor/v3/scriptsRunWorker.d.ts +11 -0
  46. package/lib/{tccParser → components/editor/v3/tccParser}/LexerBase.d.ts +1 -1
  47. package/lib/components/editor/v3/tccParser/tccScriptParserVisitor.d.ts +359 -0
  48. package/lib/components/editor/v4/config/monarchTokens.d.ts +205 -0
  49. package/lib/components/editor/v4/constants/contents_zh.d.ts +6 -0
  50. package/lib/components/editor/v4/constants/index.d.ts +44 -0
  51. package/lib/components/editor/v4/parseScript/buildInConstants.d.ts +308 -0
  52. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/array.d.ts +84 -0
  53. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/box.d.ts +60 -0
  54. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/errorListener.d.ts +9 -0
  55. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/index.d.ts +17 -0
  56. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/input.d.ts +44 -0
  57. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/label.d.ts +61 -0
  58. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/line.d.ts +62 -0
  59. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/math.d.ts +50 -0
  60. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/strategy.d.ts +244 -0
  61. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/string.d.ts +38 -0
  62. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/ta.d.ts +118 -0
  63. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/table.d.ts +87 -0
  64. package/lib/components/editor/v4/parseScript/buildInFuncNamespace/timeframe.d.ts +22 -0
  65. package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/barstate.d.ts +1 -1
  66. package/lib/components/editor/v4/parseScript/buildInVarNamespace/index.d.ts +8 -0
  67. package/lib/components/editor/v4/parseScript/buildInVarNamespace/strategy.d.ts +126 -0
  68. package/lib/components/editor/v4/parseScript/buildInVarNamespace/syminfo.d.ts +18 -0
  69. package/lib/components/editor/v4/parseScript/buildInVarNamespace/ta.d.ts +34 -0
  70. package/lib/components/editor/{parseScript → v4/parseScript}/constants.d.ts +1 -160
  71. package/lib/components/editor/v4/parseScript/constantsRun.d.ts +3 -0
  72. package/lib/components/editor/v4/parseScript/enum.d.ts +282 -0
  73. package/lib/components/editor/v4/parseScript/parseToJs.d.ts +65 -0
  74. package/lib/components/editor/v4/parseScript/strategyNamespace/index.d.ts +2 -0
  75. package/lib/components/editor/v4/parseScript/strategyNamespace/risk.d.ts +22 -0
  76. package/lib/components/editor/v4/parseScript/type.d.ts +39 -0
  77. package/lib/components/editor/v4/parseScript/utils.d.ts +21 -0
  78. package/lib/components/editor/v4/parseScript/visitorParser.d.ts +323 -0
  79. package/lib/components/editor/v4/parseScript/visitorUtils.d.ts +29 -0
  80. package/lib/components/editor/v4/parserTccWorker.d.ts +32 -0
  81. package/lib/components/editor/v4/scriptsRunWorker.d.ts +11 -0
  82. package/lib/components/editor/v4/tccParser/LexerBase.d.ts +19 -0
  83. package/lib/components/editor/v4/tccParser/tccScriptParserVisitor.d.ts +401 -0
  84. package/lib/components/editor/v5/config/monarchTokens.d.ts +205 -0
  85. package/lib/components/editor/v5/constants/contents_en.d.ts +6 -0
  86. package/lib/components/editor/{constants → v5/constants}/contents_zh.d.ts +1 -1
  87. package/lib/components/editor/v5/constants/index.d.ts +41 -0
  88. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/box.d.ts +1 -1
  89. package/lib/components/editor/v5/parseScript/buildInFuncNamespace/color.d.ts +25 -0
  90. package/lib/components/editor/v5/parseScript/buildInFuncNamespace/errorListener.d.ts +9 -0
  91. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/label.d.ts +1 -1
  92. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/line.d.ts +1 -1
  93. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/linefill.d.ts +1 -1
  94. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/log.d.ts +1 -1
  95. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/map.d.ts +1 -1
  96. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/math.d.ts +1 -1
  97. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/polyline.d.ts +1 -1
  98. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/strategy.d.ts +1 -1
  99. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/ta.d.ts +1 -1
  100. package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/table.d.ts +1 -1
  101. package/lib/components/editor/v5/parseScript/buildInFuncNamespace/timeframe.d.ts +22 -0
  102. package/lib/components/editor/v5/parseScript/buildInVarNamespace/barstate.d.ts +22 -0
  103. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/chart.d.ts +1 -1
  104. package/lib/components/editor/v5/parseScript/buildInVarNamespace/dividends.d.ts +8 -0
  105. package/lib/components/editor/v5/parseScript/buildInVarNamespace/earnings.d.ts +9 -0
  106. package/lib/components/editor/v5/parseScript/buildInVarNamespace/session.d.ts +12 -0
  107. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/strategy.d.ts +1 -1
  108. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/syminfo.d.ts +1 -1
  109. package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/ta.d.ts +4 -3
  110. package/lib/components/editor/v5/parseScript/buildInVarNamespace/timeframe.d.ts +16 -0
  111. package/lib/components/editor/v5/parseScript/constants.d.ts +124 -0
  112. package/lib/components/editor/v5/parseScript/constantsRun.d.ts +3 -0
  113. package/lib/components/editor/{parseScript → v5/parseScript}/parseToJs.d.ts +1 -1
  114. package/lib/components/editor/{parseScript → v5/parseScript}/parseToLibJs.d.ts +1 -1
  115. package/lib/components/editor/v5/parseScript/strategyNamespace/risk.d.ts +22 -0
  116. package/lib/components/editor/v5/parseScript/type.d.ts +39 -0
  117. package/lib/components/editor/{parseScript → v5/parseScript}/userTypeClass.d.ts +1 -1
  118. package/lib/components/editor/{parseScript → v5/parseScript}/utils.d.ts +1 -1
  119. package/lib/components/editor/{parseScript → v5/parseScript}/visitorParser.d.ts +1 -1
  120. package/lib/components/editor/{parseScript → v5/parseScript}/visitorUtils.d.ts +2 -2
  121. package/lib/components/editor/v5/parserTccWorker.d.ts +40 -0
  122. package/lib/components/editor/v5/scriptsRunWorker.d.ts +11 -0
  123. package/lib/components/editor/v5/tccParser/LexerBase.d.ts +19 -0
  124. package/lib/{tccParser → components/editor/v5/tccParser}/tccScriptParserVisitor.d.ts +1 -1
  125. package/lib/components/referenceManual/components/ContentItem.d.ts +2 -0
  126. package/lib/components/referenceManual/index.d.ts +2 -0
  127. package/lib/components/referenceManualPage/components/ContentItem.d.ts +1 -0
  128. package/lib/components/referenceManualPage/components/ManualLeft.d.ts +5 -0
  129. package/lib/components/referenceManualPage/index.d.ts +2 -0
  130. package/lib/index-Ce2gRdFk.js +12813 -0
  131. package/lib/index-CjECfhIW.js +28088 -0
  132. package/lib/index-UdtfRBFV.js +59792 -0
  133. package/lib/monarchTokens-Cj3v8l0Q.js +526 -0
  134. package/lib/monarchTokens-CnFYyHnR.js +191 -0
  135. package/lib/monarchTokens-oh3fO2YY.js +563 -0
  136. package/lib/packages/index.d.ts +3 -3
  137. package/lib/trading-vue-editor.es.packages.js +6356 -66629
  138. package/lib/trading-vue-editor.umd.packages.mjs +117 -75
  139. package/lib/utils/tools.d.ts +7 -2
  140. package/package.json +1 -1
  141. package/lib/assets/editor.worker-CT5Cb1wO.js +0 -11
  142. package/lib/assets/parserTccWorker-cjv11J0f.js +0 -279
  143. package/lib/assets/scriptsRunWorker-C5pVAsLn.js +0 -91
  144. /package/lib/components/editor/{parseScript → v3/parseScript}/buildInFuncNamespace/errorListener.d.ts +0 -0
  145. /package/lib/components/editor/{parseScript → v3/parseScript}/constantsRun.d.ts +0 -0
  146. /package/lib/components/editor/{parseScript → v3/parseScript}/strategyNamespace/risk.d.ts +0 -0
  147. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInFuncNamespace/color.d.ts +0 -0
  148. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/dividends.d.ts +0 -0
  149. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/earnings.d.ts +0 -0
  150. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/session.d.ts +0 -0
  151. /package/lib/components/editor/{parseScript → v4/parseScript}/buildInVarNamespace/timeframe.d.ts +0 -0
  152. /package/lib/components/editor/{constants → v5/constants}/newContents_en.d.ts +0 -0
  153. /package/lib/components/editor/{constants → v5/constants}/newContents_zh.d.ts +0 -0
  154. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInConstants.d.ts +0 -0
  155. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/array.d.ts +0 -0
  156. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/chartPoint.d.ts +0 -0
  157. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/index.d.ts +0 -0
  158. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/input.d.ts +0 -0
  159. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/matrix.d.ts +0 -0
  160. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/runtime.d.ts +0 -0
  161. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/string.d.ts +0 -0
  162. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInFuncNamespace/syminfo.d.ts +0 -0
  163. /package/lib/components/editor/{parseScript → v5/parseScript}/buildInVarNamespace/index.d.ts +0 -0
  164. /package/lib/components/editor/{parseScript → v5/parseScript}/enum.d.ts +0 -0
  165. /package/lib/components/editor/{parseScript → v5/parseScript}/strategyNamespace/closedtrades.d.ts +0 -0
  166. /package/lib/components/editor/{parseScript → v5/parseScript}/strategyNamespace/index.d.ts +0 -0
  167. /package/lib/components/editor/{parseScript → v5/parseScript}/strategyNamespace/opentrades.d.ts +0 -0
@@ -0,0 +1,96 @@
1
+ import { IKeyObjectValue } from "../../type";
2
+ import { Barstate, Strategy, Syminfo, Ta } from './buildInVarNamespace';
3
+ export declare class BuiltInVariables extends Ta {
4
+ private _cacheData;
5
+ private _barIndex;
6
+ _isRealTimeBar: boolean;
7
+ private _barstate;
8
+ private _priceVariables;
9
+ private _lastBarIndex;
10
+ private _currentBarTime;
11
+ private _lastBarTime;
12
+ private _period;
13
+ _offsetTime: number;
14
+ private _strategy;
15
+ private _multiplier;
16
+ private _unit;
17
+ syminfo: Syminfo;
18
+ private _timeTradingday?;
19
+ private _mintick?;
20
+ private _cacheSpace;
21
+ private _precision?;
22
+ private _nextBarTime?;
23
+ _isRepeated?: boolean;
24
+ __requestName: string;
25
+ __isFirstRun: boolean;
26
+ private _maxBarsBack;
27
+ private _maxBarsBackOfKey;
28
+ __isReqRepeated?: boolean;
29
+ current_time?: number;
30
+ constructor(id: string);
31
+ getVarCacheData(): {
32
+ cacheData: IKeyObjectValue;
33
+ cacheSpace: IKeyObjectValue;
34
+ taCacheData: IKeyObjectValue;
35
+ barstateCacheData: IKeyObjectValue;
36
+ };
37
+ setVarCacheData(data: IKeyObjectValue): void;
38
+ get bar_index(): number;
39
+ get n(): number;
40
+ get na(): undefined;
41
+ get volume(): number;
42
+ get close(): number;
43
+ get low(): number;
44
+ get open(): number;
45
+ get high(): number;
46
+ get ohlc4(): number;
47
+ get hl2(): number;
48
+ get hlc3(): number;
49
+ get hlcc4(): number;
50
+ get timenow(): number;
51
+ get time(): number;
52
+ get hour(): number;
53
+ get minute(): number;
54
+ get second(): number;
55
+ get month(): number;
56
+ get year(): number;
57
+ get dayofweek(): number;
58
+ get dayofmonth(): number;
59
+ get weekofyear(): number;
60
+ get barstate(): Barstate;
61
+ get strategy(): Strategy;
62
+ get ticker(): any;
63
+ get tickerid(): any;
64
+ get isdaily(): boolean;
65
+ get isdwm(): boolean;
66
+ get isintraday(): boolean;
67
+ get isminutes(): boolean;
68
+ get ismonthly(): boolean;
69
+ get isseconds(): boolean;
70
+ get isweekly(): boolean;
71
+ get period(): string;
72
+ get interval(): number;
73
+ get last_bar_index(): number;
74
+ get last_bar_time(): number;
75
+ get time_tradingday(): number;
76
+ get mintick(): number | undefined;
77
+ get __period(): string;
78
+ get precision(): number | undefined;
79
+ get nextBarTime(): number | undefined;
80
+ set max_bars_back(count: number);
81
+ getTimeTradingday(time: number, period: string): number;
82
+ private _getTimeTradingday;
83
+ updateOptions(options: IKeyObjectValue): void;
84
+ updateData(data: IKeyObjectValue, isRepeated?: boolean): void;
85
+ getCacheData(key: string, preIndex: number, value: any): any;
86
+ setCacheData(key: string, value: any): any;
87
+ __setBarsBackOfKey(key: string, val: number): void;
88
+ __getBarsBackOfKey(key: string): any;
89
+ private _cacheCopy;
90
+ add(val1: any, val2: any): any;
91
+ sub(val1: any, val2: any): number | any[];
92
+ div(val1: number, val2: number): number | undefined;
93
+ notEqual(val1: any, val2: any, type1: string, type2: string): boolean;
94
+ equal(val1: any, val2: any, type1: string, type2: string): boolean | undefined;
95
+ compareDataHandle(val: any): any;
96
+ }
@@ -0,0 +1,119 @@
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
+ };
97
+ export declare const WARNING_TIPS: {
98
+ repeatVar: string;
99
+ typeMismatch: string;
100
+ moreSameArg: string;
101
+ localScopeGetHistory: string;
102
+ localScopeWarning: string;
103
+ strategyCalcTickWarn: string;
104
+ conditionWarning: string;
105
+ lineWidthWarning: string;
106
+ boolVarNumWarning: string;
107
+ };
108
+ export declare const QUALIFIERS: VType[];
109
+ export declare const BASE_TYPE: VType[];
110
+ export declare const ONLY_STATEMENTS: string[];
111
+ export declare const GLOBAL_DRAW_FUNCS: string[];
112
+ export declare const GLOBAL_FUNCS: string[];
113
+ export declare const INDICATOR_NEED_DRAW_FUNCS: string[];
114
+ export declare const STRATEGY_NEED_FUNCS: string[];
115
+ export declare const NAMESPACE_CALL_SELF_FUNCS: string[];
116
+ export declare const SOURCE_TYPE_BUILTIN: string[];
117
+ export declare const COMMENTS_DESC_REG: RegExp;
118
+ export declare const JS_KEYWORDS: string[];
119
+ export declare const HAS_MEMBER_INDEX_FUNCS: string[];
@@ -0,0 +1,283 @@
1
+ export declare enum VType {
2
+ BOOL = "bool",
3
+ INT = "integer",
4
+ FLOAT = "float",
5
+ COLOR = "color",
6
+ CONST = "const",
7
+ SERIES = "series",
8
+ STRING = "string",
9
+ UNDETERMINED = "undetermined type",
10
+ INPUT = "",
11
+ NA = "na",
12
+ VOID = "void"
13
+ }
14
+ export declare enum VInsType {
15
+ TYPE = "type",
16
+ ARRAY = "array",
17
+ BOX = "box",
18
+ CHART_POINT = "chart.point",
19
+ LABEL = "label",
20
+ LINE = "line",
21
+ LINEFILL = "linefill",
22
+ MAP = "map",
23
+ MATRIX = "matrix",
24
+ POLYLINE = "polyline",
25
+ TABLE = "table"
26
+ }
27
+ export declare enum VRuleType {
28
+ FlowStmt = "FlowStmt",
29
+ DeclareAssign = "DeclareAssign",
30
+ VarBlockStmt = "VarBlockStmt",
31
+ VarSingle = "VarSingle",
32
+ VarMultiple = "VarMultiple",
33
+ ParenthesizedExpression = "ParenthesizedExpression",
34
+ AdditiveExpression = "AdditiveExpression",
35
+ RelationalExpression = "RelationalExpression",
36
+ EqualityExpression = "EqualityExpression",
37
+ TernaryExpression = "TernaryExpression",
38
+ UnaryExpression = "UnaryExpression",
39
+ NotExpression = "NotExpression",
40
+ MemberIndexExpression = "MemberIndexExpression",
41
+ MethodExpression = "MethodExpression",
42
+ LogicalAndExpression = "LogicalAndExpression",
43
+ LogicalOrExpression = "LogicalOrExpression",
44
+ MultiplicativeExpression = "MultiplicativeExpression",
45
+ Brackethesized = "Brackethesized",
46
+ IfStatement = "IfStatement",
47
+ ForToStatement = "ForToStatement",
48
+ ForInStatement = "ForInStatement",
49
+ SwitchStatement = "SwitchStatement",
50
+ CaseClause = "CaseClause",
51
+ DefaultCaluse = "DefaultCaluse",
52
+ WhileStatement = "WhileStatement",
53
+ ImportElement = "ImportElement",
54
+ Literal = "Literal",
55
+ ArrowFunction = "ArrowFunction",
56
+ ArrowMethod = "ArrowMethod",
57
+ TypeStatement = "TypeStatement",
58
+ Name = "Name",
59
+ AgainAssign = "AgainAssign",
60
+ EnumStatement = "EnumStatement"
61
+ }
62
+ export declare enum VAdjustment {
63
+ dividends = "dividends",
64
+ none = "none",
65
+ splits = "splits"
66
+ }
67
+ export declare enum VAlert {
68
+ freqAll = "freq_all",
69
+ freqOncePerBar = "freq_once_per_bar",
70
+ freqOncePerBarClose = "freq_once_per_bar_close"
71
+ }
72
+ export declare enum VBarmergeGaps {
73
+ gapsOff = "gaps_off",
74
+ gapsOn = "gaps_on",
75
+ lookaheadOff = "lookahead_off",
76
+ lookaheadOn = "lookahead_on"
77
+ }
78
+ export declare enum VPlotDisplay {
79
+ all = "all",
80
+ dataWindow = "data_window",
81
+ none = "none",
82
+ pane = "pane",
83
+ priceScale = "price_scale",
84
+ statusLine = "status_line"
85
+ }
86
+ export declare enum VExtend {
87
+ both = "both",
88
+ left = "left",
89
+ none = "none",
90
+ right = "right"
91
+ }
92
+ export declare enum VFormatType {
93
+ inherit = "inherit",
94
+ mintick = "mintick",
95
+ percent = "percent",
96
+ price = "price",
97
+ volume = "volume"
98
+ }
99
+ export declare enum VHlineStyle {
100
+ styleDashed = "style_dashed",
101
+ styleDotted = "style_dotted",
102
+ styleSolid = "style_solid"
103
+ }
104
+ export declare enum VLabelStyle {
105
+ styleArrowdown = "style_arrowdown",
106
+ styleArrowup = "style_arrowup",
107
+ styleCircle = "style_circle",
108
+ styleCross = "style_cross",
109
+ styleDiamond = "style_diamond",
110
+ styleFlag = "style_flag",
111
+ styleLabelCenter = "style_label_center",
112
+ styleLabelDown = "style_label_down",
113
+ styleLabelLeft = "style_label_left",
114
+ styleLabelLowerLeft = "style_label_lower_left",
115
+ styleLabelLowerRight = "style_label_lower_right",
116
+ styleLabelRight = "style_label_right",
117
+ styleLabelUp = "style_label_up",
118
+ styleLabelUpperLeft = "style_label_upper_left",
119
+ styleLabelUpperRight = "style_label_upper_right",
120
+ styleNone = "style_none",
121
+ styleSquare = "style_square",
122
+ styleTextOutline = "style_text_outline",
123
+ styleTriangledown = "style_triangledown",
124
+ styleTriangleup = "style_triangleup",
125
+ styleXcross = "style_xcross"
126
+ }
127
+ export declare enum VLineStyle {
128
+ styleArrowBoth = "style_arrow_both",
129
+ styleArrowLeft = "style_arrow_left",
130
+ styleArrowRight = "style_arrow_right",
131
+ styleDashed = "style_dashed",
132
+ styleDotted = "style_dotted",
133
+ styleSolid = "style_solid"
134
+ }
135
+ export declare enum VLocation {
136
+ abovebar = "abovebar",
137
+ absolute = "absolute",
138
+ belowbar = "belowbar",
139
+ bottom = "bottom",
140
+ top = "top"
141
+ }
142
+ export declare enum VSortOrder {
143
+ ascending = "ascending",// 从小到大
144
+ descending = "descending"
145
+ }
146
+ export declare enum VPlotStyle {
147
+ styleArea = "Area",
148
+ styleAreabr = "Area With Breaks",
149
+ styleCircles = "Circles",
150
+ styleColumns = "Columns",
151
+ styleCross = "Cross",
152
+ styleHistogram = "Histogram",
153
+ styleLine = "Line",
154
+ styleLinebr = "Line With Breaks",
155
+ styleStepline = "Step Line",
156
+ styleSteplineDiamond = "Step Line With Diamonds",
157
+ styleSteplinebr = "Step line with Breaks"
158
+ }
159
+ export declare enum VPosition {
160
+ bottomCenter = "bottom_center",
161
+ bottomLeft = "bottom_left",
162
+ bottomRight = "bottom_right",
163
+ middleCenter = "middle_center",
164
+ middleLeft = "middle_left",
165
+ middleRight = "middle_right",
166
+ topCenter = "top_center",
167
+ topLeft = "top_left",
168
+ topRight = "top_right"
169
+ }
170
+ export declare enum VScale {
171
+ left = "left",
172
+ none = "none",
173
+ right = "right"
174
+ }
175
+ export declare enum VSession {
176
+ extended = "extended",
177
+ regular = "regular"
178
+ }
179
+ export declare enum VShape {
180
+ arrowdown = "arrowdown",
181
+ arrowup = "arrowup",
182
+ circle = "circle",
183
+ cross = "cross",
184
+ diamond = "diamond",
185
+ flag = "flag",
186
+ labeldown = "labeldown",
187
+ labelup = "labelup",
188
+ square = "square",
189
+ triangledown = "triangledown",
190
+ triangleup = "triangleup",
191
+ xcross = "xcross"
192
+ }
193
+ export declare enum VSize {
194
+ auto = "auto",
195
+ huge = "huge",
196
+ large = "large",
197
+ normal = "normal",
198
+ small = "small",
199
+ tiny = "tiny"
200
+ }
201
+ export declare enum VFont {
202
+ familyDefault = "default",
203
+ familyMonospace = "monospace"
204
+ }
205
+ export declare enum VStrategy {
206
+ cash = "cash",
207
+ fixed = "fixed",
208
+ percentOfEquity = "percent_of_equity"
209
+ }
210
+ export declare enum VCommission {
211
+ cashPerContract = "cash_per_contract",
212
+ cashPerOrder = "cash_per_order",
213
+ percent = "percent"
214
+ }
215
+ export declare enum VDirection {
216
+ all = "all",
217
+ long = "long",
218
+ short = "short"
219
+ }
220
+ export declare enum VOca {
221
+ cancel = "cancel",
222
+ none = "none",
223
+ reduce = "reduce"
224
+ }
225
+ export declare enum VText {
226
+ alignBottom = "align_bottom",
227
+ alignCenter = "align_center",
228
+ alignLeft = "align_left",
229
+ alignRight = "align_right",
230
+ alignTop = "align_top",
231
+ wrapAuto = "wrap_auto",
232
+ wrapNone = "wrap_none"
233
+ }
234
+ export declare enum VXloc {
235
+ bar_index = "bar_index",
236
+ bar_time = "bar_time"
237
+ }
238
+ export declare enum VYloc {
239
+ abovebar = "abovebar",
240
+ belowbar = "belowbar",
241
+ price = "price"
242
+ }
243
+ export declare enum VEarnings {
244
+ actual = "actual",
245
+ estimate = "estimate",
246
+ standardized = "standardized"
247
+ }
248
+ export declare enum VPivotType {
249
+ traditional = "Traditional",
250
+ fibonacci = "Fibonacci",
251
+ woodie = "Woodie",
252
+ classic = "Classic",
253
+ dm = "DM",
254
+ camarilla = "Camarilla"
255
+ }
256
+ export declare enum VInputType {
257
+ INT = "integer",
258
+ BOOL = "bool",
259
+ TIME = "time",
260
+ COLOR = "color",
261
+ FLOAT = "float",
262
+ PRICE = "price",
263
+ SOURCE = "source",
264
+ STRING = "string",
265
+ SYMBOL = "symbol",
266
+ SESSION = "session",
267
+ RESOLUTION = "timeframe"
268
+ }
269
+ export declare enum VComments {
270
+ description = "description",
271
+ field = "field",
272
+ function = "function",
273
+ param = "param",
274
+ returns = "returns",
275
+ type = "type",
276
+ variable = "variable",
277
+ enum = "enum"
278
+ }
279
+ export declare enum VScriptType {
280
+ indicator = "indicator",
281
+ strategy = "strategy",
282
+ study = "study"
283
+ }
@@ -0,0 +1,65 @@
1
+ import { IKeyObjectValue } from "../../type";
2
+ export default class ParseToJs {
3
+ private _nameMap;
4
+ private _argChangeMap;
5
+ private _prefixNameVar;
6
+ private _prefixNameFunc;
7
+ private _prefixNameConst;
8
+ private _isInFunc;
9
+ private _currentFuncName?;
10
+ private _varlist;
11
+ private _memberIndexList;
12
+ private _blockCount;
13
+ private _inputCount;
14
+ private _count;
15
+ private _isSwitch;
16
+ private _isInIf;
17
+ private _isInLoop;
18
+ private _codesCol;
19
+ private _dependsObj;
20
+ private _preRunMembers;
21
+ private _isInConditionalStmt;
22
+ private _preRunMembersFuncs;
23
+ private _preRunMemberFuncsCount;
24
+ private __count;
25
+ preParseCode: string;
26
+ private _isExperssion;
27
+ constructor(prefix: string);
28
+ preParser(values: IKeyObjectValue[]): string | undefined;
29
+ parser(values: IKeyObjectValue[]): {
30
+ code: string;
31
+ } | undefined;
32
+ private _parserStmt;
33
+ private _parserVarBlockStmt;
34
+ private _getDepends;
35
+ private _parserForToStatement;
36
+ private _parserAgainAssign;
37
+ private _parserIfStatement;
38
+ private _parserBlockLine;
39
+ private _parserReturnBlock;
40
+ private _getMembersCode;
41
+ private _parserArrowFunction;
42
+ private _parserParameters;
43
+ private _parserBlock;
44
+ private _addVarList;
45
+ private _parserDeclareAssign;
46
+ private _parserDeclareAssignNames;
47
+ private _parserSingleExpression;
48
+ private _parserEqualityExpression;
49
+ private _parserAdditiveExpression;
50
+ private _parserMemberIndexExpression;
51
+ private _getOtherVarMemberIndexs;
52
+ private _getUserVarMemberIndexs;
53
+ private _parseLiteral;
54
+ private _colorToRgba;
55
+ private _parserName;
56
+ private _setDepend;
57
+ private _parserMethodExpression;
58
+ private _parserMethodElement;
59
+ private _parserArguments;
60
+ private _requestParamsHandle;
61
+ private _getExpressionContext;
62
+ private _getDependsCode;
63
+ private _parserBrackethesized;
64
+ private _functionalProcess;
65
+ }
@@ -0,0 +1,119 @@
1
+ import { VCommission, VFormatType, VScale, VStrategy, VDirection, VOca } from "./enum";
2
+ export type CloseEntriesRuleType = 'FIFO' | 'ANY';
3
+ export interface IStrategy {
4
+ title?: string;
5
+ shorttitle?: string;
6
+ overlay?: boolean;
7
+ format?: VFormatType;
8
+ precision?: number;
9
+ scale?: VScale;
10
+ pyramiding?: number;
11
+ calc_on_order_fills?: boolean;
12
+ calc_on_every_tick?: boolean;
13
+ max_bars_back?: number;
14
+ backtest_fill_limits_assumption?: number;
15
+ default_qty_type?: VStrategy;
16
+ default_qty_value?: number;
17
+ initial_capital: number;
18
+ currency?: string;
19
+ slippage?: number;
20
+ commission_type?: VCommission;
21
+ commission_value?: number;
22
+ process_orders_on_close?: boolean;
23
+ close_entries_rule?: CloseEntriesRuleType;
24
+ margin_long?: number;
25
+ margin_short?: number;
26
+ explicit_plot_zorder?: boolean;
27
+ max_lines_count?: number;
28
+ max_labels_count?: number;
29
+ max_boxes_count?: number;
30
+ calc_bars_count?: number;
31
+ risk_free_rate?: number;
32
+ use_bar_magnifier?: boolean;
33
+ fill_orders_on_standard_ohlc?: boolean;
34
+ max_polylines_count?: number;
35
+ scriptType?: string;
36
+ direction_short_long?: boolean;
37
+ }
38
+ export type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all' | 'close_all_short' | 'close_all_long';
39
+ export interface IOrder extends IOrderArgs {
40
+ isMarketPrice?: boolean;
41
+ out_id?: string;
42
+ in_index?: number;
43
+ out_index?: number;
44
+ in_price: number;
45
+ out_price?: number;
46
+ in_time?: number;
47
+ out_time?: number;
48
+ out_qty?: number;
49
+ out_comment?: string;
50
+ total_profit?: number;
51
+ max_profit?: number;
52
+ trading_loss?: number;
53
+ place_order_type?: PlaceOrderType;
54
+ position_close_type?: PlaceOrderType;
55
+ isDeal?: boolean;
56
+ exitIds?: string[];
57
+ active_price?: number;
58
+ trail_stop_price?: number;
59
+ hasOrder?: boolean;
60
+ isMarketPriceLimit?: boolean;
61
+ isMarketPriceStop?: boolean;
62
+ isCancel?: boolean;
63
+ close_qty?: number;
64
+ profit_percent?: number;
65
+ max_profit_percent?: number;
66
+ trading_loss_percent?: number;
67
+ commission?: number;
68
+ original_qty?: number;
69
+ in_low?: number;
70
+ in_high?: number;
71
+ out_low?: number;
72
+ out_high?: number;
73
+ isTiggerClose?: boolean;
74
+ entry_time?: number;
75
+ }
76
+ export interface IOrderArgs {
77
+ id: string;
78
+ direction: VDirection;
79
+ from_entry?: string;
80
+ qty?: number;
81
+ limit?: number;
82
+ loss?: number;
83
+ stop?: number;
84
+ oca_name?: string;
85
+ oca_type?: VOca;
86
+ comment?: string;
87
+ alert_message?: string;
88
+ disable_alert?: false;
89
+ qty_percent?: number;
90
+ immediately?: boolean;
91
+ trail_price?: number;
92
+ trail_points?: number;
93
+ trail_offset?: number;
94
+ profit?: number;
95
+ comment_profit?: string;
96
+ comment_loss?: string;
97
+ comment_trailing?: string;
98
+ last_commission?: number;
99
+ }
100
+ export interface IExitOrder extends IOrderArgs {
101
+ order: IOrder;
102
+ active_price?: number;
103
+ trail_stop_price?: number;
104
+ directionNum: number;
105
+ isClose?: boolean;
106
+ }
107
+ export interface IColorArgs {
108
+ x?: any;
109
+ color?: string;
110
+ value?: number;
111
+ bottom_value?: number;
112
+ top_value?: number;
113
+ bottom_color?: string;
114
+ top_color?: string;
115
+ transp?: number;
116
+ red?: number;
117
+ green?: number;
118
+ blue?: number;
119
+ }
@@ -0,0 +1,2 @@
1
+ import Risk from "./risk";
2
+ export { Risk };
@@ -1,4 +1,4 @@
1
- import { IKeyObjectValue } from "../type";
1
+ import { IKeyObjectValue } from "../../type";
2
2
  import { VInsType } from "./enum";
3
3
  interface IBase {
4
4
  startColumn: number;