coinexpy – Python wrapper for Coinex APIs

Through coinexpy you can simply buy or sell crypto in your Coinex account

Features

  • place limit order
  • place market order
  • get balance
  • get price

Install

pip install coinexpy

Example

You can create API key and get your access_id & secret_key here

<div class="highlight highlight-source-python position-relative" data-snippet-clipboard-copy-content="from coinexpy.coinex import Coinex

coinex = Coinex('’, ”)

balance = coinex.get_balance()
usdt_balance = coinex.get_available(‘USDT’)
btc_price = coinex.get_last_price(‘BTCUSDT’)

coinex.market_buy(‘BTCUSDT’, 100) # buy 100$ worth of bitcoin with market price
coinex.market_sell(‘BTCUSDT’, 100) # sell 100$ worth of BTC

coinex.limit_buy(‘BTCUSDT’, 100, 50000) # place a limit buy order on bitcoin with amount=100$
result = coinex.limit_sell(‘BTCUSDT’, 100, 50000)

coinex.cancel_order(result[‘id’], result[‘market’])
“>

from coinexpy.coinex import Coinex


coinex = Coinex('<your_access_id>', '<your_secret_key>')

balance = coinex.get_balance()
usdt_balance = coinex.get_available('USDT')
btc_price = coinex.get_last_price('BTCUSDT')

coinex.market_buy('BTCUSDT', 100)  # buy 100$ worth of bitcoin with market price
coinex.market_sell('BTCUSDT', 100)  # sell 100$ worth of BTC

coinex.limit_buy('BTCUSDT', 100, 50000) # place a limit buy order on bitcoin with amount=100$
result = coinex.limit_sell('BTCUSDT', 100, 50000)

coinex.cancel_order(result['id'], result['market'])