Skip to main content
MSCI

MSCI SDK Introduction

The MSCI Python SDK provides easy-to-use Python libraries that enable users to easily access and use MSCI APIs, content, and data into their own choice of platform.

The current version of the MSCI Python SDK provides access to the MSCI Optimization Service API, which is offered as part of MSCI Quantitative Investment Solutions (QIS). You can use the API to:

  • upload user portfolios and tax lots in JSON format

  • create tax aware optimization strategies

  • retrieve statistics to evaluate performance of the strategy

  • customize portfolios with various optimization methodologies

For more information about the MSCI Optimization Service API, see https://support.msci.com/msci-optimization-service.

Documentation

For more details, see https://developer.msci.com/code-libraries/msci-python-sdk

Prerequisites

  • Python >= 3.8

  • Access to MSCI Optimization Service API

For assistance in requesting access or confirming your access, contact your MSCI representative.

Installation

pip install msci.sdk

Example

Tax Optimization of portfolio using msci.sdk library. It demonstrates connection to the API, tax lot upload, rebalance, trade list generation, and review of results.

To download below example as notebook, kindly refer https://developer.msci.com/code-libraries/qis-tax-optimization-with-msci-sdk-python-notebooks

from msci.sdk.calc.portfolio import mos
import pandas as pd

# 1. Connect to the MOS API

session = mos.MOSSession()
session.ping()

# 2. Load a portfolio using tax lots
sample_data = pd.DataFrame([{"openTradeDate": "2016-12-30", "ISIN": "US02079K3059", "quantity": 1000, "openCostBasis": 792.45, "Asset Name": "ALPHABET INC"},
                            {"openTradeDate": "2016-12-30", "ISIN": "US0231351067", "quantity": 450, "openCostBasis": 749.87, "Asset Name": "AMAZON.COM INC"},
                            {"openTradeDate": "2016-12-30", "ISIN": "US30303M1027", "quantity": 900, "openCostBasis": 115.05, "Asset Name": "FACEBOOK INC"}])

portfolio = session.upload_taxlot_portfolio(
    portfolio_id='MyTaxLotPortfolio', as_of_date='2021-12-31', asset_id='ISIN', taxlot_df=sample_data)

# 3. Run the rebalance using the preferred strategy
mytemplate = mos.TaxAdvantagedModelTrackingTemplate(analysis_date='2022-01-03',portfolio=portfolio)

# 4. Executing the MSCI Optimizer session
job = session.execute(profile=mytemplate)

# Wait for the results to come back
job.wait()

# 5. Show the portfolio level results
job.get_valuations()

# Fetching the optimizer result
opt_result = job.optimizer_result()

# Portfolio Summary
opt_result.get_portfolio_summary_detail()

# Display portfolio and trade suggestions
job.rebalanced_portfolio_on('2022-01-03')
job.trade_suggestions_on('2022-01-03')

Support

For questions about MSCI Python SDK or other MSCI resources mentioned here, please contact a salesperson at MSCI: https://www.msci.com/contact-us#/contact-sales, or use any of our support channels for existing MSCI clients.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msci_sdk-1.36.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file msci_sdk-1.36.0-py3-none-any.whl.

File metadata

  • Download URL: msci_sdk-1.36.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for msci_sdk-1.36.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44c27c9a237541a2b3b30e02d208a6c98c6fa5525536d4d28b3c94765d60f49e
MD5 ba5a73c02d1f998df04169ec9d1b365a
BLAKE2b-256 de446d95cbce654cfdff0189fe1de763cbaa7be5640bcd56ce2603558e9ca270

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.36.0 This release

1 file

1.35.0

1 file

1.34.0

1 file

1.33.0

1 file

1.32.0

1 file

1.30.0

1 file

1.29.0

1 file

1.28.1

1 file

1.28.0

1 file

1.27.0

1 file

1.26.2

1 file

1.26.0

1 file

1.25.0

1 file

1.24.0

1 file

1.23.0

1 file

1.22.0

1 file

1.21.0

1 file

1.19.0

1 file

1.18.0

1 file

1.17.0

1 file

1.16.0

1 file

1.15.0

1 file

1.14.0

1 file

1.12.0

1 file

1.11.0

1 file

1.10.0

1 file

1.9.0

1 file

1.8.0

1 file

1.7.0

1 file

1.6.0

1 file

1.5.0

1 file

1.4.0

1 file

1.3.0

1 file

1.2.0

1 file

1.1.0

1 file

1.0.1

1 file

1.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page