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

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,95 @@
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
+ qty?: number;
40
+ limit?: number;
41
+ stop?: number;
42
+ oca_name?: string;
43
+ oca_type?: VOca;
44
+ comment?: string;
45
+ alert_message?: string;
46
+ disable_alert?: false;
47
+ }
48
+ type CloseEntriesRuleType = 'FIFO' | 'ANY';
49
+ export default class Strategy {
50
+ private _variables;
51
+ private _options;
52
+ private _totalChangeCapital;
53
+ private _historyOrder;
54
+ private _orders;
55
+ private _pendingOrders;
56
+ constructor(variables: BuiltInVariables);
57
+ get options(): {
58
+ title?: string | undefined;
59
+ shorttitle?: string | undefined;
60
+ overlay?: boolean | undefined;
61
+ format?: VFormatType | undefined;
62
+ precision?: number | undefined;
63
+ scale?: VScale | undefined;
64
+ pyramiding?: number | undefined;
65
+ calc_on_order_fills?: boolean | undefined;
66
+ calc_on_every_tick?: boolean | undefined;
67
+ max_bars_back?: number | undefined;
68
+ backtest_fill_limits_assumption?: number | undefined;
69
+ default_qty_type?: VStrategy | undefined;
70
+ default_qty_value?: number | undefined;
71
+ initial_capital: number;
72
+ currency?: string | undefined;
73
+ slippage?: number | undefined;
74
+ commission_type?: VCommission | undefined;
75
+ commission_value?: number | undefined;
76
+ process_orders_on_close?: boolean | undefined;
77
+ close_entries_rule?: CloseEntriesRuleType | undefined;
78
+ margin_long?: number | undefined;
79
+ margin_short?: number | undefined;
80
+ explicit_plot_zorder?: boolean | undefined;
81
+ max_lines_count?: number | undefined;
82
+ max_labels_count?: number | undefined;
83
+ max_boxes_count?: number | undefined;
84
+ calc_bars_count?: number | undefined;
85
+ risk_free_rate?: number | undefined;
86
+ use_bar_magnifier?: boolean | undefined;
87
+ fill_orders_on_standard_ohlc?: boolean | undefined;
88
+ max_polylines_count?: number | undefined;
89
+ };
90
+ updateOptions(options: IStrategy): void;
91
+ strategy(args: IStrategy): void;
92
+ order(args: IOrderArgs): void;
93
+ private _longOrderHandle;
94
+ }
95
+ 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;