Skip to main content

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_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.

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

tb_duk-1.0.4.tar.gz (76.8 kB view details)

Uploaded Source

Built Distribution

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

tb_duk-1.0.4-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

Details for the file tb_duk-1.0.4.tar.gz.

File metadata

  • Download URL: tb_duk-1.0.4.tar.gz
  • Upload date:
  • Size: 76.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tb_duk-1.0.4.tar.gz
Algorithm Hash digest
SHA256 ee25e97b2f41e82b980d1cf8c0e0d78a8b6687411393a47728b5de7fd9151dab
MD5 c13980352d7afb863eb1cec4c36a3310
BLAKE2b-256 e69f92c5d8375f203433146bd5abf9db309bad1603cd02fbf5b590fa1b7df2d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tb_duk-1.0.4.tar.gz:

Publisher: publish.yml on rtrimble13/duk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tb_duk-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: tb_duk-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tb_duk-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f7d7a15778e3454476d4eecce4f11e5c4cf8be8ffed24a9788aceb4991e9799e
MD5 accca803948e9baabf82c125be64ffa2
BLAKE2b-256 19a595342bae0b8cf8d808ce0300e84e571292709ea60edadd88d33e36ed76b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for tb_duk-1.0.4-py3-none-any.whl:

Publisher: publish.yml on rtrimble13/duk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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