Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Cannot retrieve latest commit at this time.
0 contributors

Users who have contributed to this file

494 lines (363 sloc) 12.9 KB

REST Market and Transaction Interface

Essential information

1. API Request Domain Name:https://api.coinegg.im

2. Request process description

  • The request data is constructed and the user data is generated by the program according to the interface rules provided by COINEGG, and the data set to be transmitted to CoinEgg is generated.
  • Send request data and transfer the constructed data set to CoinEgg by POST/GET submission.
  • CoinEgg processes the request data. After the server receives the request, it will first check the security. After the verification, it will process the sent request.
  • Return the response result data, CoinEgg feedback the response results to users in JSON format, specific response format, error code refers to the interface section;
  • Processing the returned data;

3. Safety certification

  • All private APIs need to be certified

  • Api's application can go to the Finance Center - > API and get the private key and public key. The private key CoinEgg will not be stored and will not be retrieved once lost.

    Note: Don't disclose these two parameters to anyone. It's as important as your password.

4. Signature mechanism

​ Each request to the private API requires verification of the signature. Examples of parameters sent are as follows

$param = [
	'amount' => 1,
	'price' => 10000,
	'type' => 'buy',
	'nonce' => 141377098123,
	'key' => '5zi7w-4mnes-swmc4-egg9b-f2iqw-396z4-g541b',
	'signature' => '459c69d25c496765191582d9611028b9974830e9dfafd762854669809290ed82'
];
  1. Nonce can be understood as an incremental integer:http://en.wikipedia.org/wiki/Nonce
  2. Key is the applied public key
  3. Signature is a signature, which uses the'&'character to stitch the parameters together (there is no'&' at the end of the string) in the form of key = value. It uses MD5 (private key) as the key and stitches the string as the value to encrypt the value obtained by sha256 algorithm.

Open API interface

1. Aggregate market(Ticker)

link

GET /api/v1/ticker/region/{region}?coin={coin}

Request parameters

parameters example Explain
region btc Trading area, optional parameters:btc / usdt / eth / usc
coin xrp Currency Code Of Transaction

Return parameter

parameters Explain
high Highest price
low Minimum price
buy Buy one price
sell Selling price
last Recent closing price
vol volume

Return example

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

2. Market depth(Depth)

Explain

  • Returning to all market depths, this response will have a large amount of data, so do not call frequently.

link

GET /api/v1/depth/region/{region}?coin={coin}

Request parameters

parameters example Explain
region btc Trading area, optional parameters:btc / usdt / eth / usc
coin xrp Currency Code Of Transaction

Return parameter

parameters Explain
asks Payment by commission [price, quantity by commission], price ranking from high to low
bids Selling order [price, quantity], price ranking from high to low

Return example

{
    "asks":[
        [
            70000,
            5
        ],
        [
            69000,
            0.48
        ]
    ],
    "bids":[
        [
            38300,
            1.879
        ],
        [
            38100,
            1.0078
        ]
    ]
}

3. Transaction record(Trade)

Explain

  • Return to 100 recent market transactions, in reverse chronological order, this response will have a large amount of data, so do not call frequently.

link

GET /api/v1/orders/region/{region}?coin={coin}

Request parameters

parameters example Explain
region btc Trading area, optional parameters:btc / usdt / eth / usc
coin xrp Currency Code Of Transaction

Return parameter

parameters Explain
date time stamp
price Transaction price
amount Transaction volume
tid Transaction ID
type Transaction type

Return example

[
    {
        "date":"0",
        "price":3,
        "amount":0.1,
        "tid":"1",
        "type":"buy"
    },
    {
        "date":"0",
        "price":32323,
        "amount":2,
        "tid":"2",
        "type":"sell"
    }
]

4. K-line data(Kline)

Explain

  • Returns 1 minute K-line data for a specified period of time

link

GET /api/v1/kline/region/{region}?coin={coin}

Request parameters

parameters example Explain
region btc Trading area, optional parameters:btc / usdt / eth / usc
coin xrp Currency Code Of Transaction
since 1530374400 The data returned by the start timestamp is since start, data within an hour

Return parameter

[
    [
        "timestamp",
        "open",
        "high",
        "low",
        "collect",
        "volume"
    ]
]

Return example

[
    [
        "1530374400",
        "449.9361000000",
        "450.6376000000",
        "449.5974000000",
        "450.6376000000",
        "5.5848000000"
    ]
]

Account interface

1. Account information(Account Balance)

link

POST /api/v1/balance/

Request parameters

parameters Explain
key API key
signature signature
nonce nonce

Return parameter

parameters Explain
eth_balance ETH total balance
eth_lock ETH frozen balance

Return example

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

2. View the current bills of account(Trade_list)

Explain

  • After you specify the time, the bill can be queried according to the type, such as checking the bill in progress and all the bills.

link

POST /api/v1/trade_list/region/{region}

Request parameters

parameters example Explain
key API key
signature signature
nonce nonce
region btc Trading area, optional parameters:btc / usdt / eth / usc
since 1530374400 Unix timestamp, if all values are returned for 0
coin xrp Currency Code Of Transaction
type open Hanging list type (open: hanging list / all: all hanging list)

Return parameter

parameters Explain
id List ID
coin Currency Code Of Transaction
datetime List time
type Type of list
price Price
amount_original Order quantity
amount_outstanding Current Residual Quantity

Return example

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

3. Query order details

link

POST /api/v1/trade_view/region/{region}

Request parameters

parameters example Explain
key API key
signature signature
nonce nonce
region btc Trading area, optional parameters:btc / usdt / eth / usc
id List ID
coin xrp Currency Code Of Transaction

Return parameter

parameters Explain
id List ID
datetime List time
type Type of list
price price
amount_original Order quantity
amount_outstanding Current Residual Quantity
status Status: new, open, cancelled, closed.

Return example

{
    "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"
    }
}

4.Cancellation of order

link

POST /api/v1/trade_cancel/region/{region}

Request parameters

parameters example Explain
key API key
signature signature
nonce nonce
region btc Trading area, optional parameters:btc / usdt / eth / usc
id List Id
coin xrp Currency Code Of Transaction

Return parameter

parameters Explain
id List Id
result true, false

Return example

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

5.Place an order

link

POST /api/v1/trade_add/region/{region}

Request parameters

parameters example Explain
key API key
signature signature
nonce nonce
region btc Trading area, optional parameters:btc / usdt / eth / usc
amount List Id
coin xrp Currency Code Of Transaction
price Purchase price
type Type of list

Return parameter

parameters Explain
id List Id
result true, false

Return example

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

6.data type

Filed data type
*_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
You can’t perform that action at this time.