{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Rebalancing a Custom Basket\n", "\n", "Here we will go through how to modify your basket's current composition. You may concurrently modify basket details, pricing options, and publishing preferences." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 1: Authenticate & Initialize your session\n", "\n", "First you will import the necessary modules and add your client id and client secret." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from gs_quant.markets.position_set import PositionSet\n", "from gs_quant.markets.baskets import Basket\n", "from gs_quant.session import Environment, GsSession\n", "\n", "client = 'CLIENT ID'\n", "secret = 'CLIENT SECRET'\n", "\n", "GsSession.use(Environment.PROD, client_id=client, client_secret=secret, scopes=('read_product_data read_user_profile',))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 2: Fetch your basket and set your changes\n", "\n", "Next you will fetch the basket you'd like to update by passing in any of its identifiers such as BloombergId, Cusip, Ticker, etc. If this is a basket you or someone from your organization created, please make sure your application has admin entitlements or you will not be able to submit the rebalance request. You will then be ready to change any of the properties listed below.\n", "\n", "| Parameter Name | Required? | Description |\n", "|:-------------------|:-----------|:------------|\n", "|position_set |**Required**|Information of constituents associated with the basket. You may provide the weight or quantity for each position. If neither is provided we will distribute the total weight evenly among each position. Please note that any fractional shares will be rounded up to whole numbers.|\n", "|divisor |Optional |Divisor to be applied to the overall position set. Ideally, you should not to change this as it will cause a price deviation on the basket.|\n", "|initial_price |Optional |Price you'd like to reset the basket to. Ideally, you should not to do this as it will cause a price deviation on the basket.|\n", "|publish_to_bloomberg|Optional |If you'd like us to publish your basket to Bloomberg|\n", "|publish_to_reuters |Optional |If you'd like us to publish your basket to Reuters |\n", "|publish_to_factset |Optional |If you'd like us to publish your basket to Factset |\n", "|include_price_history|Optional |Republish price history based on current composition when publishing to Bloomberg|\n", "|reweight |Optional |If you'd like us to reweight positions if input weights don't add up to 1 upon submission|\n", "|weighting_strategy |Optional |Strategy used to price the position set (will be inferred if not indicated). One of Equal, Market Capitalization, Quantity, Weight|\n", "|allow_ca_restricted_assets|Optional|Allow your basket to have constituents that will not be corporate action adjusted in the future (You will recieve a message indicating if this action is needed when attempting to rebalance your basket)|\n", "|allow_limited_access_assets|Optional|Allow basket to have constituents that GS has limited access to (You will recieve a message indicating if this action is needed when attempting to rebalance your basket)|\n", "|cash_reinvestment_treatment|How to treat cash acquisitions, regular dividends, and special dividends for basket underliers.|\n", "|historical_methodology|Preferred methodology to be applied when publishing basket history.