Skip to main content

A small CLI for checking Swissquote gold prices from the terminal.

Project description

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.

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

goldpy_cli-0.1.2.tar.gz (68.4 kB view details)

Uploaded Source

Built Distribution

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

goldpy_cli-0.1.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file goldpy_cli-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for goldpy_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 83633d817f6c7de8925a48a2fb337806f3ddfa491d643db521e1ab5a7abf265e
MD5 e043f667bf23a24c486ff50fedf169e1
BLAKE2b-256 df7188e468d9b58204a5f298956928077a0e55110b7e0ece6e9479412ce6762d

See more details on using hashes here.

Provenance

The following attestation bundles were made for goldpy_cli-0.1.2.tar.gz:

Publisher: release.yml on eivl/goldpy

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

File details

Details for the file goldpy_cli-0.1.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for goldpy_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 53dca03753bb96f521935529e8f7ef3ebccd471d5442551aebb4e63342e4aea7
MD5 71cccdbc036d99627c201192ef0c525b
BLAKE2b-256 813d07bb791d3159a8fe1fdfcb4928ee6d13ef4edb0ecb2efb7da306b2174975

See more details on using hashes here.

Provenance

The following attestation bundles were made for goldpy_cli-0.1.2-py3-none-any.whl:

Publisher: release.yml on eivl/goldpy

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