Skip to content

Instantly share code, notes, and snippets.

@svasva
Last active January 2, 2016 23:38
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save svasva/8377222 to your computer and use it in GitHub Desktop.
Save svasva/8377222 to your computer and use it in GitHub Desktop.
CoinEx API
# All timestamps are in UTC
# All currency amounts and exchange rates are multiplied by 10^8 to get rid of floating point numbers
# All API requests should contain HTTP header 'Content-type: application/json'
# Private API methods should have API-Key and API-Sign headers
# API-Key header should contain your API access key which can be generated
# at your account settings page
# API-Sign header should contain request's POST data signed by your account's
# API Secret key using HMAC-SHA512 algorithm
# PHP API client example: https://gist.github.com/erundook/8390710
# Available currencies
Availability: public
Method: GET
URL: https://coinex.pw/api/v2/currencies
Data type: Array
JSON Root key: 'currencies'
Description:
{
"id": 28 # ID for reference
, "name": "BTC" # Short name
, "desc": "Bitcoin" # Full name
, "tx_fee": 0.0001 # Withdrawal fee
, "tx_conf": 3 # Confirmations for deposits
, "hashrate": 186287759 # Pool hashrate
, "net_hashrate": null # Network hashrate (if available)
, "last_block_at": null # Timestamp for last block found by pool
, "mining_enabled": true # True if there is a pool for the currency
, "mining_url": "stratum+tcp://stratum.coinex.pw:9029" # Stratum URL for mining pool
, "mining_fee": 2 # Mining pool fee, percent
, "donations": "194nULbp8UAvtCX21fpS91Bhq7iHt2DBAD" # Donations address
, "algo": "sha256" # PoW algorithm (sha256 / scrypt)
, "diff": 1418481395.26264 # Mining difficulty
, "updated_at": "2014-01-11T20:57:37.262Z" # Timestamp for last data update
}
# Available trading pairs
Availability: public
Method: GET
URL: https://coinex.pw/api/v2/trade_pairs
Data type: Array
JSON Root key: 'trade_pairs'
Description:
{
"id": 28 # ID for reference
, "buy_fee": 0.2 # Fee for bid orders
, "sell_fee": 0.2 # Fee for ask orders
, "last_price": 2990000 # Exchange rate of the last trade
, "currency_id": 33 # Currency ID (see above)
, "market_id": 28 # Market currency ID (see above)
, "url_slug": "ltc_btc" # URL slug for reference (https://coinex.pw/trade/<URL_SLUG>)
, "rate_min": 2860050 # Minimal exchange rate within last 24 hours
, "rate_max": 3080000 # Maximal exchange rate within last 24 hours
, "currency_volume": 9403824973 # Currency trading volume within last 24 hours
, "market_volume": 279895654 # Market trading volume within last 24 hours
, "updated_at": "2014-01-11T20:57:37.262Z" # Timestamp for last data update
}
# Open orders
Availability: public
Method: GET
URL: https://coinex.pw/api/v2/orders?tradePair=<TRADE_PAIR_ID>
Data type: Array
JSON Root key: 'orders'
Description:
{
"id": 208451 # ID for reference
, "trade_pair_id": 21 # ID of trading pair
, "amount": 1000000000 # Amount of currency to be bought / sold
, "filled": 0 # Amount of currency already bought / sold
, "bid": false # Defines if order is bid or ask
, "rate": 300 # Order exchange rate
, "cancelled": false # Defines if order is cancelled
, "complete": false # Defines if order is complete
, "created_at": "2014-01-07T21:53:42.794Z" # Timestamp for order creation
, "updated_at": "2014-01-07T21:53:42.794Z" # Timestamp for last data update
}
# Last trades on market
Availability: public
Method: GET
URL: https://coinex.pw/api/v2/trades?tradePair=<TRADE_PAIR_ID>
Data type: Array
JSON Root key: 'trades'
Description:
{
"id": 137847 # ID for reference
, "created_at": "2014-01-11T09:43:32.489Z" # Timestamp when trade happened
, "bid": false # Defines if last matching order was bid or ask
, "rate": 226 # Exchange rate
, "amount": 98310852 # Currency amount
, "trade_pair_id": 21 # ID of trading pair
}
# Submit order
Availability: private
Method: POST
URL: https://coinex.pw/api/v2/orders
Data type: Object
JSON Root key: 'order'
Description:
{
"trade_pair_id": 15 # ID for trade pair
, "amount": 3251074960 # Amount of currency to buy / sell
, "bid": false # Defines if order is bid (buy) or ask (sell)
, "rate": 50004 # Exchange rate
}
Response is similar to API call for open orders list.
# Get order status
Availability: private
Method: GET
URL: https://coinex.pw/api/v2/orders/<ORDER_ID>
Data type: Array
JSON Root key: 'orders'
No post data is required (empty string is okay).
Response is similar to API call for open orders list.
# Cancel order
Availability: private
Method: POST
URL: https://coinex.pw/api/v2/orders/<ORDER_ID>/cancel
Data type: Array
JSON Root key: 'orders'
No post data is required (empty string is okay).
Response is similar to public API call for open orders list.
# List open orders
Availability: private
Method: GET
URL: https://coinex.pw/api/v2/orders/own
Data type: Array
JSON Root key: 'orders'
No post data is required (empty string is okay).
Response is similar to public API call for open orders list.
# Get account balances
Availability: private
Method: GET
URL: https://coinex.pw/api/v2/balances
Data type: Array
JSON Root key: 'balances'
No post data is required (empty string is okay).
Description:
{
"id": 5172 # ID for reference
, "currency_id": 18 # ID for currency
, "currency_name": "WDC" # Currency short name
, "amount": 19282698425 # Available balance
, "held": 0 # Amount held for open orders
, "deposit_address": "Wiw9RyYNaNGaHPb5HsmA5oWoJ8HzbZsqxh" # Deposit address for currency
, "updated_at": "2014-01-12T21:09:32.788Z" # Timestamp for last update
}
@andrewbrereton
Copy link

Your API protected by CloudFlare, so we can't talk to it.

When I make a call to /currencies, I get a CloudFlare HTML response (with a 200 OK HTTP status) that says the following:

Please turn JavaScript on and reload the page.

DDoS protection by CloudFlare

@smnvhn
Copy link

smnvhn commented Jan 27, 2014

For me it just shows Just a moment...

Copy link

ghost commented Jan 28, 2014

I'm randomly getting a "Retry later" in my JSON responses. Is there a reason for this? Is there a rate limit that I"m hitting or something?

Edit: The problem goes away when I increase the time between http requests.

@rsmeding
Copy link

rsmeding commented Feb 1, 2014

I cannot use this API. Its protected by cloudflair

@otistamp
Copy link

Not seeing a minimum for trades per currency in the API but I'm running into them. Please add trade minimums to the currency objects, otherwise great API. Thanks!

@dtbartle
Copy link

I think the trade minimum is 0.01 for all coins.

@onesweetmullet
Copy link

I am delisting Coinex from http://cryptoticker.org until API access has been restored. I repeatedly get "503" errors when trying to hit https://coinex.pw/api/v2/currencies.

@filipe3x
Copy link

file_get_contents(https://coinex.pw/api/v2/currencies): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden

the api it's broken. Fix it.

@HyperToxic33
Copy link

API is broken. Had script working, have not made code changes and now it is giving a 403 Forbidden and a CloudFlare page requesting google re-captcha.

Furthermode navigating with IE using the URL https://coinex.pw/api/v2/currencies trys to save a file instead of displaying the json.

What happened?

@HyperToxic33
Copy link

orders/own is broken too. Here is the CloudFlare Ray ID: 1008855f75d8065d

@Gontxi
Copy link

Gontxi commented Feb 23, 2014

Warning: file_get_contents(https://coinex.pw/api/v2/trades?tradePair=51) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in

@gerchicov
Copy link

explain me please how does it understand that it is me? Or does it work via browser only?

@erikmattheis
Copy link

Is it just me or does it seem to you like all numerical values are multiplied by 10^7, not 10^8 as stated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment