Base class of a custom module written in a custom assembly: a panel of the classic ATAS and a widget of ATAS X whose whole client area the module draws through RenderContext — one code base for both platforms. Derive from it, mark the class with PlatformModuleAttribute, give it a public parameterless constructor and override OnRender; the other hooks are optional.
More...
|
| void | Redraw () |
| | Asks the platform to draw a new frame; calls are merged. Does nothing before OnInitialize.
|
| |
| virtual void | OnInitialize () |
| | Called when the module is attached to its panel (once per instance), after its saved settings were restored. Context is available from here on.
|
| |
| virtual void | OnSettingsChanged () |
| | Called after the module settings changed (and once after OnInitialize).
|
| |
| virtual void | OnInstrumentChanged () |
| | Called after the panel switched to another instrument (or lost it: IPlatformModuleContext.Instrument is then null), and once after OnSettingsChanged when an instrument is selected. Reset the accumulated data here; the data callbacks that follow belong to the new instrument.
|
| |
| virtual void | OnNewTrades (IReadOnlyList< MarketDataArg > trades) |
| | New trades of the instrument, oldest first. Do not keep the list: it belongs to this call.
|
| |
| virtual void | OnBestBidAskChanged (MarketDataArg bestPrice) |
| | The best bid or the best ask changed (MarketDataArg.DataType tells which). The latest value is delivered: changes that happen faster than the platform delivers them are merged.
|
| |
| virtual void | OnMarketDepthChanged (IReadOnlyList< MarketDataArg > levels) |
| | Changed order book levels (MarketDataArg.DataType is MarketDataType.Bid or MarketDataType.Ask; a zero volume removes the level). The first call after OnInstrumentChanged carries the whole book of the new instrument. The book as of the delivered changes is available through IPlatformModuleContext.GetDepth. Do not keep the list: it belongs to this call.
|
| |
| virtual void | OnSummaryChanged (InstrumentDailySummary summary) |
| | The exchange statistics of the instrument (day open/high/low, volume, previous close, …) changed. The latest value is delivered: changes that happen faster than the platform delivers them are merged.
|
| |
| virtual void | OnInstrumentStateChanged (IPlatformModuleInstrument instrument) |
| | The state of an additional instrument (IPlatformModuleContext.AddInstrument) changed: the platform subscribed to its data, stopped delivering it, or delivers it again. When the instrument becomes PlatformModuleInstrumentState.Active, its statistics and — if asked for — its whole order book follow right after this call.
|
| |
| virtual void | OnNewTrades (IPlatformModuleInstrument instrument, IReadOnlyList< MarketDataArg > trades) |
| | New trades of an additional instrument, oldest first. Do not keep the list: it belongs to this call.
|
| |
| virtual void | OnBestBidAskChanged (IPlatformModuleInstrument instrument, MarketDataArg bestPrice) |
| | The best bid or the best ask of an additional instrument changed; the latest value is delivered.
|
| |
| virtual void | OnMarketDepthChanged (IPlatformModuleInstrument instrument, IReadOnlyList< MarketDataArg > levels) |
| | Changed order book levels of an additional instrument added with the order book (a zero volume removes the level). The first call after the instrument became active carries its whole book. Do not keep the list.
|
| |
| virtual void | OnSummaryChanged (IPlatformModuleInstrument instrument, InstrumentDailySummary summary) |
| | The exchange statistics of an additional instrument changed; the latest value is delivered.
|
| |
| virtual void | OnButtonClick (PlatformModuleButton button) |
| | The user clicked a button of IPlatformModuleContext.Buttons. For a toggle (PlatformModuleButton.IsCheckable) the platform has already flipped PlatformModuleButton.IsChecked. The default implementation calls PlatformModuleButton.Click.
|
| |
| virtual void | OnTimer () |
| | Called about ten times per second while the panel is open (also while it is hidden behind another tab).
|
| |
| virtual void | OnSizeChanged (Size size) |
| | The client area of the module changed its size (also called before the first OnRender).
|
| |
| abstract void | OnRender (RenderContext context, Rectangle bounds) |
| | Draws the module. bounds is the whole client area; the platform has filled it with IPlatformModuleContext.BackgroundColor. Called for every frame — keep it cheap: compute in the data callbacks and the timer, draw here.
|
| |
| virtual void | OnMouseMove (RenderControlMouseEventArgs e) |
| | The mouse moved over the module. Coordinates are relative to the client area.
|
| |
| virtual void | OnMouseDown (RenderControlMouseEventArgs e) |
| | A mouse button was pressed over the module.
|
| |
| virtual void | OnMouseUp (RenderControlMouseEventArgs e) |
| | A mouse button was released over the module.
|
| |
| virtual void | OnMouseClick (RenderControlMouseEventArgs e) |
| | The user clicked the module. Set RenderControlMouseEventArgs.Handled to suppress the panel context menu of a right click.
|
| |
| virtual void | OnMouseWheel (RenderControlMouseEventArgs e) |
| | The mouse wheel was turned over the module (RenderControlMouseEventArgs.Delta).
|
| |
| virtual void | OnMouseLeave () |
| | The mouse left the module.
|
| |
| virtual void | OnKeyDown (PlatformModuleKeyEventArgs e) |
| | A key was pressed while the module has the keyboard focus (the user clicked it).
|
| |
| virtual void | OnKeyUp (PlatformModuleKeyEventArgs e) |
| | A key was released while the module has the keyboard focus.
|
| |
| virtual void | OnDispose () |
| | The platform stops using this instance: the panel was closed (also when the workspace is switched or the platform exits), the module was stopped by an error, the tariff no longer allows custom modules, its settings were replaced as a whole, or the assembly was reloaded. Called exactly once for every instance whose constructor completed, even if OnInitialize was not reached or threw. Release what the module created (timers, files, subscriptions to your own services, native resources) here; no other method is called afterwards. An exception thrown here is logged and ignored.
|
| |
Base class of a custom module written in a custom assembly: a panel of the classic ATAS and a widget of ATAS X whose whole client area the module draws through RenderContext — one code base for both platforms. Derive from it, mark the class with PlatformModuleAttribute, give it a public parameterless constructor and override OnRender; the other hooks are optional.
The platform never calls one module instance concurrently: data callbacks, the timer, input and the drawing are serialized, so the module needs no locks for its own fields. Data callbacks are delivered on a platform thread shortly after the data arrives (in arrival order), never on the thread of the data feed. Drawing and input are called on the thread of the panel.
Public read/write properties are the module settings: they are shown in the settings window of the panel (use [Display] for names, groups and order, [Browsable(false)] to hide one) and saved with the workspace. OnSettingsChanged is called after the user changed them.
A module reads market data and draws; it has no access to orders, accounts or positions.
If an override throws, the platform logs the exception, releases the instance (OnDispose) and shows the error in the panel; clicking the panel, opening its settings or loading the workspace again starts a new instance with the saved settings.