Skip to main content

No project description provided

Project description

maicoin 🪙

Python client for the MaiCoin MAX exchange. Provides a typed REST v3 client and a WebSocket stream client built on httpx, websockets, and pydantic.

📦 Installation

uv add maicoin
# or
pip install maicoin

Requires Python 3.12+.

🚀 Quick start

Set credentials in your environment (or a .env file):

MAX_API_KEY=your_key
MAX_API_SECRET=your_secret

🌐 REST

from maicoin.v3 import Client

client = Client()                  # public endpoints
client = Client(api_key=..., api_secret=...)  # private endpoints (signed)

client.ticker("btctwd")
client.accounts()
client.request("GET", "/api/v3/...", auth=True)  # raw escape hatch

[!WARNING] ⚠️ Private methods can place orders, transfer funds, take loans, and trigger withdrawals. Double-check arguments before calling state-changing methods against a live account.

📡 WebSocket

from maicoin.ws import Channel, Stream, Subscription

stream = Stream()                  # or Stream.from_env() for private channels
stream.subscribe([Subscription(channel=Channel.TICKER, market="btcusdt")])
stream.add_handler(lambda r: print(r.model_dump(exclude_none=True)))
stream.run()

Full runnable scripts: examples/rest.py, examples/websocket.py.

🛠️ Development

This repo uses uv and just:

uv sync
just         # format, lint, type-check, test
just test    # pytest with coverage

Live integration tests

Live tests call the real MAX API and are skipped unless explicitly enabled:

RUN_LIVE_TESTS=1 uv run pytest -v -s -m live tests/live
# or
just live-test

Private read-only live tests also require MAX_API_KEY and MAX_API_SECRET; just loads these from .env automatically. Set MAX_LIVE_MARKET to override the default public test market (btctwd). Destructive live tests are intentionally not implemented yet.

📚 References

📄 License

MIT

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

maicoin-0.5.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

maicoin-0.5.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file maicoin-0.5.0.tar.gz.

File metadata

  • Download URL: maicoin-0.5.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for maicoin-0.5.0.tar.gz
Algorithm Hash digest
SHA256 294cc0f951f1a7c46f5e4fb9de933e1b27870b75ae48005862c83bc7201ace5f
MD5 f2557e542006c67dd1d5a2f85555b207
BLAKE2b-256 de45aab93d4c88e6b07c50614096cc81bac373d80b710b9a685e927bc4305079

See more details on using hashes here.

File details

Details for the file maicoin-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: maicoin-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for maicoin-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a4c3110d1d48b6a05ea623017bbf32a10493abeb4d0e4c053735336c1140a2a
MD5 b9f557ecdc63729d2da5d477d263bbc5
BLAKE2b-256 7d98d3f935af62b908eb376126b9c6218cac68592c15b700ac8576135934e7b6

See more details on using hashes here.

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