FunexAPI

General API Information

The base endpoint is: https://exchange-api.funexcoin.com All endpoints return either a JSON object or array. All time and timestamp related fields are in milliseconds. Requested URL needs to be determined by BASE and specific endpoint combination.

Endpoint

Each interface has its own endpoint, described by field HTTP REQUEST in the docs.

 {
     "status": false,
     "errors": [
        "error message", 
         ...
     ]
 }
 {
     "status": true,
     "data": { ... }
 }

Request & Response

  • All requests and responses are application/json content type.
  • All response from api are in JSON format.
  • Response return error. the response will be of the following format:

Response return successful. results of api in data. the response will be of the following format:

Endpoint security

Each endpoint has a security type that determines the how you will interact with it. API-keys are passed into the Rest API via the API_KEY header. API-keys and secret-keys are case sensitive. For User data => Endpoint requires sending a valid API-Key and signature. For User stream => Endpoint requires sending a valid API-Key. TRADE and USER_DATA endpoints are SIGNED endpoints.

SIGNED (TRADE and USER DATA) Endpoint security

SIGNED endpoints require an additional parameter, signature, to be sent in the query string or request body. Endpoints use HMAC SHA256 signatures. The HMAC SHA256 signature is a keyed HMAC SHA256 operation. Use your secretKey as the key and totalParams as the value for the HMAC operation. The signature is not case sensitive.

 if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
 // process request
 } else {
// reject request
 }

Timing security

A SIGNED endpoint also requires a parameter, timestamp, to be sent which should be the millisecond timestamp of when the request was created and sent. An additional parameter, recvWindow, may be sent to specify the number of milliseconds after timestamp the request is valid for. If recvWindow is not sent, it defaults to 5000. The logic is as follows:


Serious trading is about timing. Networks can be unstable and unreliable, which can lead to requests taking varying amounts of time to reach the servers. With recvWindow, you can specify that the request must be processed within a certain number of milliseconds or be rejected by the server. It's recommended to use a small recvWindow of 5000 or less!

coin=BTC&recvWindow=5000&timestamp=1558088640489
coin=BTC&recvWindow=5000&timestamp=1558088640489&signature=bf04aa37e7073ae88e6132bb41401811e55736d3191ae4a94e932968140f7a3f

SIGNED Endpoint Examples for POST /api/v1/trade

coin : BTC

apiKey : FcJXEbiSbFBOIJKVEMcdICdaRTiGHeNYhYc

secretKey : iPBUpOwOPrSmokZbnJpXxDfnMXZUHOFbTQwjejeVbhVujbliYo

➤ queryString:

HMAC SHA256 signature:

bf04aa37e7073ae88e6132bb41401811e55736d3191ae4a94e932968140f7a3f

➤ signed querystring:

Response
{
    "status": true,
    "data": {}
}
Response
{
    "status": true,
    "data": 1613642958000
}

General endpoints

Test connectivity

HTTP Request

GET /api/v1/ping

Check server time

HTTP Request

GET /api/v1/time

 
Response
{
    "status": true,
    "data": {
        "bids": [
            {
                "price": 0.018,
                "volume": 3,
                "total": 0.05399999
            },
            {
                "price": 0.017,
                "volume": 3.4,
                "total": 0.0578
            }
        ],
        "asks": [
            {
                "price": 0.027,
                "volume": 9,
                "total": 0.243
            },
            {
                "price": 0.026,
                "volume": 5,
                "total": 0.13
            }
        ]
    }
}

Market data

Order Book

Get a list of open orders for a symbol.

HTTP Request

GET /api/v1/depth

Request Parameter

pair count
LTCBTC 100 (Optional)
  
Response
{
  "status": true,
  "data": [
      {
          "price": 0.022,
          "volume": 0.3,
          "timestamp": 1611404481550,
          "side": "buy"
      },
      {
          "price": 0.023,
          "volume": 0.1,
          "timestamp": 1611404472280,
          "side": "sell"
      }        
  ]
}

Trade History

HTTP Request

GET /api/v1/tradehistory

Request Parameter

pair count
LTCBTC 100 (Optional)
Response
{
    "status": true,
    "data": [
        {
        "o": 0.02500000,
        "h": 0.02500000,
        "l": 0.02500000,
        "c": 0.02500000,
        "v": 0.02680000,
        "t": 1562758980
        },
        {
        "o": 0.02500000,
        "h": 0.02680000,
        "l": 0.02500000,
        "c": 0.02680000,
        "v": 25.00000000,
        "t": 1562759100
        },
        {
        "o": 0.02680000,
        "h": 0.02750000,
        "l": 0.02680000,
        "c": 0.02750000,
        "v": 24.97320000,
        "t": 1562760900
        },
    ]
}

Kline/Candlesticks data

HTTP Request

GET /api/v1/kline

Request Parameter

pair period
LTCBTC 1m (1m,5m,15m,30m,1h,8h,1d,1w)
Response
{
    "status": true,
    "data": {
      "market": [
       {
         "TwentyHRVol": 0,
         "TwentHRHigh": 0,
         "TwentHRLow": 0,
         "Pair": "LTCBTC",
         "Coin": "LTC",
         "Currency": "BTC",
         "Price": 0.022,
         "Volume": 0.3,
         "ChangePer": 46.66666,
         "ChangePrice": 0.007
       }
        ]
    }
}

Last 24 hours DATA

HTTP Request

GET /api/v1/market

Request Parameter

pair
LTCBTC
	Response
	{
	    "status": true,
	    "data": [
	        {
	        "coin": "BTC",
	        "balance": 90.77753529,
	        "onorders": 5.47373137,
	        "pendingWithdraw": 0,
	        "available": 85.30380392
	        }
	    ]
	}

Account

Get Balance

HTTP Request

POST /api/v1/balance

Request Parameters

coin
BTC
 
Response
{
    "status": true,
    "data": {
        "Isvalid": true,
        "Errors": [],
        "Successes": [
		"orderId:86C27D3B-90C8-4F84-98FC-219FDD295319"
        ],
        "Model": null
    }
}

Trading

Trade

HTTP Request

POST /api/v1/trade

Request Parameters

pair side size type price
LTCBTC buy (sell) 1 market (limit) 0.03140000 (if order type is limit)