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.
Copyright
Copyright 2023 MSCI Inc
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Metadata
Release files for msci.sdk 1.37.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| msci_sdk-1.37.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / msci_sdk-1.37.1-py3-none-any.whl
| Download URL | msci_sdk-1.37.1-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
228413e441ae1d08e8b22ace61bc6e8f49a1f83fc2528c0fbcdf91068a58c381
|
|
BLAKE2b-256 checksum How to use checksums |
616cc380d2f577e587cdd1b33f755173ed3c9905edd5f7b263802837e9985151
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for msci.sdk 1.37.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.