Skip to main content

Python API Client Library for GMO Coin / GMOコイン用のPython APIクライエントライブラリ

Project description

GMO Coin Python Client Library

A Python client library for interacting with the GMO Coin cryptocurrency exchange API.

📘 GMO Coin API Coverage

Usage

Set GMO_API_KEY and GMO_SECRET_KEY in your environment for private API calls.

Public endpoints

from gmocoin_client import Client

client = Client()

status = client.get_status()
ticker = client.get_ticker("BTC")
orderbooks = client.get_orderbooks("BTC")

Private endpoints (with env vars)

from gmocoin_client import Client

with Client.from_env() as client:
    assets = client.get_assets()
    margin = client.get_margin()

Place an order

from gmocoin_client import Client

with Client.from_env() as client:
    order = client.create_order(
        symbol="BTC_JPY",
        side="BUY",
        execution_type="LIMIT",
        time_in_force="FAS",
        price="430001",
        size="0.02",
    )

WebSocket access token

from gmocoin_client import Client

with Client.from_env() as client:
    token = client.ws_auth_create()

Error handling

from gmocoin_client import GmoCoinApiError, Client, GmoCoinHttpError

client = Client()

try:
    client.get_ticker("BTC")
except GmoCoinApiError as exc:
    print(exc)
except GmoCoinHttpError as exc:
    print(exc)

Live trading tests (local-only)

Live tests are excluded by default. To run them locally, opt in and set required environment variables (see .env.example). Tests load .env automatically:

export GMO_LIVE_TESTS=true
export GMO_API_KEY="your_api_key"
export GMO_SECRET_KEY="your_secret_key"
export GMO_LIVE_SYMBOL="BTC"
export GMO_LIVE_SIZE="0.0001"
export GMO_LIVE_BUY_EXECUTION_TYPE="MARKET"
export GMO_LIVE_SELL_EXECUTION_TYPE="MARKET"

Then run:

pytest -m live

Public REST API

Category Endpoint / Function Path Implemented
Exchange status /public/v1/status
Latest ticker (rate) /public/v1/ticker
Order book /public/v1/orderbooks
Trades /public/v1/trades
K-Line (OHLCV) /public/v1/klines
Trading rules / symbols /public/v1/symbols

Private REST API

Category Endpoint / Function Path Implemented
Collateral / margin summary /private/v1/account/margin
Asset balances /private/v1/account/assets
Trading volume info /private/v1/account/tradingVolume
JPY deposit history /private/v1/account/fiatDeposit/history
JPY withdrawal history /private/v1/account/fiatWithdrawal/history
Crypto deposit history /private/v1/account/deposit/history
Crypto withdrawal history /private/v1/account/withdrawal/history
Query orders /private/v1/orders
Active orders /private/v1/activeOrders
Executions /private/v1/executions
Latest executions /private/v1/latestExecutions
Open positions /private/v1/openPositions
Position summary /private/v1/positionSummary
Internal transfer /private/v1/account/transfer
Place order /private/v1/order (POST)
Change order /private/v1/changeOrder
Cancel order /private/v1/cancelOrder
Cancel multiple orders /private/v1/cancelOrders
Cancel bulk orders /private/v1/cancelBulkOrder
Cancel all orders /private/v1/cancelAll
Close (settlement) order /private/v1/closeOrder
Bulk close orders /private/v1/closeBulkOrder
Change loss-cut price /private/v1/changeLosscutPrice

Public WebSocket API

Category Endpoint / Function Path Implemented
Subscribe: ticker updates wss://api.coin.z.com/ws/public (channel=ticker)
Subscribe: order book wss://api.coin.z.com/ws/public (channel=orderbooks)
Subscribe: trades wss://api.coin.z.com/ws/public (channel=trades)

Private WebSocket API

Category Endpoint / Function Path Implemented
Obtain access token /private/v1/ws-auth (POST)
Extend access token /private/v1/ws-auth (PUT)
Revoke access token /private/v1/ws-auth (DELETE)
Subscribe: order events wss://api.coin.z.com/ws/private (channel=orderEvents)
Subscribe: execution events wss://api.coin.z.com/ws/private (channel=executionEvents)
Subscribe: position events wss://api.coin.z.com/ws/private (channel=positionEvents)
Subscribe: position summary events wss://api.coin.z.com/ws/private (channel=positionSummaryEvents)

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

gmocoin_client-0.2.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

gmocoin_client-0.2.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file gmocoin_client-0.2.1.tar.gz.

File metadata

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

File hashes

Hashes for gmocoin_client-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d287b1c98ee2eb323ca8e05f595ef20cdc831060dbf26230f742097c89f8fe2a
MD5 5d13816084a920b5d6fc140e0ecb46c3
BLAKE2b-256 ce1ad9be02800fdb0d2ea121b4886e199b1711d67e9be79fb0773a2b8987f4b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmocoin_client-0.2.1.tar.gz:

Publisher: publish.yml on Shion1305/gmocoin-client

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

File details

Details for the file gmocoin_client-0.2.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for gmocoin_client-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c53d18cf61e1667204956875c30a8065e9df6da016493bc21bca11494bdee023
MD5 392847bc8eedcf0136c597f6d6bed2c6
BLAKE2b-256 be07dda260a182afc506c1c996c2d14c24111e3146cf20f589baef91beb37996

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmocoin_client-0.2.1-py3-none-any.whl:

Publisher: publish.yml on Shion1305/gmocoin-client

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