Skip to main content

Module: Broker

Broker JS API for TradingView Trading Platform

Enumerations​

Interfaces​

Type Aliases​

AccountId​

AccountId: Nominal<string, "AccountID">


AccountManagerColumn​

AccountManagerColumn<TPossibleFields>: { [TFormatterName in StandardFormatterName | FormatterName]: AccountManagerColumnBase<TFormatterName, TPossibleFields> }[StandardFormatterName | FormatterName]

Type parameters​

NameType
TPossibleFieldsextends string = string

ActionMetaInfo​

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​


CustomFieldPossibleTypes​

CustomFieldPossibleTypes: "TextWithCheckBox" | "ComboBox" | "Checkbox" | "TextField"


CustomTableFormatElementFunction​

CustomTableFormatElementFunction<T>: (inputs: TableFormatterInputs<T>) => undefined | string | HTMLElement

Type parameters​

NameType
Textends TableFormatterInputValues = TableFormatterInputValues

A function that takes an TableFormatterInputs object and returns a string or an HTMLElement.

Parameters​
NameType
inputsTableFormatterInputs<T>
Returns​

undefined | string | HTMLElement


FieldRef​

FieldRef<T>: T | [T, ...string[]]

Type parameters​

NameType
Textends 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​
NameTypeDescription
valueanyvalue to be validated
Returns​

InputFieldValidatorResult


InputFieldValidatorResult​


LeverageParams​


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:

type Index = Nominal<number, 'Index'>;
// let i: Index = 42; // this fails to compile
let i: Index = 42 as Index; // OK

type TagName = Nominal<string, 'TagName'>;

Type parameters​

NameType
TT
Nameextends string

ObservableCallback​

ObservableCallback<T>: (value: T) => void

Type parameters​

Name
T
Parameters​
NameType
valueT

Order​


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​
NameType
newQtynumber

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​

NameType
Textends TableFormatterInputValues = TableFormatterInputValues

A function that takes an TableFormatterInputs object and returns a string.

Parameters​
NameType
inputsTableFormatterInputs<T>
Returns​

string


TableFormatterInputValue​

TableFormatterInputValue: any


TableFormatterInputValues​

TableFormatterInputValues: TableFormatterInputValue[]


TextInputFieldValidator​

TextInputFieldValidator: (value: string) => InputFieldValidatorResult

Parameters​
NameType
valuestring
Returns​

InputFieldValidatorResult


TradableSolutions​

TradableSolutions has one of the following keys:

  • changeAccount - id of a sub-account suitable for trading the symbol
  • changeSymbol - the symbol suitable for trading with current sub-account
  • openUrl - the object with URL to be opened and text for solution button

TradingDialogCustomField​


WatchedValueCallback​

WatchedValueCallback<T>: (value: T) => void

Type parameters​

Name
T
Parameters​
NameType
valueT