Table of Contents

Interface IPlatformModuleContext

Namespace
ATAS.Indicators.Modules
Assembly
ATAS.Indicators.dll

Read-only view of the panel (%ATAS) or widget (%ATAS X) a PlatformModule is shown in: the selected instrument and its latest market data, the size of the client area and the drawing resources of the platform theme. Available through Context from OnInitialize() on.

Not in ATAS 8.0.15 yet: available from the next version.

public interface IPlatformModuleContext
Extension Methods

Remarks

The market data members return the state as of the last data delivered to the module: they agree with the callbacks the module has already received, and they do not change while one of its methods runs.

Properties

AdditionalInstruments

The instruments the module added with AddInstrument(string, string?, bool), in the order they were added. Empty for a new module instance: a module that keeps its instruments in its settings adds them again in PlatformModule.OnInitialize.

IReadOnlyList<IPlatformModuleInstrument> AdditionalInstruments { get; }

Property Value

IReadOnlyList<IPlatformModuleInstrument>

BackgroundColor

Background color of the platform theme.

Color BackgroundColor { get; }

Property Value

Color

BestAsk

Best ask (price and volume) of Instrument, or null while unknown.

MarketDataArg? BestAsk { get; }

Property Value

MarketDataArg

BestBid

Best bid (price and volume) of Instrument, or null while unknown.

MarketDataArg? BestBid { get; }

Property Value

MarketDataArg

Buttons

The buttons the module shows in the header of its panel, in order (at most MaxButtons). Add, remove or change them from the callbacks of the module at any time: the header follows. The list is empty for a new module instance; the buttons disappear when the instance is released (an error, the tariff, a reload).

IList<PlatformModuleButton> Buttons { get; }

Property Value

IList<PlatformModuleButton>

Font

Regular font of the platform for texts drawn by the module.

RenderFont Font { get; }

Property Value

RenderFont

HiddenStandardButtons

The standard buttons of the panel header the module hides. Nothing is hidden for a new module instance. See PlatformModuleStandardButtons for what each platform honours.

PlatformModuleStandardButtons HiddenStandardButtons { get; set; }

Property Value

PlatformModuleStandardButtons

Instrument

The instrument selected in the panel, or null while none is selected. TimeZone / TimeZoneOffset are the time zone set for the instrument in the platform, as chart indicators of the instrument get them (read when the instrument is selected).

IInstrumentInfo? Instrument { get; }

Property Value

IInstrumentInfo

LastTrade

The last trade of Instrument delivered to the module, or null while there was none.

MarketDataArg? LastTrade { get; }

Property Value

MarketDataArg

MaxAdditionalInstruments

The largest number of AdditionalInstruments of one module.

int MaxAdditionalInstruments { get; }

Property Value

int

MaxButtons

The largest number of Buttons; adding more throws System.InvalidOperationException.

int MaxButtons { get; }

Property Value

int

Size

Size of the client area of the module in pixels (the bounds passed to PlatformModule.OnRender).

Size Size { get; }

Property Value

Size

Summary

The exchange statistics of Instrument (day open/high/low, volume, previous close, …), or null while the data feed has not reported them.

InstrumentDailySummary? Summary { get; }

Property Value

InstrumentDailySummary

TextColor

Text color of the platform theme.

Color TextColor { get; }

Property Value

Color

Methods

AddInstrument(string, string?, bool)

Asks for the market data of an instrument other than the selected one: its trades, best bid/ask and exchange statistics (and its order book when withDepth is set) are then delivered to the overloads of the data callbacks of PlatformModule that take the instrument. The subscription follows the rules of the platform (data permissions, market replay, the tariff): see State.

IPlatformModuleInstrument? AddInstrument(string codeOrId, string? exchange = null, bool withDepth = false)

Parameters

codeOrId string

Either the identifier of the instrument (Id of a search result or Id saved earlier) - it names exactly one instrument; or the code of the instrument as Instrument shows it (for example "ESZ6", "BTCUSDT"), or code@exchange. When several instruments have the code (the same contract of a real-time and of a delayed data source), the one of the same kind as the selected instrument is taken, otherwise the real-time one.

exchange string

The exchange (its code, or its name as Exchange shows it) when the code is used by several exchanges. Ignored with an identifier.

withDepth bool

True to receive the order book of the instrument as well.

Returns

IPlatformModuleInstrument

The instrument (the same object when it is added again), or null when the platform knows no such instrument right now (its data source may not be connected yet: ask again later, for example from PlatformModule.OnTimer) or the module already has MaxAdditionalInstruments of them.

FindInstruments(string, int)

Searches the instruments the platform knows (those of the connected data sources) by a part of the code or the name, best matches first (at most 100). Pass Id of a result to AddInstrument(string, string?, bool).

IReadOnlyList<PlatformModuleInstrumentInfo> FindInstruments(string text, int maxCount = 20)

Parameters

text string
maxCount int

Returns

IReadOnlyList<PlatformModuleInstrumentInfo>

FormatPrice(decimal)

Formats a price with the number of decimals of the instrument tick size.

string FormatPrice(decimal price)

Parameters

price decimal

Returns

string

GetDepth(bool)

The bid (isAsk = false) or ask levels of the order book of Instrument, best first: the book taken when the instrument was delivered to the module plus the changes delivered since (copies). Empty while no instrument is selected or the feed provides no order book.

IReadOnlyList<MarketDataArg> GetDepth(bool isAsk)

Parameters

isAsk bool

Returns

IReadOnlyList<MarketDataArg>

Redraw()

Asks the platform to draw a new frame (calls are merged; the frame is drawn shortly afterwards).

void Redraw()

RemoveInstrument(IPlatformModuleInstrument)

Stops the data of an instrument added with AddInstrument(string, string?, bool). False if it was not added.

bool RemoveInstrument(IPlatformModuleInstrument instrument)

Parameters

instrument IPlatformModuleInstrument

Returns

bool