Skip to main content

Module: Broker

Broker JS API for TradingView Trading Platform

Enumerations

Interfaces

Type Aliases

AccountId

Ƭ AccountId: Nominal<string, "AccountID">


AccountManagerColumn

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


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"


CustomFieldPossibleTypes

Ƭ CustomFieldPossibleTypes: "TextWithCheckBox" | "ComboBox" | "Checkbox"


CustomTableFormatElementFunction

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

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

Type parameters

NameType
Textends TableFormatterInputValues = TableFormatterInputValues

Type declaration

▸ (inputs): undefined | string | HTMLElement

Parameters
NameType
inputsTableFormatterInputs<T>
Returns

undefined | string | HTMLElement


FormatterName

Ƭ FormatterName: Nominal<string, "FormatterName">


InputFieldValidator

Ƭ InputFieldValidator: (value: any) => InputFieldValidatorResult

Input field validator

Type declaration

▸ (value): InputFieldValidatorResult

Parameters
NameTypeDescription
valueanyvalue to be validated
Returns

InputFieldValidatorResult


InputFieldValidatorResult

Ƭ InputFieldValidatorResult: PositiveBaseInputFieldValidatorResult | NegativeBaseInputFieldValidatorResult


LanguageCode

Ƭ LanguageCode: "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

Ƭ LeverageParams: LeverageInfoParams | LeverageSetParams


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

NameType
TT
Nameextends string

Order

Ƭ Order: PlacedOrder | BracketOrder


OrderTableColumn

Ƭ OrderTableColumn: AccountManagerColumn & { supportedStatusFilters?: OrderStatusFilter[] }


SuggestedQtyChangedListener

Ƭ SuggestedQtyChangedListener: (newQty: number) => void

Type declaration

▸ (newQty): void

Parameters
NameType
newQtynumber
Returns

void


SymbolType

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


TableFormatTextFunction

Ƭ TableFormatTextFunction<T>: (inputs: TableFormatterInputs<T>) => string

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

Type parameters

NameType
Textends TableFormatterInputValues = TableFormatterInputValues

Type declaration

▸ (inputs): string

Parameters
NameType
inputsTableFormatterInputs<T>
Returns

string


TableFormatterInputValue

Ƭ TableFormatterInputValue: any


TableFormatterInputValues

Ƭ TableFormatterInputValues: TableFormatterInputValue[]


TextInputFieldValidator

Ƭ TextInputFieldValidator: (value: string) => InputFieldValidatorResult

Type declaration

▸ (value): InputFieldValidatorResult

Parameters
NameType
valuestring
Returns

InputFieldValidatorResult


TradableSolutions

Ƭ TradableSolutions: ChangeAccountSolution | ChangeSymbolSolution | OpenUrlSolution

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

Ƭ TradingDialogCustomField: CheckboxFieldMetaInfo | TextWithCheckboxFieldMetaInfo | CustomComboBoxMetaInfo


WatchedValueCallback

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

Type parameters

Name
T

Type declaration

▸ (value): void

Parameters
NameType
valueT
Returns

void