Skip to main content

Add your description here

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 GmoCoinClient

client = GmoCoinClient()

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

Private endpoints (with env vars)

from gmocoin_client import GmoCoinClient

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

Place an order

from gmocoin_client import GmoCoinClient

with GmoCoinClient.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 GmoCoinClient

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

Error handling

from gmocoin_client import GmoCoinApiError, GmoCoinClient, GmoCoinHttpError

client = GmoCoinClient()

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.1.0.tar.gz (11.0 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.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gmocoin_client-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 5a04ab5b75c7a8e9a0cad6307574029fa4850a1a3da66441ac6bc61802cf6a1a
MD5 5e3e843d2fb4515e23193acfcac9eb96
BLAKE2b-256 1958624f0bf18c5f06e3a68e180c764e1212c83e6d49d6a89c347c8ef8c114cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmocoin_client-0.1.0.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: gmocoin_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27e1883391cf900c0d4ffe808698d460a73b3a365e10d2c8244af040bd5ff5a6
MD5 ce702650b882c173f5a398162257428e
BLAKE2b-256 38b7839a72512235eaba7b3f75239bf3b09eed2ddc99b05a1c3e997168b891cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for gmocoin_client-0.1.0-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