Skip to main content

Interface: IBrokerCommon

Broker.IBrokerCommon

Hierarchy

Methods

accountManagerInfo

accountManagerInfo(): AccountManagerInfo

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

Returns

AccountManagerInfo


chartContextMenuActions

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

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.

Parameters

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

Returns

Promise<ActionMetaInfo[]>


connectionStatus

connectionStatus(): ConnectionStatus

Defines the connection status for the Broker API. You don't need to return values other than 1 (Connected) since the broker is already connected when you create the widget.

If the method is not implemented, the Account Manager will have a spinner instead of the user's trading data. In the console, the Trading.Core:Broker broker creation error will also be displayed.

Returns

ConnectionStatus


executions

executions(symbol): Promise<Execution[]>

Called by Trading Platform to request executions for the specified symbol

Parameters

NameTypeDescription
symbolstringsymbol 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(): PositionDialogOptions

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

Returns

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 this method 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 show 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
symbolstringsymbol identifier

Returns

Promise<boolean | IsTradableResult>


orders

orders(): Promise<Order[]>

Called by Trading Platform to request orders

Returns

Promise<Order[]>


ordersHistory

ordersHistory(): Promise<Order[]>

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.

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>

Called by the Order Ticket and DOM panel to get symbol information.

Parameters

NameTypeDescription
symbolstringsymbol identifier

Returns

Promise<InstrumentInfo>