LSEG Data Library for Python

create_formula

Sends a request to the Delivery Platform (formerly Refinitiv Data Platform) to create a basket-based custom instrument.

Module

refinitiv.data.content.custom_instruments.manage

Syntax

create_basket(symbol, basket, currency)

Parameters

Value Description Data type Optional Default value
symbol Instrument symbol in the format "S)someSymbol.YOURUUID". str No -
basket For weighted baskets / indices. Basket or dict No -
currency 3-letter code of the currency of the instrument, e.g. GBP. str No -
instrument_name Human-readable name of the instrument. Maximum of 16 characters. str Yes -
exchange_name 4-letter code of the listing exchange. str Yes -
holidays List of custom calendar definitions. list[dict] Yes -
time_zone Time Series uses an odd custom 3-letter value for time zone IDs, e.g. "LON" for London. str Yes -
description Free text field from the user to put any notes or text. Up to 1000 characters. list[dict] Yes -
extended_params Specifies the parameters that will be merged with the request. dict Yes -
session Session object. If session parameters are not defined, the default session will be used. Session object Yes None
on_response User-defined callback function to process received response. Callable Yes None

Returned value

CustomInstrumentBasket

Usage

The following example demonstrates how to create a custom instrument based on basket ["LSEG.L", "VOD.L"]:

from refinitiv.data.content.custom_instruments.manage import create_basket
import refinitiv.data.content.custom_instruments as ci

response = create_basket(
    symbol="MyBasketInstrument",
    holidays=[
        ci.manage.Holiday(date="1991-10-24", name="Labour Day"),
        ci.manage.Holiday(date=datetime.timedelta(days=-30), name="Alaska Day"),
        {"date": "2022-04-23", "reason": "Shakespeare Day"},
    ],
    basket=Basket(
        constituents=[
            ci.manage.Constituent(ric="LSEG.L", weight=50),
            ci.manage.Constituent(ric="VOD.L", weight=50),
        ],
        normalize_by_weight=True,
    ),
    currency="USD",
)
191 words (1:00 mins)