Skip to main content

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_KEY environment variable (takes precedence over config file)
  • [general] section

    • default_output_dir: Default directory for output files (default: var/duk)
    • default_output_type: Default output format, either csv or json (default: csv)
    • log_level: Logging level - debug, info, warning, error, or critical (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 code
  • test/: Unit tests
  • doc/: Documentation
  • etc/: Configuration templates
  • var/: Default output and log directory

License

MIT License - see LICENSE file for details.

Metadata

Release files for tb-duk 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tb-duk 1.1.0
File Size Uploaded
tb_duk-1.1.0.tar.gz 79.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tb-duk 1.1.0
File Interpreter ABI Platform
tb_duk-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 121.6 kB

Release files / tb_duk-1.1.0.tar.gz

Download URL tb_duk-1.1.0.tar.gz
Size 79.9 kB
Tags Source
SHA-256 checksum
How to use checksums
857e770344b27ecd042fe324e303cd7da53c84196a35b15db2d236e50e11125f
BLAKE2b-256 checksum
How to use checksums
fa68ba9b1662e980e745fe605e0bf5de3ef036f6a1816f2ba6c6ff0be6d74173
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.

Transparency log

Release files / tb_duk-1.1.0-py3-none-any.whl

Download URL tb_duk-1.1.0-py3-none-any.whl
Size 41.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1d97ef783ee10d750985358204ea10319a628f9ab4aebe0f02a16697cedb6ca
BLAKE2b-256 checksum
How to use checksums
230c76e1dca81dbf1935ecc65ea4be9866c3215e1f4a457f719f2912b4d68716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page