Skip to main content

lusid-express is a python package that makes it quick and easy to get started using Lusid and Luminesce.

Project description

lusid-express

lusid-express is a python package that makes it quick and easy to get started using Lusid and Luminesce.

This repository holds the source code for lusid-express, a python package that makes it quick and easy to get started using Lusid and Luminesce. The package provides convenience in 3 distinct ways.

  1. Ease of installation of finbourne packages.
  2. %%luminesce cell magic in your local jupyter installation.
  3. Preset variables that make it possible to ommit boiler plate code.

1. Getting Started

1.1. Requirements

In order to authenticate the lusid api clients you will need to have generated a secrets file. furthermore, you will need to have an environmental variable named FBN_SECRETS_PATH set to the full path to your secrets file.

1.1.1. Environmental Variable setup

Mac OS

Assuming ~/.secret/secrets.json exists

echo 'export FBN_SECRETS_PATH="~/.secret/secrets.json"' >> ~/.zshrc

NOTE: Your secrets file needs to include the lumi api url under the key: lumiApiUrl. This url usually takes the form https://{your-domain}.lusid.com/honeycomb.

1.2. Installation

pip install -U lusid-express
python -m lusid_express --enable all

The above commands install the lusid-express package and enable enhancements to your IPython environment. If running from a virtual environment these enhancements are limited to that virtual environment. enabling magic adds the luminesce magic command. vars adds preloaded variables to IPython sessions. format adds tables with finbourne branding, as well as branded automatic rendering of lusid objects when displayed. The --disable command is available should you wish to disable these.

2. Convenience package installations

graph LR;
    lusid_express --> luminesce_sdk_preview
    lusid_express --> lusid_jam
    lusid_express --> lusid_sdk_preview
    lusid_express --> fbnlab_preview
    lusid_express --> finbourne_access_sdk
    lusid_express --> finbourne_identity_sdk
    lusid_express --> finbourne_insights_sdk_preview
    lusid_express --> finbourne_sdk_utilities
    lusid_express --> lusid_configuration_sdk_preview
    lusid_express --> lusid_drive_sdk_preview
    lusid_express --> lusid_notifications_sdk_preview
    lusid_express --> lusid_scheduler_sdk_preview
    lusid_express --> lusid_workflow_sdk_preview
    lusid_express --> lusidtools
    lusid_express --> dve_lumipy_preview

    luminesce_sdk_preview["luminesce-sdk-preview==1.14.758"]
    lusid_jam["lusid-jam==0.1.2"]
    lusid_sdk_preview["lusid-sdk-preview==1.1.120"]
    fbnlab_preview["fbnlab-preview==0.1.108"]
    finbourne_access_sdk["finbourne-access-sdk==0.0.3751"]
    finbourne_identity_sdk["finbourne-identity-sdk==0.0.2834"]
    finbourne_insights_sdk_preview["finbourne-insights-sdk-preview==0.0.763"]
    finbourne_sdk_utilities["finbourne-sdk-utilities==0.0.10"]
    lusid_configuration_sdk_preview["lusid-configuration-sdk-preview==0.1.514"]
    lusid_drive_sdk_preview["lusid-drive-sdk-preview==0.1.617"]
    lusid_notifications_sdk_preview["lusid-notifications-sdk-preview==0.1.923"]
    lusid_scheduler_sdk_preview["lusid-scheduler-sdk-preview==0.0.829"]
    lusid_workflow_sdk_preview["lusid-workflow-sdk-preview==0.1.810"]
    lusidtools["lusidtools==1.0.14"]
    dve_lumipy_preview["dve-lumipy-preview==0.1.1075"]

3. Luminesce Magic Command

3.1. Why use this?

The main motivation to use this cell magic is to enable the use of SQL jupyter cells. That is, rather than display a cell on a notebook that holds an SQL string such as:

sql_string = """
@raw_equities =
SELECT *,
    'training' as Scope,
    Currency as domCcy,
    Ticker as DisplayName
FROM @equitiesCSV
WHERE Ticker IS NOT null;
where Ticker is null
    and "type" is not "FundsIn";
SELECT *
FROM Lusid.Instrument.Equity.Writer
WHERE toWrite = @raw_equities;
"""

You would instead have a cell with pure SQL that looks like this:

%%luminesce

@raw_equities =
SELECT *,
    'training' as Scope,
    Currency as domCcy,
    Ticker as DisplayName
FROM @equitiesCSV
WHERE Ticker IS NOT null;
where Ticker is null
    and "type" is not "FundsIn";
SELECT *
FROM Lusid.Instrument.Equity.Writer
WHERE toWrite = @raw_equities;

VSCode allows the SQL auto-formatting of Jupyter cells. This query runs when the cell is excecuted.

4. Pre-loaded Variables

Enabling this feature provides the convenience of automatically loading important variables into python notebooks. This allows us to omit boler-plate code from each notebook. It also allows for reduce complexity as token management, authentication, and api client instantiations have all been abstracted away.

Variable Name Statement Description
lu import lusid as lu Main LUSID package
lm import lusid.models as lm LUSID models module
apis import lusid_express.apis as apis convenience package providing pre-authenticated api access.

Project details


Download files

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

Source Distribution

lusid_express-0.6.16.tar.gz (127.6 kB view details)

Uploaded Source

Built Distribution

lusid_express-0.6.16-py3-none-any.whl (128.8 kB view details)

Uploaded Python 3

File details

Details for the file lusid_express-0.6.16.tar.gz.

File metadata

  • Download URL: lusid_express-0.6.16.tar.gz
  • Upload date:
  • Size: 127.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for lusid_express-0.6.16.tar.gz
Algorithm Hash digest
SHA256 dee391034b0f9206c0eb6918228dc0072eda80fc25d974b679d22e50cb42aefa
MD5 c4117b4fa093c4f93a5ec1d0fb1eafc4
BLAKE2b-256 9c6a2d2443198aa5276c91e14a581d5d40f63f8ac7fe50dcd4eb9dcaf9fac3b0

See more details on using hashes here.

File details

Details for the file lusid_express-0.6.16-py3-none-any.whl.

File metadata

File hashes

Hashes for lusid_express-0.6.16-py3-none-any.whl
Algorithm Hash digest
SHA256 f486aadf2a6718a4b22f59d8f796661c86ede84ba8310351bd65d99cec5a270c
MD5 2a712b9c965703dd0b680013eb95525f
BLAKE2b-256 0999754ad0a248295ad161a64ab71a63085d3d83861ed8b94c2d34bb2e4faa60

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page