A small CLI for checking Swissquote gold prices from the terminal.
Project description
goldpy
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83633d817f6c7de8925a48a2fb337806f3ddfa491d643db521e1ab5a7abf265e
|
|
| MD5 |
e043f667bf23a24c486ff50fedf169e1
|
|
| BLAKE2b-256 |
df7188e468d9b58204a5f298956928077a0e55110b7e0ece6e9479412ce6762d
|
Provenance
The following attestation bundles were made for goldpy_cli-0.1.2.tar.gz:
Publisher:
release.yml on eivl/goldpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goldpy_cli-0.1.2.tar.gz -
Subject digest:
83633d817f6c7de8925a48a2fb337806f3ddfa491d643db521e1ab5a7abf265e - Sigstore transparency entry: 1086038208
- Sigstore integration time:
-
Permalink:
eivl/goldpy@5b8c7b7b87eb5622cd4578e509c32767aae89123 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/eivl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5b8c7b7b87eb5622cd4578e509c32767aae89123 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53dca03753bb96f521935529e8f7ef3ebccd471d5442551aebb4e63342e4aea7
|
|
| MD5 |
71cccdbc036d99627c201192ef0c525b
|
|
| BLAKE2b-256 |
813d07bb791d3159a8fe1fdfcb4928ee6d13ef4edb0ecb2efb7da306b2174975
|
Provenance
The following attestation bundles were made for goldpy_cli-0.1.2-py3-none-any.whl:
Publisher:
release.yml on eivl/goldpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goldpy_cli-0.1.2-py3-none-any.whl -
Subject digest:
53dca03753bb96f521935529e8f7ef3ebccd471d5442551aebb4e63342e4aea7 - Sigstore transparency entry: 1086038239
- Sigstore integration time:
-
Permalink:
eivl/goldpy@5b8c7b7b87eb5622cd4578e509c32767aae89123 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/eivl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5b8c7b7b87eb5622cd4578e509c32767aae89123 -
Trigger Event:
push
-
Statement type: