Skip to main content

A library to load data from the Trackinsight API

Project description

trackinsight-data-python

Installation

uv init
uv add trakinsight-data-python
uv add dotenv # needed to load environment variables
uv add polars # needed to manipulate dataframes

Setup the environment variables

Some variables are read from the environment. We recommend managing environment variables in a local .env file and loading it via the dotenv library

# .env
TRACK_API_KEY=YOUR_KEY_HERE # your API key
TRACK_API_DL_WORKERS=10 # number of parallel threads when downloading data
TRACK_API_STORAGE=trackinsight_data # local folder to use when storing data on disk
TRACK_API_VERIFY_CERT=True # Set to False if certificate validation is not possible in you environment

Usage

import polars as pl
import trackinsight_data_python as API
from dotenv import load_dotenv
load_dotenv(override=True)

ccy='usd'
metadata= API.getMetadata()
stamp = metadata["reportsAsOf"][ccy][-1] # get latest stamp for reports

reports = API.getReports(ccy=ccy,stamp=stamp) # reports is a Polars DataFrame, you can use .to_pandas() to convert it to a Pandas DataFrame

nuclear_etfs = reports.filter(pl.col('class_theme').list.join(';') =='Nuclear Energy')

ids = nuclear_etfs["share_id"].to_list()

usd_timeseries = API.getTimeseries(ids=ids,start='2024-01-01',end=None,ccy=ccy)

holdings = API.getHoldings(ids=ids)

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

trackinsight_data_python-0.1.3.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

trackinsight_data_python-0.1.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file trackinsight_data_python-0.1.3.tar.gz.

File metadata

File hashes

Hashes for trackinsight_data_python-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3d5f480407381dff0c5c16f31144ce4ee7f971f94ce7dde6dd2edb73bbe90055
MD5 de74d33001729b7e41fb68e8c6c09526
BLAKE2b-256 4800279aa303d6ec6d7ccc9da5446490f9ccc9e6b6e4b5d6cd6692ccc921ff4e

See more details on using hashes here.

File details

Details for the file trackinsight_data_python-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for trackinsight_data_python-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e366d470cf020d30ece9b6e3925255c8bd32e685cd32ad71d267daa94870b84d
MD5 1082c97db8265fafa595e2b50700c728
BLAKE2b-256 340e8b10975944b59da5d910c7e4601055c36956f3965b2a10f492352060cc32

See more details on using hashes here.

Supported by

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