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

Uploaded Python 3

File details

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

File metadata

  • Download URL: maicoin-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 6704caa9515e7d4a9adae185896fb83128efd9f67f49b9b5dd6339c9c8169f1e
MD5 663bc123bfb0514046c3b390864935ce
BLAKE2b-256 a0e8f4ba7a6d81fb41e54c6a890796c5893297a45b6bdaa4bd8fcfae0349192a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maicoin-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38414849a75eaf2b05c24e97cfc1c6baeded10cab57be0aca9a862817c9d51b3
MD5 e9b17a385c089f60191dde5845204849
BLAKE2b-256 ab7f16bbfac352e1240d409931f1158f85fc7b5c45d9704c3c05a8e4dd24f5a4

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