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

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ import { Theme } from '@monaco-editor/react';
2
+ import { FC } from 'react';
3
+ interface IProps {
4
+ height?: string | number;
5
+ width?: string | number;
6
+ theme?: Theme;
7
+ modified?: string;
8
+ original?: string;
9
+ renderSideBySide?: boolean;
10
+ }
11
+ declare const TradingDiffEditor: FC<IProps>;
12
+ export default TradingDiffEditor;
@@ -14,9 +14,10 @@ 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 Strategy from './strategy';
17
18
  import { Log } from './log';
18
19
  import { Runtime } from './runtime';
19
20
  export { TccErrorListener } from './errorListener';
20
21
  export type { IColorArgs } from './color';
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 };
22
+ 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, Strategy };
22
23
  export type { PartialLabelArgs, IPolyline, ILineArgs, TLinefill, IBoxArgs, ITableArgs };
@@ -1,3 +1,4 @@
1
+ import { IKeyObjectValue } from "../../type";
1
2
  import { BuiltInVariables } from "../buildInVariables";
2
3
  import { VCommission, VDirection, VFormatType, VOca, VScale, VStrategy } from "../enum";
3
4
  interface IStrategy {
@@ -53,54 +54,65 @@ interface IOrderArgs {
53
54
  trail_offset?: number;
54
55
  profit?: number;
55
56
  }
57
+ type PlaceOrderType = 'order' | 'entry' | 'exit' | 'close' | 'close_all';
58
+ interface IOrder extends IOrderArgs {
59
+ isMarketPrice?: boolean;
60
+ in_price: number;
61
+ out_price?: number;
62
+ in_time?: number;
63
+ out_time?: number;
64
+ out_comment?: string;
65
+ total_profit?: number;
66
+ max_profit?: number;
67
+ trading_loss?: number;
68
+ place_order_type?: PlaceOrderType;
69
+ isDeal?: boolean;
70
+ hasExit?: boolean;
71
+ active_price?: number;
72
+ trail_stop_price?: number;
73
+ hasOrder?: boolean;
74
+ isMarketPriceLimit?: boolean;
75
+ isMarketPriceStop?: boolean;
76
+ isCancel?: boolean;
77
+ }
56
78
  type CloseEntriesRuleType = 'FIFO' | 'ANY';
57
79
  export default class Strategy {
58
80
  private _variables;
59
81
  private _options;
60
82
  private _totalChangeCapital;
83
+ private _freezeCapital;
61
84
  private _historyOrder;
62
85
  private _orders;
63
86
  private _pendingOrders;
64
87
  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
- };
88
+ private _funcOptions;
89
+ constructor(variables: BuiltInVariables, options: IKeyObjectValue, mintick?: number);
99
90
  updateOptions(options: IStrategy): void;
100
91
  strategy(args: IStrategy): void;
92
+ private _calcDefaultQty;
101
93
  order(args: IOrderArgs): void;
102
- private _longOrderHandle;
103
- private _shortOrderHandle;
94
+ private _orderHandle;
95
+ private _ocaGroupVerify;
96
+ private _processOrders;
97
+ private _addPendingOrders;
98
+ private _orderArgsParse;
99
+ entry(args: IOrderArgs): void;
100
+ private _entryHandle;
101
+ private _entryOrder;
102
+ private _getEntryOrders;
103
+ private _addPendingEntry;
104
+ close(args: IOrder): void;
105
+ close_all(args: IOrder): void;
106
+ private _closeAllOrders;
107
+ private _closeOrders;
108
+ cancel({ id }: {
109
+ id: string;
110
+ }): void;
111
+ cancel_all(): void;
112
+ exit(args: IOrderArgs): void;
113
+ private _pendingOrderHandle;
114
+ private _entryOrderHandle;
115
+ private _orderOrderHandle;
104
116
  private _closeOrderHandle;
105
117
  private _exitOrderHandle;
106
118
  private _exit;
@@ -1,4 +1,5 @@
1
1
  export { default as TradingVueEditor } from '../components/editor/index';
2
+ export { default as TradingVueDiffEditor } from '../components/diffEditor/index';
2
3
  export type { IRefs as IEditorRefs } from '../components/editor/index';
3
4
  export { parseTcc, scriptsRun } from '../components/editor/utils/parserTcc';
4
5
  export type { IError, IPosition } from '../components/editor/parseScript/type';