Skip to main content
Version: latest

Broker

Broker JS API for TradingView Trading Platform

Enumerations

Interfaces

Type Aliases

AccountId

Type

Nominal<string, "AccountID">


AccountManagerColumn

Type

{ [K in StandardFormatterName | FormatterName]: AccountManagerColumnBase<K> }[StandardFormatterName | FormatterName]


ActionMetaInfo

Describes a single action to put it into a dropdown or a context menu.

Type

ActionDescriptionWithCallback | MenuSeparator


AskBid

The Ask and Bid quotes.

Type

Required<Pick<TradingQuotes, "ask" | "bid">>


CellAlignment

Type

"left" | "right"


CustomFieldPossibleTypes

Type

"TextWithCheckBox" | "ComboBox" | "Checkbox"


CustomTableFormatElementFunction

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

Type

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

Type parameters

NameType
Textends TableFormatterInputValues = TableFormatterInputValues

Type declaration

Signature

(inputs: TableFormatterInputs<T>) => undefined | string | HTMLElement
Parameters
NameType
inputsTableFormatterInputs<T>
Returns

undefined | string | HTMLElement


FormatterName

Type

Nominal<string, "FormatterName">


InputFieldValidator

Input field validator

Type

(value: any) => InputFieldValidatorResult

Type declaration

Signature

(value: any) => InputFieldValidatorResult
Parameters
NameTypeDescription
valueanyvalue to be validated
Returns

InputFieldValidatorResult


InputFieldValidatorResult

Type

PositiveBaseInputFieldValidatorResult | NegativeBaseInputFieldValidatorResult


LanguageCode

Type

"ar" | "zh" | "ca_ES" | "en" | "fr" | "de" | "he_IL" | "id_ID" | "it" | "ja" | "ko" | "pl" | "pt" | "ru" | "es" | "sv" | "th" | "tr" | "vi" | "ms_MY" | "zh_TW"


LeverageParams

Type

LeverageInfoParams | LeverageSetParams


Nominal

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

T & { [species]: Name }

Type parameters

NameType
TT
Nameextends string

Order

Type

PlacedOrder | BracketOrder


OrderTableColumn

Type

AccountManagerColumn & { supportedStatusFilters?: OrderStatusFilter[] }


SuggestedQtyChangedListener

Type

(newQty: number) => void

Type declaration

Signature

(newQty: number) => void
Parameters
NameType
newQtynumber
Returns

void


SymbolType

Type

"stock" | "index" | "forex" | "futures" | "bitcoin" | "crypto" | "undefined" | "expression" | "spread" | "cfd" | "economic" | "equity" | "dr" | "bond" | "right" | "warrant" | "fund" | "structured" | "commodity" | "fundamental" | "spot" | "swap"


TableFormatTextFunction

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

Type

(inputs: TableFormatterInputs<T>) => string

Type parameters

NameType
Textends TableFormatterInputValues = TableFormatterInputValues

Type declaration

Signature

(inputs: TableFormatterInputs<T>) => string
Parameters
NameType
inputsTableFormatterInputs<T>
Returns

string


TableFormatterInputValue

Type

any


TableFormatterInputValues

Type

TableFormatterInputValue[]


TextInputFieldValidator

Type

(value: string) => InputFieldValidatorResult

Type declaration

Signature

(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

Type

TradableSolutionsTypes[keyof TradableSolutionsTypes]


TradingDialogCustomField

Type

CheckboxFieldMetaInfo | TextWithCheckboxFieldMetaInfo | CustomComboBoxMetaInfo


WatchedValueCallback

Type

(value: T) => void

Type parameters

Name
T

Type declaration

Signature

(value: T) => void
Parameters
NameType
valueT
Returns

void