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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tb_duk-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 6c6b7011517bcef52c6516fdcc486bb79e5a97597f8eb35e38dbcbba4445026d
MD5 e70a4170a502bf3588f96067a5fa077c
BLAKE2b-256 c9d89673a668ae94416cf529fd6bd3293986af2abe781eb963784c0a0d649b0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for tb_duk-1.0.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: tb_duk-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 40.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5de63c7c41d57cbaa6c3c4251cade7940278ce18833ff1290e05431fd4b877f9
MD5 6901676809d4b39eb0695c3753769f41
BLAKE2b-256 4735d553cfab44e3c9da42335440db3c03ad97c64b0b39cbe86b11b71b9df9ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for tb_duk-1.0.3-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