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.2.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.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for trackinsight_data_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 02c607c05f458198bb0b398a0317d406ebd607169bbcdd64c4f54383c0ec59ff
MD5 13f60f58219cba48e9fc153332376aa0
BLAKE2b-256 7023e84bc04e9fb532871936a50edd25c034dcce64e279fe3e2b13ee70a18ad9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for trackinsight_data_python-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab709802b9c87a72bf1957153e64e8c98532afdf2dac2f16e24f12ef9783a335
MD5 c181f60742fbfb7c14c27127e38877fb
BLAKE2b-256 306abc02ced465a7e717a3f9a01838d26b5dad7d5228bcccc66dd5845124e488

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