IBrokerCommon
Methods
accountManagerInfo
This function should return the information that will be used to build the Account Manager.
Signature
accountManagerInfo() => AccountManagerInfo
Returns
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
Name | Type | Description |
---|---|---|
context | TradeContext | context object passed by a browser |
options? | DefaultContextMenuActionsParams | default options for the context menu action parameters |
Returns
Promise<ActionMetaInfo[]>
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.
Signature
connectionStatus() => ConnectionStatus
Returns
executions
Called by Trading Platform to request executions for the specified symbol
Signature
executions(symbol: string) => Promise<Execution[]>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<Execution[]>
formatter
OptionalProvide a custom price formatter for the specified symbol.
Signature
formatter(symbol: string, alignToMinMove: boolean) => Promise<INumberFormatter>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
alignToMinMove | boolean | align formatted number to the minimum movement amount of the symbol |
Returns
Promise<INumberFormatter>
getOrderDialogOptions
OptionalImplement 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
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<OrderDialogOptions>
getPositionDialogOptions
OptionalImplement this method if you want to customize the position dialog.
Signature
getPositionDialogOptions() => PositionDialogOptions
Returns
getSymbolSpecificTradingOptions
OptionalImplement this method if you want to have custom options available for different symbols.
Signature
getSymbolSpecificTradingOptions(symbol: string) => Promise<SymbolSpecificTradingOptions>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<SymbolSpecificTradingOptions>
individualPositions
OptionalCalled 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
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.
Signature
isTradable(symbol: string) => Promise<boolean | IsTradableResult>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<boolean | IsTradableResult>
orders
Called by Trading Platform to request orders
Signature
orders() => Promise<Order[]>
Returns
Promise<Order[]>
ordersHistory
OptionalThis 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
OptionalCalled by Trading Platform to request positions.
Required if the BrokerConfigFlags.supportPositions flag is set to true
.
Signature
positions() => Promise<Position[]>
Returns
Promise<Position[]>
quantityFormatter
OptionalProvide a custom quantity formatter for the specified symbol.
Signature
quantityFormatter(symbol: string) => Promise<INumberFormatter>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<INumberFormatter>
spreadFormatter
OptionalProvide a custom spread formatter for the specified symbol.
Signature
spreadFormatter(symbol: string) => Promise<INumberFormatter>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<INumberFormatter>
symbolInfo
Called by the Order Ticket and DOM panel to get symbol information.
Signature
symbolInfo(symbol: string) => Promise<InstrumentInfo>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<InstrumentInfo>