Skip to main content
Version: latest

Symbol Search

The Symbol Search is a button on the top toolbar that opens a dialog containing a search box. Symbol Search is used to search and display instruments that match the entered full or partial instrument name.

Symbol Search

Display symbols

The way symbols appear in the Symbol Search depends on how you provide the data.

If you do not want users to change the displayed instrument, you can hide the Symbol Search. To do this, include the header_symbol_search featureset in the disabled_features array.

Set request delay

If you want to reduce the number of search requests when users enter symbol names in the search box, you can set a request delay in milliseconds. To do this, use the symbol_search_request_delay property of the Widget Constructor. You can check out the Widget Constructor tutorial on YouTube for an implementation example.

Override symbol names

Sometimes symbol names can be too long/short or implicitly reflect the meaning of the symbol name. In these cases, you can use the symbol_search_complete property of the Widget Constructor. This property overrides the entered symbol name with whatever human-friendly form you want. The overridden symbol name will then be requested by your server and plotted.

You can check out the Widget Constructor tutorial on YouTube for an implementation example.

Filters

When users click Symbol Search, the search dialog appears. The widget has predefined optional filters by symbol type and exchange. To use them, pass a DatafeedConfiguration object with the symbols_types and exchanges properties as a parameter to the callback of the onReady method.

Symbol grouping

The search dialog can display symbols grouped by a root name. For example, to group futures ABC2023, ABC2024, and ABC2025 by the root name ABC, provide a regular expression to the library. The expression should consist of two capture groups, where the first is the root name and the second is the expiration date.

To enable grouping, provide an object with regular expressions to parse symbol names in the symbols_grouping property of the DatafeedConfiguration interface. Then pass the DatafeedConfiguration object as a parameter to the callback of the onReady method.

Display logos

If you want to display logos for symbols and exchanges within the search results, follow the steps below:

  1. Enable the corresponding featuresets: show_symbol_logos and show_exchange_logos.
  2. Provide URLs for symbols and exchanges in the logo_urls and exchange_logo properties of the SearchSymbolResultItem object. Pass the object as a parameter to the callback of the searchSymbols method.