Developer's Guide - API

Overview

Coin2001 offers through a set of REST APIs a simple and powerful interface for the management of most functions available within the site. All requests use the application/json as the 'Content Type' and are operated only through https. The domain and home access URL, regardless of country, is https://coin2001.com/api/{version}/. All requests are of type 'GET' and all call responses are returned in the form of an object in the result field. You should always validate that the status returned has the success tag to ensure that the operation performed was successful.

It is allowed to create 100 open orders and a total of 50,000 orders per day with a maximum frequency of 1 order every 5 seconds. We reserve the right to change these parameters at the convenience of system availability. If these limits interfere in any way in your trading operations, please forward us an email to support@coin2001.com.

If you have any questions, comments or recommendations regarding our API, please email us at api@coin2001.com

Topics

  • Overview
  • Authentication
  • API - Detailing
  • Libraries

Overview

This is a simple API based on RESTful API. All calls must be of type GET and must be securely connected via https. There is an API versioning template that must always be informed in calls. The current version of the API is v1, other versions are under development or testing. The endpoints have the following basic structure:

https://coin2001.com/api/{version}/{method}?param=valor

Authentication

With the philosophy of being a simple solution, we offer a simple key-based API authentication model. The key generation is based on the HMAC-SHA512 market standard. Where the apikey and nonce parameters should always be provided on each call and the calculated hash with HMAC and sent in the header with the name of apisign. Note: the parameter 'nonce' per hour is not mandatory, but in future versions it will be required.

Public and private keys must be obtained by accessing your account and clicking on the 'Personal Data' link, or by accessing the URL http://coin2001.com/myAccount/profile

	$apikey='xxx'; // public key
	$apisecret='yyy'; // private key
	$nonce=time(); // Optional parameter per hour
	$uri='https://coin2001.com/api/v1/market/getOpenOrders?apikey='.$apikey.'&nonce='.$nonce;
	$sign=hash_hmac('sha512',$uri,$apisecret);
	$ch = curl_init($uri);
	curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$sign));
	$execResult = curl_exec($ch);
	$obj = json_decode($execResult);

API - Detailing

Our APIs are divided into three distinct categories
  • Public - Public use APIs open to any user and do not require authentication
  • Account - Used for account management
  • Market - Specific to trading operations

Public API

/public/getMarkets

Used to list all 'Offer Books' (Market) available on Coin2001. Complementarily, some metadata is provided.

Parameters

None

Request:
https://coin2001.com/api/v1/public/getMarkets
Response
{  
   "success":true,
   "message":"",
   "result":[  
      {  
         "MarketCurrency":"LTC",
         "BaseCurrency":"BTC",
         "MarketCurrencyLong":"Litecoin",
         "BaseCurrencyLong":"Bitcoin",
         "MinTradeSize":0.01000000,
         "MarketName":"BTC-LTC",
         "IsActive":true,
         "Created":"2014-02-13T00:00:00"
      },
      {  
         "MarketCurrency":"DOGE",
         "BaseCurrency":"BTC",
         "MarketCurrencyLong":"Dogecoin",
         "BaseCurrencyLong":"Bitcoin",
         "MinTradeSize":100.00000000,
         "MarketName":"BTC-DOGE",
         "IsActive":true,
         "Created":"2014-02-13T00:00:00"
      }
   ]
}

/public/getCurrencies

Used to get all the coins and coins supported on Coin2001. Complementarily, some metadata is provided.

Parameters

None

Request:
https://coin2001.com/api/v1/public/getCurrencies
Response
{  
   "success":true,
   "message":"",
   "result":[  
      {  
         "Currency":"BTC",
         "CurrencyLong":"Bitcoin",
         "MinConfirmation":2,
         "TxFee":0.00020000,
         "IsActive":true,
         "CoinType":"BITCOIN",
         "BaseAddress":null
      },
      {  
         "Currency":"LTC",
         "CurrencyLong":"Litecoin",
         "MinConfirmation":5,
         "TxFee":0.00200000,
         "IsActive":true,
         "CoinType":"BITCOIN",
         "BaseAddress":null
      }
   ]
}



/public/getTicker

Used to get the current quotation from the 'Book of Offers' (Market).

Parameters

market (mandatory) - String literal with the code of the 'Book' (ex: BTC-LTC or BTC_LTC)

Request:
https://coin2001.com/api/v1/public/getTicker
Response
{  
   "success":true,
   "message":"",
   "result":{  
      "Bid":2.05670368,
      "Ask":3.35579531,
      "Last":3.35579531
   }
}



/public/getMarketSummaries

Used to get a summary of activities in the last 24 hours.

Parameters

None

Request:
https://coin2001.com/api/v1/public/getMarketSummaries
Response
{  
   "success":true,
   "message":"",
   "result":[  
      {  
         "MarketName":"BTC-888",
         "Name":"888 Coin",
         "Coin":"888",
         "Open":0.00000901,
         "High":0.00000919,
         "Low":0.00000820,
         "Volume":74339.61396015,
         "Last":0.00000820,
         "BaseVolume":0.64966963,
         "TimeStamp":"2014-07-09T07:19:30.15",
         "Bid":0.00000820,
         "Ask":0.00000831,
         "OpenBuyOrders":15,
         "OpenSellOrders":15,
         "PrevDay":0.00000821,
         "Created":"2014-03-20T06:00:00",
         "DisplayMarketName":null
      },
      {  
         "MarketName":"BTC-A3C",
         "Name":"A3C Coin",
         "Coin":"A3C",
         "Open":0.00000020,
         "High":0.00000072,
         "Low":0.00000001,
         "Volume":166340678.42280999,
         "Last":0.00000005,
         "BaseVolume":17.59720424,
         "TimeStamp":"2014-07-09T07:21:40.51",
         "Bid":0.00000004,
         "Ask":0.00000005,
         "OpenBuyOrders":18,
         "OpenSellOrders":18,
         "PrevDay":0.00000002,
         "Created":"2014-05-30T07:57:49.637",
         "DisplayMarketName":null
      }
   ]
}



/public/getMarketSummary

Used to obtain a summary of the activities of a specific 'Book of Offers' in the last 24 hours.

Parameters

market (mandatory) - String literal with the code of the 'Book' (ex: BTC-LTC or BTC_LTC)

Request:
https://coin2001.com/api/v1/public/getMarketSummary?market=BTC-LTC
Response
{  
   "success":true,
   "message":"",
   "result":[  
      {  
         "MarketName":"BTC-LTC",
         "Name":"Litecoin",
         "Coin":"LTC",
         "Open":0.01100000,
         "High":0.01350000,
         "Low":0.01200000,
         "Volume":3833.97619253,
         "Last":0.01349998,
         "BaseVolume":47.03987026,
         "TimeStamp":"2014-07-09T07:22:16.72",
         "Bid":0.01271001,
         "Ask":0.01291100,
         "OpenBuyOrders":45,
         "OpenSellOrders":45,
         "PrevDay":0.01229501,
         "Created":"2014-02-13T00:00:00",
         "DisplayMarketName":null
      }
   ]
}



/public/getOrderBook

Used to get the 'Book of Offers' content of a market.

Parameters

market (mandatory) - String literal with the code of the 'Book' (ex: BTC-LTC or BTC_LTC)
type (mandatory) - 'buy' for buyers; 'sell' to sellers; 'both' for both

Request:
https://coin2001.com/api/v1/public/getOrderBook?market=BTC_LTC&type=both
Response
{  
   "success":true,
   "message":"",
   "result":{  
      "buy":[  
         {  
            "Quantity":12.37000000,
            "Rate":0.02525000
         }
      ],
      "sell":[  
         {  
            "Quantity":32.55412402,
            "Rate":0.02540000
         },
         {  
            "Quantity":60.00000000,
            "Rate":0.02550000
         },
         {  
            "Quantity":60.00000000,
            "Rate":0.02575000
         },
         {  
            "Quantity":84.00000000,
            "Rate":0.02600000
         }
      ]
   }
}



/public/getMarketHistory

Used to return the latest offers made on the 'Book of Offers' (Market).

Parameters

market (mandatory) - String literal with the code of the 'Book' (ex: BTC-LTC or BTC_LTC)

Request:
https://coin2001.com/api/v1/public/getMarketHistory?market=BTC-DOGE
Response
{  
   "success":true,
   "message":"",
   "result":[  
      {  
         "Id":319435,
         "TimeStamp":"2014-07-09T03:21:20.08",
         "Quantity":0.30802438,
         "Price":0.01263400,
         "Total":0.00389158,
         "FillType":"FILL",
         "OrderType":"BUY"
      },
      {  
         "Id":319433,
         "TimeStamp":"2014-07-09T03:21:20.08",
         "Quantity":0.31820814,
         "Price":0.01262800,
         "Total":0.00401833,
         "FillType":"PARTIAL_FILL",
         "OrderType":"BUY"
      },
      {  
         "Id":319379,
         "TimeStamp":"2014-07-09T02:58:48.127",
         "Quantity":49.64643541,
         "Price":0.01263200,
         "Total":0.62713377,
         "FillType":"FILL",
         "OrderType":"SELL"
      },
      {  
         "Id":319378,
         "TimeStamp":"2014-07-09T02:58:46.27",
         "Quantity":0.35356459,
         "Price":0.01263200,
         "Total":0.00446622,
         "FillType":"PARTIAL_FILL",
         "OrderType":"BUY"
      }
   ]
}



API - Book of Offers (Market)

/market/buyLimit

Used to make placing a purchase order on a specific 'Book of Offers'.

Parameters

Request:
https://coin2001.com/api/v1.1/market/buyLimit?apikey=API_KEY&market=BTC-LTC&quantity=1.2&rate=1.3

market (mandatory) - String literal with the code of the 'Book' (ex: BTC-LTC or BTC_LTC)
quantity (mandatory) - Amount to be purchased
price (mandatory) - Value of the unit to be purchased. Optionally you can use the parameter rate

Response
{  
   "success":true,
   "message":"",
   "result":{  
      "uuid":"e606d53c-8d70-11e3-94b5-425861b86ab6"
   }
}



/market/sellLimit

Used to make placing a sales order on a specific 'Book of Offers'.

Parameters

market (mandatory) - String literal with the code of the 'Book' (ex: BTC-LTC or BTC_LTC)
quantity (mandatory) - Amount to be purchased
price (mandatory) - Value of the unit to be purchased. Optionally you can use the parameterrate

Request:
https://coin2001.com/api/v1.1/market/sellLimit?apikey=API_KEY&market=BTC-LTC&quantity=1.2&rate=1.3
Response
{  
   "success":true,
   "message":"",
   "result":{  
      "uuid":"614c34e4-8d71-11e3-94b5-425861b86ab6"
   }
}



/market/cancel

Used to cancel an order placed earlier in the 'Book of Offers' (Market)

Parameters

uuid (mandatory) - uuid is the identifier of the order previously placed

Request:
https://coin2001.com/api/v1.1/market/cancel?apikey=API_KEY&uuid=ORDER_UUID
Response
{  
   "success":true,
   "message":"",
   "result":null
}



/market/getOpenOrders

List all orders placed (by the user) in the 'Book of Offers' (Market).

Parameters

market (mandatory) - String literal with the code of the 'Book of Offers' (Market) (ex: BTC-LTC ou BTC_LTC)

Request:
https://coin2001.com/api/v1.1/market/getOpenOrders?apikey=API_KEY&market=BTC-LTC
Response
{  
   "success":true,
   "message":"",
   "result":[  
      {  
         "Uuid":"SAL-2827-8107-1515589307",
         "Exchange":"BTC-LTC",
         "OrderType":"LIMIT_SELL",
         "Quantity":5.00000000,
         "QuantityRemaining":5.00000000,
         "Limit":2.00000000,
         "Opened":"2014-07-09T03:55:48.77"
      },
      {  
         "Uuid":"PCH-6980-7248-1515589567",
         "Exchange":"BTC-LTC",
         "OrderType":"LIMIT_BUY",
         "Quantity":100000.00000000,
         "QuantityRemaining":100000.00000000,
         "Limit":0.00000001,
         "Opened":"2014-07-09T03:55:48.583"
      }
   ]
}



Account Api

/account/getBalances

Used to return all balances to your account.

Parameters

None

Request:
https://coin2001.com/api/v1/account/getBalances?apikey=API_KEY
                
Response
{  
   "success":true,
   "message":"",
   "result":[  
      {  
         "Currency":"DOGE",
         "Balance":0.00000000,
         "Available":0.00000000,
         "Pending":0.00000000
      },
      {  
         "Currency":"BTC",
         "Balance":14.21549076,
         "Available":14.21549076,
         "Pending":0.00000000
      }
   ]
}



/account/getBalance

Used to return the account balance to a specific currency.

Parameters

currency (mandatory) - String literal with the code of 'Coin' (ex: XRP)

Request:
https://coin2001.com/api/v1/account/getBalance?apikey=API_KEY&currency=XRP
Response
{  
   "success":true,
   "message":"",
   "result":{  
      "Currency":"BTC",
      "Balance":4.21549076,
      "Available":4.21549076,
      "Pending":0.00000000
   }
}