Skip to main content
Version: latest

IBrokerCommon

Interface
Types Module: Broker

Methods

accountManagerInfo

This function should return the information that will be used to build an Account manager.

Signature

accountManagerInfo() => AccountManagerInfo

Returns

AccountManagerInfo


chartContextMenuActions

Chart can have a sub-menu Trading in the context menu. This method should return an array of ActionMetaInfo elements, each of them representing one context menu item.

Signature

chartContextMenuActions(context: TradeContext, options?: DefaultContextMenuActionsParams) => Promise<ActionMetaInfo[]>

Parameters

NameTypeDescription
contextTradeContextcontext object passed by a browser
options?DefaultContextMenuActionsParamsdefault options for the context menu action parameters

Returns

Promise<ActionMetaInfo[]>


connectionStatus

Connection status for the Broker API.

You don't need to return values other than 1 (Connected) typically since the broker is already connected when you create the widget. You can use it if you want to display a spinner in the bottom panel while the data is being loaded.

Signature

connectionStatus() => ConnectionStatus

Returns

ConnectionStatus


executions

Called by Trading Platform to request executions for the specified symbol

Signature

executions(symbol: string) => Promise<Execution[]>

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<Execution[]>


formatter

Optional

Provide a custom price formatter for the specified symbol.

Signature

formatter(symbol: string, alignToMinMove: boolean) => Promise<INumberFormatter>

Parameters

NameTypeDescription
symbolstringsymbol identifier
alignToMinMovebooleanalign formatted number to the minimum movement amount of the symbol

Returns

Promise<INumberFormatter>


getOrderDialogOptions

Optional

Implement this method if you want to add custom fields to the standard Order Ticket.

Use the symbol parameter to return customization options for a particular symbol.

Signature

getOrderDialogOptions(symbol: string) => Promise<OrderDialogOptions>

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<OrderDialogOptions>


getPositionDialogOptions

Optional

Implement this method if you want to customize the position dialog.

Signature

getPositionDialogOptions() => PositionDialogOptions

Returns

PositionDialogOptions


getSymbolSpecificTradingOptions

Optional

Implement this method if you want to have custom options available for different symbols.

Signature

getSymbolSpecificTradingOptions(symbol: string) => Promise<SymbolSpecificTradingOptions>

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<SymbolSpecificTradingOptions>


individualPositions

Optional

Called by Trading Platform to request individual positions. Required if the BrokerConfigFlags.supportPositionNetting flag is set to true.

Signature

individualPositions() => Promise<IndividualPosition[]>

Returns

Promise<IndividualPosition[]>


isTradable

This function is required for the Floating Trading Panel. The ability to trade via the panel depends on the result of this function: true or false. You don't need to implement this method if all symbols can be traded.

If you want to show a custom message with the reason why the symbol cannot be traded then you can return an object IsTradableResult.

Signature

isTradable(symbol: string) => Promise<boolean | IsTradableResult>

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<boolean | IsTradableResult>


orders

Called by Trading Platform to request orders

Signature

orders() => Promise<Order[]>

Returns

Promise<Order[]>


ordersHistory

Optional

This method is called by the Trading Platform to request orders history. It is expected that returned orders will have a final status (rejected, filled, cancelled).

This method is optional. If you don't support orders history, please set the BrokerConfigFlags.supportOrdersHistory flag to false.

Signature

ordersHistory() => Promise<Order[]>

Returns

Promise<Order[]>


positions

Optional

Called by Trading Platform to request positions. Required if the BrokerConfigFlags.supportPositions flag is set to true.

Signature

positions() => Promise<Position[]>

Returns

Promise<Position[]>


quantityFormatter

Optional

Provide a custom quantity formatter for the specified symbol.

Signature

quantityFormatter(symbol: string) => Promise<INumberFormatter>

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<INumberFormatter>


spreadFormatter

Optional

Provide a custom spread formatter for the specified symbol.

Signature

spreadFormatter(symbol: string) => Promise<INumberFormatter>

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<INumberFormatter>


symbolInfo

Called by the internal Order dialog, DOM panel, and floating trading panel to get symbol information.

Signature

symbolInfo(symbol: string) => Promise<InstrumentInfo>

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<InstrumentInfo>