@guihz/trading-vue-editor-tes 0.0.9 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ interface IProps {
7
7
  height?: string | number;
8
8
  width?: string | number;
9
9
  theme?: Theme;
10
+ readOnly?: boolean;
10
11
  options?: editor.IStandaloneEditorConstructionOptions;
11
12
  hasDiff?: boolean;
12
13
  onCursorPositionChange?: (position: IPosition) => void;
@@ -17,6 +18,10 @@ export interface IRefs {
17
18
  saveScript: () => void;
18
19
  gotoLine: () => void;
19
20
  setScript: (code: string) => void;
21
+ getEditorLayout: () => undefined | {
22
+ contentHeight: number;
23
+ lineCount: number | undefined;
24
+ };
20
25
  }
21
26
  declare const TradingEditorComponent: import("react").ForwardRefExoticComponent<IProps & import("react").RefAttributes<IRefs>>;
22
27
  export default TradingEditorComponent;
@@ -14,7 +14,9 @@ import BuildInLine, { ILineArgs, Line } from "./line";
14
14
  import BuildInLinefill, { TLinefill, Linefill } from "./linefill";
15
15
  import BuildInBox, { IBoxArgs, Box } from "./box";
16
16
  import BuildInTable, { ITableArgs, Table } from "./table";
17
+ import { Log } from './log';
18
+ import { Runtime } from './runtime';
17
19
  export { TccErrorListener } from './errorListener';
18
20
  export type { IColorArgs } from './color';
19
- export { BuildInArray, BuildInMath, BuildInTa, BuildInInput, BuildInColor, BuildInMatrix, ChartPoint, Point, BuildInTimeframe, BuildInStr, BuildInMap, PseudoArray, VInputType, BuildInLabel, BuildInPolyline, BuildInLine, Label, Polyline, Line, BuildInLinefill, Linefill, BuildInBox, Box, BuildInTable, Table };
21
+ export { BuildInArray, BuildInMath, BuildInTa, BuildInInput, BuildInColor, BuildInMatrix, ChartPoint, Point, BuildInTimeframe, BuildInStr, BuildInMap, PseudoArray, VInputType, BuildInLabel, BuildInPolyline, BuildInLine, Label, Polyline, Line, BuildInLinefill, Linefill, BuildInBox, Box, BuildInTable, Table, Log, Runtime };
20
22
  export type { PartialLabelArgs, IPolyline, ILineArgs, TLinefill, IBoxArgs, ITableArgs };
@@ -0,0 +1,24 @@
1
+ import { BuiltInVariables } from "../buildInVariables";
2
+ interface ILogArgs {
3
+ message?: string;
4
+ formatString?: string;
5
+ }
6
+ interface ILog {
7
+ message: string;
8
+ time: number;
9
+ barIndex: number;
10
+ type: LogType;
11
+ }
12
+ type LogType = 'error' | 'info' | 'warning';
13
+ export declare class Log {
14
+ private _logs;
15
+ private _variables;
16
+ constructor(variables: BuiltInVariables);
17
+ get logs(): ILog[];
18
+ clearLogs(): void;
19
+ info(args: ILogArgs, replaces: (string | number)[]): void;
20
+ error(args: ILogArgs, replaces: (string | number)[]): void;
21
+ warning(args: ILogArgs, replaces: (string | number)[]): void;
22
+ private _addLog;
23
+ }
24
+ export {};
@@ -0,0 +1,10 @@
1
+ import { TccErrorListener } from "./index";
2
+ interface IRuntimeArgs {
3
+ message: string;
4
+ }
5
+ export declare class Runtime {
6
+ private _errorListener;
7
+ constructor(errorListener: TccErrorListener);
8
+ error({ message }: IRuntimeArgs, posStr: string): void;
9
+ }
10
+ export {};
@@ -0,0 +1,109 @@
1
+ import { BuiltInVariables } from "../buildInVariables";
2
+ import { VCommission, VDirection, VFormatType, VOca, VScale, VStrategy } from "../enum";
3
+ 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
+ }
36
+ interface IOrderArgs {
37
+ id: string;
38
+ direction: VDirection;
39
+ from_entry?: string;
40
+ qty?: number;
41
+ limit?: number;
42
+ loss?: number;
43
+ stop?: number;
44
+ oca_name?: string;
45
+ oca_type?: VOca;
46
+ comment?: string;
47
+ alert_message?: string;
48
+ disable_alert?: false;
49
+ qty_percent?: number;
50
+ immediately?: boolean;
51
+ trail_price?: number;
52
+ trail_points?: number;
53
+ trail_offset?: number;
54
+ profit?: number;
55
+ }
56
+ type CloseEntriesRuleType = 'FIFO' | 'ANY';
57
+ export default class Strategy {
58
+ private _variables;
59
+ private _options;
60
+ private _totalChangeCapital;
61
+ private _historyOrder;
62
+ private _orders;
63
+ private _pendingOrders;
64
+ private _mintick;
65
+ constructor(variables: BuiltInVariables, mintick?: number);
66
+ get options(): {
67
+ title?: string | undefined;
68
+ shorttitle?: string | undefined;
69
+ overlay?: boolean | undefined;
70
+ format?: VFormatType | undefined;
71
+ precision?: number | undefined;
72
+ scale?: VScale | undefined;
73
+ pyramiding?: number | undefined;
74
+ calc_on_order_fills?: boolean | undefined;
75
+ calc_on_every_tick?: boolean | undefined;
76
+ max_bars_back?: number | undefined;
77
+ backtest_fill_limits_assumption?: number | undefined;
78
+ default_qty_type?: VStrategy | undefined;
79
+ default_qty_value?: number | undefined;
80
+ initial_capital: number;
81
+ currency?: string | undefined;
82
+ slippage?: number | undefined;
83
+ commission_type?: VCommission | undefined;
84
+ commission_value?: number | undefined;
85
+ process_orders_on_close?: boolean | undefined;
86
+ close_entries_rule?: CloseEntriesRuleType | undefined;
87
+ margin_long?: number | undefined;
88
+ margin_short?: number | undefined;
89
+ explicit_plot_zorder?: boolean | undefined;
90
+ max_lines_count?: number | undefined;
91
+ max_labels_count?: number | undefined;
92
+ max_boxes_count?: number | undefined;
93
+ calc_bars_count?: number | undefined;
94
+ risk_free_rate?: number | undefined;
95
+ use_bar_magnifier?: boolean | undefined;
96
+ fill_orders_on_standard_ohlc?: boolean | undefined;
97
+ max_polylines_count?: number | undefined;
98
+ };
99
+ updateOptions(options: IStrategy): void;
100
+ strategy(args: IStrategy): void;
101
+ order(args: IOrderArgs): void;
102
+ private _longOrderHandle;
103
+ private _shortOrderHandle;
104
+ private _closeOrderHandle;
105
+ private _exitOrderHandle;
106
+ private _exit;
107
+ private _isNaN;
108
+ }
109
+ export {};
@@ -57,3 +57,17 @@ export declare const ONLY_STATEMENTS: string[];
57
57
  export declare const GLOBAL_FUNCS: string[];
58
58
  export declare const NAMESPACE_CALL_SELF_FUNCS: string[];
59
59
  export declare const SOURCE_TYPE_BUILTIN: string[];
60
+ export declare const READY_ONLY_OPTIONS: {
61
+ domReadOnly: boolean;
62
+ scrollBeyondLastLine: boolean;
63
+ readOnly: boolean;
64
+ minimap: {
65
+ enabled: boolean;
66
+ };
67
+ scrollbar: {
68
+ vertical: string;
69
+ horizontal: string;
70
+ alwaysConsumeMouseWheel: boolean;
71
+ };
72
+ contextmenu: boolean;
73
+ };
@@ -1,7 +1,6 @@
1
1
  import { IKeyObjectValue } from "../type";
2
2
  export declare class WorkerStorage {
3
3
  private _cache;
4
- private _data;
5
4
  constructor();
6
5
  set(key: string, value: IKeyObjectValue): void;
7
6
  setValue(mapKey: string, valKey: string, value: IKeyObjectValue): void;
@@ -10,7 +9,4 @@ export declare class WorkerStorage {
10
9
  has(key: string): boolean;
11
10
  delete(key: string): void;
12
11
  clear(): void;
13
- setData(data: IKeyObjectValue[]): void;
14
- updateData(data: IKeyObjectValue[]): void;
15
- getData(startIndex?: number, endIndex?: number): IKeyObjectValue[];
16
12
  }
@@ -11,6 +11,10 @@ export default class InitEditor {
11
11
  removeDiffDecorations(): void;
12
12
  setValue(val: string): void;
13
13
  saveScripts(): void;
14
+ getEditorLayout(): {
15
+ contentHeight: number;
16
+ lineCount: number | undefined;
17
+ };
14
18
  private _init;
15
19
  private _setCursorPosition;
16
20
  private _register;