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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trackinsight_data_python-0.1.3.tar.gz.
File metadata
- Download URL: trackinsight_data_python-0.1.3.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d5f480407381dff0c5c16f31144ce4ee7f971f94ce7dde6dd2edb73bbe90055
|
|
| MD5 |
de74d33001729b7e41fb68e8c6c09526
|
|
| BLAKE2b-256 |
4800279aa303d6ec6d7ccc9da5446490f9ccc9e6b6e4b5d6cd6692ccc921ff4e
|
File details
Details for the file trackinsight_data_python-0.1.3-py3-none-any.whl.
File metadata
- Download URL: trackinsight_data_python-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e366d470cf020d30ece9b6e3925255c8bd32e685cd32ad71d267daa94870b84d
|
|
| MD5 |
1082c97db8265fafa595e2b50700c728
|
|
| BLAKE2b-256 |
340e8b10975944b59da5d910c7e4601055c36956f3965b2a10f492352060cc32
|