IBrokerConnectionAdapterHost
Trading Host is an API for interaction between the Broker API and the Chart Trading Subsystem. Its main purpose is to exchange information between our charts and your trading adapter.
Properties
factory
Broker Connection Adapter Factory object
Type
IBrokerConnectionAdapterFactory
Methods
activateBottomWidget
Activate bottom widget
Signature
activateBottomWidget() => Promise<void>
Returns
Promise<void>
cryptoBalanceUpdate
Call this method when a broker connection has received a balance update.
This method is required by the crypto Order Dialog.
It should be implemented when supportBalances
flag is set in configFlags
.
Signature
cryptoBalanceUpdate(symbol: string, balance: CryptoBalance) => void
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol id |
balance | CryptoBalance | updated crypto balance |
Returns
void
currentAccountUpdate
Call this method when user account has been changed synchronously. The terminal will re-request all displayed information.
Signature
currentAccountUpdate() => void
Returns
void
defaultContextMenuActions
Provides default buy/sell, show properties actions to be returned as a default by IBrokerCommon.chartContextMenuActions.
Signature
defaultContextMenuActions(context: TradeContext, params?: DefaultContextMenuActionsParams) => Promise<ActionMetaInfo[]>
Parameters
Name | Type | Description |
---|---|---|
context | TradeContext | trade context |
params? | DefaultContextMenuActionsParams | - |
Returns
Promise<ActionMetaInfo[]>
defaultDropdownMenuActions
Provides default dropdown list of actions. You can use default actions in IBrokerConnectionAdapterHost.setButtonDropdownActions
Signature
defaultDropdownMenuActions(options?: Partial<DefaultDropdownActionsParams>) => ActionMetaInfo[]
Parameters
Name | Type |
---|---|
options? | Partial<DefaultDropdownActionsParams> |
Returns
defaultFormatter
Generates and returns the default value formatter for the symbol
Signature
defaultFormatter(symbol: string, alignToMinMove: boolean) => Promise<INumberFormatter>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
alignToMinMove | boolean | whether the formatted number should be aligned to minimum movement for the symbol |
Returns
Promise<INumberFormatter>
domPanelVisibility
Returns whether DOM Panel is visible or not.
Signature
domPanelVisibility() => IWatchedValue<boolean>
Returns
IWatchedValue<boolean>
domUpdate
Update the Depth of Market for the specified symbol
Signature
domUpdate(symbol: string, equity: DOMData) => void
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
equity | DOMData | Depth of market data |
Returns
void
equityUpdate
Call this method when a broker connection has received an equity update. This method is required by the standard Order Dialog to calculate risks.
Signature
equityUpdate(equity: number) => void
Parameters
Name | Type | Description |
---|---|---|
equity | number | updated equity |
Returns
void
executionUpdate
Call this method when an execution is added.
Signature
executionUpdate(execution: Execution) => void
Parameters
Name | Type | Description |
---|---|---|
execution | Execution | execution which was added |
Returns
void
getSymbolMinTick
Returns symbol minTick
.
Signature
getSymbolMinTick(symbol: string) => Promise<number>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
Returns
Promise<number>
marginAvailableUpdate
Call this method when a broker connection has received a margin available update.
This method is required by the standard Order Dialog to display the margin meter.
This method should be used when supportMargin
flag is set in configFlags
.
The Trading Terminal subscribes to margin available updates using IBrokerWithoutRealtime.subscribeMarginAvailable.
Signature
marginAvailableUpdate(marginAvailable: number) => void
Parameters
Name | Type | Description |
---|---|---|
marginAvailable | number | updated available margin |
Returns
void
numericFormatter
Generates and returns a number formatter with the desired decimal places
Signature
numericFormatter(decimalPlaces: number) => Promise<INumberFormatter>
Parameters
Name | Type |
---|---|
decimalPlaces | number |
Returns
Promise<INumberFormatter>
orderPanelVisibility
Returns whether the order panel is visible or not.
Signature
orderPanelVisibility() => IWatchedValue<boolean>
Returns
IWatchedValue<boolean>
orderPartialUpdate
Call this method when an order is not changed, but the fields that you added to the order object to display in the Account Manager have changed. It should be used only if you want to display custom fields in the Account Manager.
Signature
orderPartialUpdate(id: string, orderChanges: Partial<Order>) => void
Parameters
Name | Type | Description |
---|---|---|
id | string | order id |
orderChanges | Partial<Order> | changes made to the order object |
Returns
void
orderUpdate
Call this method to notify the chart that it needs to update information after an order is added or changed.
Signature
orderUpdate(order: Order) => void
Parameters
Name | Type | Description |
---|---|---|
order | Order | order which was added or changed |
Returns
void
patchConfig
Patch changes into the current broker configuration
Signature
patchConfig(config: Partial<BrokerConfigFlags>) => void
Parameters
Name | Type | Description |
---|---|---|
config | Partial<BrokerConfigFlags> | partial configuration changes to apply |
Returns
void
pipValueUpdate
Call this method when a broker connection has a pipValue
update.
The library subscribes to pipValue
updates using IBrokerWithoutRealtime.subscribePipValue.
Signature
pipValueUpdate(symbol: string, pipValues: PipValues) => void
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol with updated pip values |
pipValues | PipValues | updated pip values |
Returns
void
plUpdate
Call this method when a broker connection has received a PL update. This method should be used when supportPLUpdate
flag is set in configFlags
.
Signature
plUpdate(positionId: string, pl: number) => void
Parameters
Name | Type | Description |
---|---|---|
positionId | string | id of the position |
pl | number | updated profit / loss value |
Returns
void
positionPartialUpdate
Call this method when a position is not changed, but the fields that you added to the position object to display in the Account Manager have changed. It should be used only if you want to display custom fields in the Account Manager.
Signature
positionPartialUpdate(id: string, positionChanges: Partial<Position>) => void
Parameters
Name | Type | Description |
---|---|---|
id | string | id of the position |
positionChanges | Partial<Position> | changes to the position object |
Returns
void
positionUpdate
Call this method when a position is added or changed.
Signature
positionUpdate(position: Position, isHistoryUpdate?: boolean) => void
Parameters
Name | Type | Description |
---|---|---|
position | Position | position which was added or changed |
isHistoryUpdate? | boolean | - |
Returns
void
quantityFormatter
Generates and returns a quantity formatter with the desired decimal places
Signature
quantityFormatter(decimalPlaces?: number) => Promise<INumberFormatter>
Parameters
Name | Type |
---|---|
decimalPlaces? | number |
Returns
Promise<INumberFormatter>
realtimeUpdate
Trading quote realtime update
Signature
realtimeUpdate(symbol: string, data: TradingQuotes) => void
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol identifier |
data | TradingQuotes | realtime updated data for the symbol quotes |
Returns
void
sellBuyButtonsVisibility
Returns whether the buy/sell buttons are visible or not.
Signature
sellBuyButtonsVisibility() => IWatchedValue<boolean>
Returns
IWatchedValue<boolean>
setButtonDropdownActions
Bottom Trading Panel has a button with a list of dropdown items. This method can be used to replace existing items.
Signature
setButtonDropdownActions(descriptions: ActionMetaInfo[]) => void
Parameters
Name | Type | Description |
---|---|---|
descriptions | ActionMetaInfo[] | Descriptions for the dropdown items. |
Returns
void
setDurations
Set expiration durations
Signature
setDurations(durations: OrderDurationMetaInfo[]) => void
Parameters
Name | Type | Description |
---|---|---|
durations | OrderDurationMetaInfo[] | Expiration options for orders |
Returns
void
showCancelBracketsDialog
Shows the cancel brackets dialog
Signature
showCancelBracketsDialog(orderId: string, handler: Function) => Promise<void>
Parameters
Name | Type | Description |
---|---|---|
orderId | string | id of order |
handler | () => Promise<void> | cancel brackets confirmation handler (called when brackets should be cancelled) |
Returns
Promise<void>
showCancelMultipleBracketsDialog
Shows the cancel brackets dialog for multiple brackets
Signature
showCancelMultipleBracketsDialog(orderId: string, handler: Function) => Promise<void>
Parameters
Name | Type | Description |
---|---|---|
orderId | string | id of order |
handler | () => Promise<void> | cancel brackets confirmation handler (called when brackets should be cancelled) |
Returns
Promise<void>
showCancelMultipleOrdersDialog
Shows the cancel order dialog for multiple orders
Signature
showCancelMultipleOrdersDialog(symbol: string, side: Side, qty: number, handler: Function) => Promise<void>
Parameters
Name | Type | Description |
---|---|---|
symbol | string | symbol for which to cancel orders |
side | Side | side of the order |
qty | number | quantity of the order |
handler | () => Promise<void> | cancel orders confirmation handler (called when orders should be cancelled) |
Returns
Promise<void>
showCancelOrderDialog
Shows the cancel order dialog for specified order
Signature
showCancelOrderDialog(orderId: string, handler: Function) => Promise<void>
Parameters
Name | Type | Description |
---|---|---|
orderId | string | id of order to potentially cancel |
handler | () => Promise<void> | cancel order confirmation handler (called when order should be cancelled) |
Returns
Promise<void>
showConfirmDialog
Displays a confirmation dialog to a user and returns a Promise to the result.
Signature
showConfirmDialog(title: string, content: string | string[], mainButtonText?: string, cancelButtonText?: string, showDisableConfirmationsCheckbox?: boolean) => Promise<boolean>
Parameters
Name | Type | Description |
---|---|---|
title | string | title of the confirmation dialog |
content | string | string[] | content for the dialog |
mainButtonText? | string | - |
cancelButtonText? | string | - |
showDisableConfirmationsCheckbox? | boolean | - |
Returns
Promise<boolean>
showMessageDialog
Displays a message dialog to a user.
Signature
showMessageDialog(title: string, text: string, textHasHTML?: boolean) => void
Parameters
Name | Type | Description |
---|---|---|
title | string | title of the message dialog |
text | string | message |
textHasHTML? | boolean | - |
Returns
void
showNotification
Shows notification message
Signature
showNotification(title: string, text: string, notificationType?: NotificationType) => void
Parameters
Name | Type | Description |
---|---|---|
title | string | notification title |
text | string | notification content |
notificationType? | NotificationType | - |
Returns
void
showOrderDialog
OptionalShows the order dialog
Signature
showOrderDialog<T>(order: T, focus?: OrderTicketFocusControl) => Promise<boolean>
Type parameters
Name | Type |
---|---|
T | extends PreOrder |
Parameters
Name | Type | Description |
---|---|---|
order | T | order to show in the dialog |
focus? | OrderTicketFocusControl | - |
Returns
Promise<boolean>
showPositionBracketsDialog
Shows the position brackets dialog
Signature
showPositionBracketsDialog(position: Position | Trade, brackets: Brackets, focus: OrderTicketFocusControl) => Promise<boolean>
Parameters
Name | Type | Description |
---|---|---|
position | Position | Trade | position or trade |
brackets | Brackets | brackets for the position or trade |
focus | OrderTicketFocusControl | input control to focus on when dialog is opened |
Returns
Promise<boolean>
showReversePositionDialog
Shows reverse position dialog
Signature
showReversePositionDialog(position: string, handler: Function) => Promise<boolean>
Parameters
Name | Type | Description |
---|---|---|
position | string | position to be reversed |
handler | () => Promise<boolean> | reverse position confirmation handler (called when the position should be reversed) |
Returns
Promise<boolean>
showSimpleConfirmDialog
Displays a simple confirmation dialog to a user and returns a Promise to the result.
Signature
showSimpleConfirmDialog(title: string, content: string | string[], mainButtonText?: string, cancelButtonText?: string, showDisableConfirmationsCheckbox?: boolean) => Promise<boolean>
Parameters
Name | Type | Description |
---|---|---|
title | string | title of the confirmation dialog |
content | string | string[] | content for the dialog |
mainButtonText? | string | - |
cancelButtonText? | string | - |
showDisableConfirmationsCheckbox? | boolean | - |
Returns
Promise<boolean>
showTradingProperties
Shows trading properties
Signature
showTradingProperties() => void
Returns
void
silentOrdersPlacement
Returns if orders can be sent to the broker without showing the order ticket.
Signature
silentOrdersPlacement() => IWatchedValue<boolean>
Returns
IWatchedValue<boolean>
tradePLUpdate
Call this method when a broker connection has received a trade PL update.
Signature
tradePLUpdate(tradeId: string, pl: number) => void
Parameters
Name | Type | Description |
---|---|---|
tradeId | string | id of the trade |
pl | number | updated profit / loss for the trade |
Returns
void
tradePartialUpdate
Call this method when a trade has not changed, but fields that you added to the trade object to display in the Account Manager have changed.
Signature
tradePartialUpdate(id: string, tradeChanges: Partial<Trade>) => void
Parameters
Name | Type | Description |
---|---|---|
id | string | id of the updated trade |
tradeChanges | Partial<Trade> | changes to the trade object |
Returns
void
tradeUpdate
Call this method when a trade is added or changed.
Signature
tradeUpdate(trade: Trade, isHistoryUpdate?: boolean) => void
Parameters
Name | Type | Description |
---|---|---|
trade | Trade | updated trade |
isHistoryUpdate? | boolean | - |
Returns
void