Skip to content

LSEG-API-Samples/Article.DataLibrary.Python.InflationVsDCAFund

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inflation versus Dollar Cost Averaging on Pension Fund

  • Last update: April 2025
  • Environment: Windows
  • Compiler: Python
  • Prerequisite: LSEG Workspace desktop application with access to Data Library.

Overview

When investing in a retirement fund using DCA(Dollar-Cost Averaging) strategy, does it perform better than the inflation rate?

In this project, we will find out what is the past inflation rate in Thailand using the Data Library for Python to consume data from the Workspace Desktop application.

Then we will find out how the DCA on a fund performs. And finally we will plot a bar chart to compare the average return against inflation.

Introduction to the Data Library for Python

The Data Library for Python provides a set of ease-of-use interfaces offering coders uniform access to the breadth and depth of financial data and services available on the Workspace, RDP, and Real-Time Platforms. The API is designed to provide consistent access through multiple access channels and target both Professional Developers and Financial Coders. Developers can choose to access content from the desktop, through their deployed streaming services, or directly to the cloud. With the Data Library, the same Python code can be used to retrieve data regardless of which access point you choose to connect to the platform.

Figure-1

The Data Library are available in the following programming languages:

For more deep detail regarding the Data Library for Python, please refer to the following articles and tutorials:

Disclaimer

This project is based on Data Library Python versions 2.1.1 using the Desktop Session only.

Prerequisite

This example requires the following dependencies softwares and libraries.

  1. LSEG Workspace desktop application with access to Data Library for Python.
  2. Python (Ananconda or MiniConda distribution/package manager also compatible).
  3. Jupyter Lab application.

Note:

  • This Project has been qualified with Python version 3.11.5
  • If you are not familiar with Jupyter Lab application, the following tutorial created by DataCamp may help you.

Data Library with Desktop Session Set Up

Please follow a step by step guide to setup your library and App-Key in "Desktop - Eikon or LSEG Workspace" of LSEG Data Library for Python Quick Start page .

How to run this example

Please note that the Workspace desktop application integrates a Data API proxy that acts as an interface between the Python library and the Workspace Platform. For this reason, the Workspace application must be running when you use the Data library.

The first step is unzip or download the example project folder into a directory of your choice, then choose how to run application based on your environment below.

Running the Notebook example.

  1. Open a Command Prompt and go to project's folder

  2. Run the following command in a Command Prompt to create a Python virtual environment named venv for the project.

    $>python -m venv venv
  3. Once the environment is created, activate a virtual environment named venv with this command in a Command Prompt

    $>venv\Scripts\activate
  4. Go to project's notebook folder and update a contain in lseg-data.config.json file with the your App-Key

    {
        "logs": {
            "level": "debug",
            "transports": {
                "console": {
                    "enabled": false
                },
                "file": {
                    "enabled": false,
                    "name": "lseg-data-lib.log"
                }
            }
        },
        "sessions": {
            "default": "desktop.workspace",
            "desktop": {
                "workspace": {
                    "app-key": "YOUR APP KEY GOES HERE!"
                }
            }
        }
    }
  5. Run the following command in a Command Prompt to install the project dependencies

    $>(venv) pip install -r requirements.txt
  6. In the current Command Prompt, go to project's notebook folder. Run the following command to start Jupyter Lab in the notebook folder.

    $>(venv)>notebook>jupyter lab
  7. Open LD-Inflation-VS-DCA-Fund-Performance.ipynb Notebook document, then follow through each notebook cell.

    Figure-4

Note: If you are using AnaConda/MiniConda, please refer to this Conda - Managing environments document for more detail about how create and activate environment with Conda.

References

You can find more detail regarding the Data Library and related technologies for this Notebook from the following resources:

For any question related to this example or Data Library, please use the Developers Community Q&A Forum.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published