Skip to main content

Interface: IBrokerCommon

Broker.IBrokerCommon

Hierarchy

Methods

accountManagerInfo

accountManagerInfo(): AccountManagerInfo

The library calls accountManagerInfo to get information required for building the Account Manager.

Returns

AccountManagerInfo


chartContextMenuActions

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

The library calls chartContextMenuActions when users open the context menu on the chart. This method also renders the Trade button in the context menu.

This method should return an array of ActionMetaInfo elements, each of them representing one context menu item.

Parameters

NameTypeDescription
contextTradeContextA context object passed by the library.
options?DefaultContextMenuActionsParamsDefault options for the context menu action parameters.

Returns

Promise<ActionMetaInfo[]>

A promise that resolves to an array of ActionMetaInfo, which may be empty. In that case, the Trade button will be removed from the context menu.


connectionStatus

connectionStatus(): ConnectionStatus

Defines a connection status for the Broker API. If any other value than 1 ("Connected") is returned, the Account Manager will display an endless spinner instead of users' trading data. If you want to handle other scenarios, for example when the status is disconnected, you need to manage this scenario within your implementation and use the IBrokerConnectionAdapterHost.connectionStatusUpdate method.

If the method is not implemented or returns a value other than 1, the following error will appear in the console: Method connectionStatus is not properly implemented.

Returns

ConnectionStatus


executions

executions(symbol): Promise<Execution[]>

The library calls executions to request executions for the specified symbol. If you want executions to be displayed on the chart, set the BrokerConfigFlags.supportExecutions to true.

Parameters

NameTypeDescription
symbolstringThe symbol identifier.

Returns

Promise<Execution[]>


formatter

formatter(symbol, alignToMinMove): Promise<INumberFormatter>

Provide a custom price formatter for the specified symbol.

Parameters

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

Returns

Promise<INumberFormatter>


getOrderDialogOptions

getOrderDialogOptions(symbol): Promise<OrderDialogOptions>

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.

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<OrderDialogOptions>


getPositionDialogOptions

getPositionDialogOptions(symbol): Promise<PositionDialogOptions>

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

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

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<PositionDialogOptions>


getSymbolSpecificTradingOptions

getSymbolSpecificTradingOptions(symbol): Promise<SymbolSpecificTradingOptions>

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

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<SymbolSpecificTradingOptions>


individualPositions

individualPositions(): Promise<IndividualPosition[]>

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

Returns

Promise<IndividualPosition[]>


isTradable

isTradable(symbol): Promise<boolean | IsTradableResult>

The library calls isTradable to check if a symbol can be traded. If the method returns false, users will see the Non-tradable symbol message in the UI when creating orders. You can also display a custom message with the reason why the symbol cannot be traded and the possible solution to resolve the issue. To do this, return an IsTradableResult object.

Parameters

NameTypeDescription
symbolstringThe symbol identifier.

Returns

Promise<boolean | IsTradableResult>


orders

orders(): Promise<Order[]>

The library calls orders to request data on the user's active orders. This data is displayed on the Orders and Positions pages of the Account Manager.

Returns

Promise<Order[]>


ordersHistory

ordersHistory(): Promise<Order[]>

The library calls ordersHistory to request orders history. It is expected that returned orders will have a final status (rejected, filled, cancelled).

This method is only required when you set the BrokerConfigFlags.supportOrdersHistory flag to true. This flag adds the History page, where order history is displayed, to the Account Manager. Refer to the History section for more information.

Returns

Promise<Order[]>


positions

positions(): Promise<Position[]>

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

Returns

Promise<Position[]>


quantityFormatter

quantityFormatter(symbol): Promise<INumberFormatter>

Provide a custom quantity formatter for the specified symbol.

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<INumberFormatter>


spreadFormatter

spreadFormatter(symbol): Promise<INumberFormatter>

Provide a custom spread formatter for the specified symbol.

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<INumberFormatter>


symbolInfo

symbolInfo(symbol): Promise<InstrumentInfo>

The library calls symbolInfo to request symbol information for the Order Ticket and Depth of Market widget.

Parameters

NameTypeDescription
symbolstringThe symbol identifier.

Returns

Promise<InstrumentInfo>