A CLI tool and library for downloading markets and financial data through various APIs
Project description
duk
A CLI tool and library for downloading markets and financial data through various APIs.
Installation
Using pip
pip install tb-duk
From source
git clone https://github.com/rtrimble13/duk.git
cd duk
make install
Configuration
duk uses a configuration file located at ~/.dukrc. A template configuration file is provided in etc/dukrc.
To set up your configuration:
cp etc/dukrc ~/.dukrc
# Edit ~/.dukrc with your preferred settings
Configuration Options
-
[api] section
fmp_key: API key for Financial Modeling Prep- Can also be set via the
FMP_API_KEYenvironment variable (takes precedence over config file)
- Can also be set via the
-
[general] section
default_output_dir: Default directory for output files (default:var/duk)default_output_type: Default output format, eithercsvorjson(default:csv)log_level: Logging level -debug,info,warning,error, orcritical(default:info)log_dir: Directory for log files (default:var/duk/log)
Usage
CLI Usage
# Display help
duk --help
# Use with custom config file
duk --config /path/to/config --help
Library Usage
duk can be used as a Python library to fetch financial data programmatically.
Get Historical Price Data
from duk import get_price_history
# Get daily price data for a date range
df = get_price_history(
api_key="your_api_key",
symbol="AAPL",
start_date="2023-01-01",
end_date="2023-12-31"
)
print(df.head())
For more examples and detailed documentation, see doc/get_price_history.md.
Development
Prerequisites
- Python 3.9 or higher
- conda (optional, for environment management)
Setup Development Environment
# Using make (recommended)
make build
# Or using pip directly
pip install -e .[dev]
Running Tests
make test
Linting
make fmt
Building Documentation
make doc
Creating Distribution
make dist
Project Structure
src/duk/: Source codetest/: Unit testsdoc/: Documentationetc/: Configuration templatesvar/: Default output and log directory
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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 tb_duk-1.1.0.tar.gz.
File metadata
- Download URL: tb_duk-1.1.0.tar.gz
- Upload date:
- Size: 79.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
857e770344b27ecd042fe324e303cd7da53c84196a35b15db2d236e50e11125f
|
|
| MD5 |
dabbd2143889d5d3c87a3313f416f616
|
|
| BLAKE2b-256 |
fa68ba9b1662e980e745fe605e0bf5de3ef036f6a1816f2ba6c6ff0be6d74173
|
Provenance
The following attestation bundles were made for tb_duk-1.1.0.tar.gz:
Publisher:
publish.yml on rtrimble13/duk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tb_duk-1.1.0.tar.gz -
Subject digest:
857e770344b27ecd042fe324e303cd7da53c84196a35b15db2d236e50e11125f - Sigstore transparency entry: 805696388
- Sigstore integration time:
-
Permalink:
rtrimble13/duk@5a6b475b8ab66dea8c6b4e68489e87105f4f70f6 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/rtrimble13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5a6b475b8ab66dea8c6b4e68489e87105f4f70f6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tb_duk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: tb_duk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1d97ef783ee10d750985358204ea10319a628f9ab4aebe0f02a16697cedb6ca
|
|
| MD5 |
711c83b8c3eb76a3c985a873733cd556
|
|
| BLAKE2b-256 |
230c76e1dca81dbf1935ecc65ea4be9866c3215e1f4a457f719f2912b4d68716
|
Provenance
The following attestation bundles were made for tb_duk-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on rtrimble13/duk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tb_duk-1.1.0-py3-none-any.whl -
Subject digest:
e1d97ef783ee10d750985358204ea10319a628f9ab4aebe0f02a16697cedb6ca - Sigstore transparency entry: 805696457
- Sigstore integration time:
-
Permalink:
rtrimble13/duk@5a6b475b8ab66dea8c6b4e68489e87105f4f70f6 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/rtrimble13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5a6b475b8ab66dea8c6b4e68489e87105f4f70f6 -
Trigger Event:
push
-
Statement type: