English
Official Announcement News FAQs About Us Terms of Use Privacy Policy Contact Service APIDocument Fee

API

Domain Name:https://api.coinegg.com

一、API Instructions

1、Request Process

2、Safety Authentication

3、API_Url

3.1Latest market - Ticker

3.2Market Depth - Depth

3.3Market transactions - Orders

3.4Account information - Account Balance

3.5Trade List - Trade_list

3.6Trade View - Trade_view

3.7Trade_Cancel - Trade_cancel

3.8Trade_Add - Trade_add

4.Error Code Table

二、API DEMO

一、API Instructions

1、Request Process

1.1 Create request data, user data. Generate signature and data package to be send to CoinEgg server

1.2 Send request data, data package to CoinEgg by http request: "POST/GET"

1.3 CoinEgg server will process the request after safety check CoinEgg

1.4 CoinEgg returns data in JSON format, refer to 3 and 4 for detailed format and error code

1.5 Process the returned data

2、Safety Authentication

All private API will be verified

Go to Finance->Api, click 'apply', get private key and public key, private key will not be stored, once lost can not be recovered

Important Note: Do not reveal to anybody your keys. They are as important as your password

2.Signature Process

private api needs to verify the signature, example:

$param = array(

amount => 1,

price => 10000,

type => 'buy',

nonce => 141377098123

key => 5zi7w-4mnes-swmc4-egg9b-f2iqw-396z4-g541b

signature => 459c69d25c496765191582d9611028b9974830e9dfafd762854669809290ed82

);

nonce -- Can be understood as an increasing integer ,http://zh.wikipedia.org/wiki/Nonce

key -- Public key

signature -- Parameters like "amount", "price", "type", "nonce", "key" will be combined by '&' to create a new string, encrypt the new string by Sha256 algorithm, key is md5(private key)

3、API_Url

Ticker

Path:/api/v1/ticker/

Request method:GET

Parameters

coin - eth

Return JSON dictionary

high - represents highest price

low - represents lowest price

buy - represents bid price one

sell - represents ask price one

last - represents latest price

vol - represents last 24 hour trade volume

Return:

{"high":22,"low":20,"buy":1.879,"sell":0,"last":38800,"vol":283.954}

Depth

Market Depth, Return data is large, Do not frequently use。

Path:/api/v1/depth/

Request method:GET

Parameters

coin - eth

Return JSON dictionary

asks - represents sell orders, format is: [price, quantity],the orders are ranked according to price from high to low.

bids - represents buy orders, format is: [price, quantity],the orders are ranked according to price from high to low.

Return:

{"asks":[[70000,5],[69000,0.48],[67000,0.9999],[64498,0.02],[61160,0.017],[60980,0.03],[60000,0.1924],[55900,1.4],[55100,2],[55044,0.019],[54500,0.7836],[54190,1],[52500,5.8645],[51500,5.6594],[51490,0.02],[47500,7],[45999,0.0244],[44585,0.024],[43000,10],[41700,10],[41300,6],[40900,10],[40500,6],[40125,10.0277],[40100,5],[40089,0.509],[39800,14.7132],[39799,0.0695],[39798,5],[39700,2.89],[39000,0.209]],"bids":[[38300,1.879],[38100,1.0078],[38000,1.24],[37700,4.706],[37600,3.8313],[37001,0.146],[36999,5.8],[36400,5],[36200,1.3314],[36002,2],[36000,1.568],[35501,0.282],[35500,9.9],[35200,5.6],[35010,10],[35001,0.03],[34600,7.6],[34500,5.505],[34200,9.3],[34000,6.4],[33800,4.434],[33333,3],[32830,0.0305],[31800,2],[31500,3.018],[30001,0.03],[30000,11.48],[28000,10],[25001,0.04],[22000,5.863],[20001,0.05],[460,10]]}

Orders

Return the most recent 100 transactions, Orders are listed by value of "date" and "tid" DESC

Path:/api/v1/orders/

Request method:GET

Parameters

coin - eth

Return JSON dictionary

date - timestamp

price - price

amount - amount

tid - Orders ID

type - buy or sell

Return:

[{"date":"0","price":3,"amount":0.1,"tid":"1","type":"buy"},{"date":"0","price":32323,"amount":2,"tid":"2","type":"sell"},{"date":"0","price":32,"amount":432,"tid":"3","type":"sell"},{"date":"0","price":323,"amount":2,"tid":"4","type":"sell"},{"date":"0","price":2100,"amount":0.3,"tid":"5","type":"buy"}]

Readonly

Account Balance

Account information

Path:/api/v1/balance/

Request method:POST

Parameters

key - API key

signature - signature

nonce - nonce

Return JSON dictionary

eth_balance - Total ETH

btc_balance - Total BTC

eth_lock - Lock ETH

btc_lock - Lock BTC

Return:

{"result":true,"data":{"uid":"1","xas_balance":1,"xas_lock":0,"eth_balance":1,"eth_lock":0,"btc_balance":1,"btc_lock":0}}

Trade_list

return trade list by timestamp or trade type

Path:/api/v1/trade_list/

RRequest method:POST

Parameters

key - API key

signature - signature

nonce - nonce

since - unix timestamp(utc timezone) default == 0

coin - eth

type - [open or all]

Return JSON dictionary

id - ID

coin - eth

datetime - date and time

type - "buy" or "sell"

price - price

amount_original - total number

amount_outstanding - The number of remaining

Return:

{"result":true,"data":[{"id":"28","datetime":"2016-10-26 14:47:54","type":"sell","price":0.000123,"amount_original":1213,"amount_outstanding":1213}]}

Trade_view

Path:/api/v1/trade_view/

Request method:POST

Parameters

key - API key

signature - signature

nonce - nonce

id - ID

coin - eth

Return JSON dictionary

id - ID

datetime - format:YYYY-mm-dd HH:ii:ss)

type - "buy" or "sell"

price - price

amount_original - total number

amount_outstanding - The number of remaining

status - Order status:no, part, cancelled, all

Return:

{"result":true,"data":{"id":28,"datetime":"2016-10-26 14:47:54","type":"sell","price":0.000123,"amount_original":1213,"amount_outstanding":1213,"status":"open"}}

Full

Trade_cancel

Path:/api/v1/trade_cancel/

Request method:POST

Parameters

key - API key

signature - signature

nonce - nonce

id - ID

coin - eth

Return JSON dictionary

result - true(success), false(fail)

id - ID

Return:

{"result":true, "id":"11"}

Trade_add

Path:/api/v1/trade_add/

Request method:POST

Parameters

key - API key

signature - signature

nonce - nonce

amount - Total number

price

type - buy or sell

coin - eth

Return JSON dictionary

id - ID

result - true(success), false(fail)

Return:

{"result":true, "id":"11"}

数据类型

*_balance - float

id - int

datetime - datetime

since - int

type - string

price - float

amount* - float

status - string

trade_id - int

fee - float

result - bool

message - string

address - string

DEMO

Common Error Code and Solution

Error Code Solution
100 Required parameters can not be empty
101 Illegal parameter
102 coin does not exist
103 Key does not exist
104 Signature does not match
105 Insufficient permissions
106 Request expired(nonce error)
200 Lack of balance
201 Too small for the number of trading
202 Price must be in 0 - 1000000
203 Order does not exist
204 Pending order amount must be above 0.001 BTC
205 Restrict pending order prices
206 Decimal place error
401 System error
402 Requests are too frequent
403 Non-open API
404 IP restriction does not request the resource
405 Currency transactions are temporarily closed

Domain Name:https://api.coinegg.com