Module: Broker
Broker JS API for TradingView Trading Platform
Enumerations
- BottomWidgetBarMode
- CashTransactionType
- CommonAccountManagerColumnId
- ConnectionStatus
- ConnectionType
- DisconnectType
- NotificationType
- OrderOrPositionMessageType
- OrderStatus
- OrderStatusFilter
- OrderTicketFocusControl
- OrderType
- ParentType
- PriceType
- Side
- StandardFormatterName
- StopType
Interfaces
- AccountManagerColumnBase
- AccountManagerInfo
- AccountManagerPage
- AccountManagerSummaryField
- AccountManagerTable
- AccountManagerTableFlags
- AccountMetainfo
- ActionDescription
- ActionDescriptionWithCallback
- BaseInputFieldValidatorResult
- BracketOrder
- Brackets
- BrokerConfigFlags
- BrokerCustomUI
- ChangeAccountSolution
- ChangeSymbolSolution
- CheckboxFieldMetaInfo
- ClosePositionPreviewResult
- ClosePositionPreviewRowData
- ClosePositionPreviewSeparator
- ContractExpirationDate
- CryptoBalance
- CustomComboBoxItem
- CustomComboBoxMetaInfo
- CustomFieldMetaInfoBase
- CustomInputFieldMetaInfo
- CustomInputFieldsValues
- CustomTableElementFormatter
- DOMData
- DOMLevel
- DefaultContextMenuActionsParams
- DefaultDropdownActionsParams
- DisconnectionInfo
- ErrorFormatterParseResult
- Execution
- ExitLevel
- ExitLevelTemplate
- ExtraData
- FormatterFormatOptions
- FormatterParseOptions
- FormatterParseResult
- HyperlinkInfo
- IBoxedValue
- IBoxedValueReadOnly
- IBrokerAccountInfo
- IBrokerCommon
- IBrokerConnectionAdapterFactory
- IBrokerConnectionAdapterHost
- IBrokerTerminal
- IDelegate
- IFormatter
- INumberFormatter
- IObservable
- IObservableValue
- IObservableValueReadOnly
- IPriceFormatter
- ISubscription
- ISymbolValueFormatter
- IWatchedValue
- IWatchedValueReadonly
- IndividualPosition
- IndividualPositionBase
- InstrumentInfo
- IsTradableResult
- LevelsFormatterProperties
- LeverageInfo
- LeverageInfoParams
- LeveragePreviewResult
- LeverageSetParams
- LeverageSetResult
- MenuSeparator
- NegativeBaseInputFieldValidatorResult
- NumberFormatterFormatOptions
- OpenUrlSolution
- OrderDialogOptions
- OrderDuration
- OrderDurationMetaInfo
- OrderOrPositionMessage
- OrderPreviewResult
- OrderPreviewSection
- OrderPreviewSectionRow
- OrderRule
- OrderTemplate
- OrderTemplateBase
- OrderTicketSettings
- PipValues
- PlaceOrderResult
- PlacedOrder
- Position
- PositionBase
- PositionDialogOptions
- PositiveBaseInputFieldValidatorResult
- PreOrder
- PriceFormatterFormatOptions
- QuantityMetainfo
- SingleBrokerMetaInfo
- SortingParameters
- StandardFormattersDependenciesMapping
- SuccessFormatterParseResult
- SymbolFormatterProperties
- SymbolSpecificTradingOptions
- SymbolValueFormatterFormatOptions
- TableFormatterInputs
- TextFieldMetaInfo
- TextWithCheckboxFieldCustomInfo
- TextWithCheckboxFieldMetaInfo
- TextWithCheckboxValue
- TradableSolutionsTypes
- TradeContext
- TradedGroupConfig
- TradingDialogOptions
- TradingQuotes
- WatchedValueSubscribeOptions
- WithExtraData
Type Aliases
AccountId
AccountId: Nominal<string, "AccountID">
AccountManagerColumn
AccountManagerColumn<TPossibleFields>: { [TFormatterName in StandardFormatterName | FormatterName]: AccountManagerColumnBase<TFormatterName, TPossibleFields> }[StandardFormatterName | FormatterName]
Type parameters
| Name | Type |
|---|---|
TPossibleFields | extends string = string |
ActionMetaInfo
ActionMetaInfo: ActionDescriptionWithCallback | MenuSeparator
Describes a single action to put it into a dropdown or a context menu.
AskBid
AskBid: Required<Pick<TradingQuotes, "ask" | "bid">>
The Ask and Bid quotes.
CellAlignment
CellAlignment: "left" | "right"
ClosePositionPreviewRow
ClosePositionPreviewRow: ClosePositionPreviewRowData | ClosePositionPreviewSeparator
CustomFieldPossibleTypes
CustomFieldPossibleTypes: "TextWithCheckBox" | "ComboBox" | "Checkbox" | "TextField"
CustomTableFormatElementFunction
CustomTableFormatElementFunction<T>: (inputs: TableFormatterInputs<T>) => undefined | string | HTMLElement
Type parameters
| Name | Type |
|---|---|
T | extends TableFormatterInputValues = TableFormatterInputValues |
A function that takes an TableFormatterInputs object and returns a string or an HTMLElement.
Parameters
| Name | Type |
|---|---|
inputs | TableFormatterInputs<T> |
Returns
undefined | string | HTMLElement
FieldRef
FieldRef<T>: T | [T, ...string[]]
Type parameters
| Name | Type |
|---|---|
T | extends string = string |
FormatterName
FormatterName: Nominal<string, "FormatterName">
IndividualPositionTableColumn
IndividualPositionTableColumn: AccountManagerColumn<keyof IndividualPosition>
Account Manager column for the individual positions table. Its dataFields are checked against the IndividualPosition fields.
InputFieldValidator
InputFieldValidator: (value: any) => InputFieldValidatorResult
Input field validator
Parameters
| Name | Type | Description |
|---|---|---|
value | any | value to be validated |
Returns
InputFieldValidatorResult
InputFieldValidatorResult: PositiveBaseInputFieldValidatorResult | NegativeBaseInputFieldValidatorResult
LeverageParams
LeverageParams: LeverageInfoParams | LeverageSetParams
MarkupText
MarkupText: (string | HyperlinkInfo)[]
Nominal
Nominal<T, Name>: T & { [species]: Name }
This is the generic type useful for declaring a nominal type, which does not structurally matches with the base type and the other types declared over the same base type
Usage:
Example
type Index = Nominal<number, 'Index'>;
// let i: Index = 42; // this fails to compile
let i: Index = 42 as Index; // OK
Example
type TagName = Nominal<string, 'TagName'>;
Type parameters
| Name | Type |
|---|---|
T | T |
Name | extends string |
ObservableCallback
ObservableCallback<T>: (value: T) => void
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | T |
Order
Order: PlacedOrder | BracketOrder
OrderPreviewMessage
OrderPreviewMessage: string | MarkupText
OrderTableColumn
OrderTableColumn: AccountManagerColumn<keyof PlacedOrder & BracketOrder> & { supportedStatusFilters?: OrderStatusFilter[] }
PositionTableColumn
PositionTableColumn: AccountManagerColumn<keyof Position>
Account Manager column for the positions table. Its dataFields are checked against the Position fields.
SuggestedQtyChangedListener
SuggestedQtyChangedListener: (newQty: number) => void
Parameters
| Name | Type |
|---|---|
newQty | number |
SymbolType
SymbolType: "stock" | "index" | "forex" | "futures" | "bitcoin" | "crypto" | "undefined" | "expression" | "spread" | "cfd" | "economic" | "equity" | "dr" | "bond" | "right" | "warrant" | "fund" | "structured" | "commodity" | "fundamental" | "spot" | "swap" | "option" | "ndf"
TableFormatTextFunction
TableFormatTextFunction<T>: (inputs: TableFormatterInputs<T>) => string
Type parameters
| Name | Type |
|---|---|
T | extends TableFormatterInputValues = TableFormatterInputValues |
A function that takes an TableFormatterInputs object and returns a string.
Parameters
| Name | Type |
|---|---|
inputs | TableFormatterInputs<T> |
Returns
string
TableFormatterInputValue
TableFormatterInputValue: any
TableFormatterInputValues
TableFormatterInputValues: TableFormatterInputValue[]
TextInputFieldValidator
TextInputFieldValidator: (value: string) => InputFieldValidatorResult
Parameters
| Name | Type |
|---|---|
value | string |
Returns
TradableSolutions
TradableSolutions: TradableSolutionsTypes[keyof TradableSolutionsTypes]
TradableSolutions has one of the following keys:
changeAccount- id of a sub-account suitable for trading the symbolchangeSymbol- the symbol suitable for trading with current sub-accountopenUrl- the object with URL to be opened and text for solution button
TradingDialogCustomField
TradingDialogCustomField: CheckboxFieldMetaInfo | TextWithCheckboxFieldMetaInfo | CustomComboBoxMetaInfo | TextFieldMetaInfo
WatchedValueCallback
WatchedValueCallback<T>: (value: T) => void
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | T |