Skip to main content

goldpy

Tests PyPI License: MIT

goldpy is a command line tool for people who want a fast answer to a simple question: what is gold trading at right now?

I wanted something small, readable, and honest about the data it shows. The CLI pulls live quote data from Swissquote, validates the response with Pydantic, and prints either terminal-friendly output or structured JSON.

The default behavior uses an aggregate quote strategy. It finds the best bid and best ask across the returned quote sources and profiles, then calculates a mid price from those values. If you want something more specific, you can filter by platform, spread profile, or switch selection mode.

What it does

  • Fetches live precious metal quotes from Swissquote
  • Defaults to XAU/USD
  • Supports other instrument pairs like XAU/EUR
  • Prints either readable terminal output or JSON
  • Lets you inspect available platforms and spread profiles
  • Ships as a normal Python package managed with uv

Installation

For local development:

uv sync --group dev

Once published to PyPI, the intended install will be:

uv tool install goldpy-cli

Usage

Basic quote:

uv run goldpy price

JSON output:

uv run goldpy price --json

Different pair:

uv run goldpy price --pair XAU/EUR

Specific source options:

uv run goldpy price --platform SwissquoteCapitalMarkets --spread-profile prime

List available platforms and spread profiles for a pair:

uv run goldpy price --list-options

Use the tightest single quote instead of the aggregate view:

uv run goldpy price --mode tightest

Development

Run tests:

uv run --group dev pytest

Run coverage:

uv run --group dev coverage run -m pytest
uv run --group dev coverage report -m

The test suite is configured to require 100% coverage.

Documentation

This repository now includes a Sphinx setup that uses Markdown via MyST, so you do not need to write reStructuredText.

Build the docs locally:

uv sync --group dev --group docs
uv run --group docs sphinx-build -b html docs docs/_build/html

The project also includes a .readthedocs.yaml file for publishing on Read the Docs.

Releases

This project publishes from Git tags that match v*, for example v0.1.0.

Typical release flow:

uv version --bump patch
git commit -am "Bump version to $(uv version --short)" -m "Co-authored-by: OpenAI Codex <codex@openai.com>"
git tag "v$(uv version --short)"
git push origin main --tags

The GitHub Actions release workflow builds the sdist and wheel, then publishes them to PyPI using trusted publishing via pypa/gh-action-pypi-publish. It also checks that the pushed tag exactly matches the version declared in pyproject.toml.

Versioning

goldpy uses straightforward semantic versioning:

  • Patch releases for fixes and small internal improvements
  • Minor releases for new CLI options or behavior that stays backward compatible
  • Major releases for breaking CLI or output changes

License

MIT. See LICENSE.

Release files for goldpy-cli 0.1.2

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

Source distribution (sdist)

Source distribution for goldpy-cli 0.1.2
File Size Uploaded
goldpy_cli-0.1.2.tar.gz 68.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for goldpy-cli 0.1.2
File Interpreter ABI Platform
goldpy_cli-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 79.6 kB

Release files / goldpy_cli-0.1.2.tar.gz

Download URL goldpy_cli-0.1.2.tar.gz
Size 68.4 kB
Tags Source
SHA-256 checksum
How to use checksums
83633d817f6c7de8925a48a2fb337806f3ddfa491d643db521e1ab5a7abf265e
BLAKE2b-256 checksum
How to use checksums
df7188e468d9b58204a5f298956928077a0e55110b7e0ece6e9479412ce6762d
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 Mar 11, 2026.

Transparency log

Release files / goldpy_cli-0.1.2-py3-none-any.whl

Download URL goldpy_cli-0.1.2-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53dca03753bb96f521935529e8f7ef3ebccd471d5442551aebb4e63342e4aea7
BLAKE2b-256 checksum
How to use checksums
813d07bb791d3159a8fe1fdfcb4928ee6d13ef4edb0ecb2efb7da306b2174975
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 Mar 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

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