Thursday,  August  17,  2017   |   09:11 GMT

This section will provide information on Trading API designed to fully automate your cryptocurrency trading on CRXzone exchange.

Getting Started

CRXzone application programming interface (API) allows our clients to access trading platform for automatic trading, control their accounts by receiving information about trades and funds movement, etc.

For automated trading on the exchange you need to create an API Key in your CRXzone account profile. At the same time, functions fetching general CRXzone current market information are available even for unregistered clients and not not require API Key.

API Key Setup

Before calling protected API functions you need to setup an API Key in your CRXzone profile in the API Keys section (except functions listed under Market Information, which are open for everyone).

Important! For security purposes you can create several API Keys, and each API key can be configured in such a way to allow access only to certain functions. For instance, for your automated trading script you may not enable access to functions in 'Funding section', so even if hackers compromise your server and get access to your API Key they will be unable to steal your money.

To create new API Key click on corresponding link on API Keys page. New page will be opened where you will need to specify a name for the API Key, and set a password. Also, you have to select the functions you plan to call using this API Key. Click Save to obtain API Key ID. It will be shown in Existing API Keys List under ID column. This API Key ID among with API Key Password will be required later for protected API functions call.

Authorization Scheme

Some of the API functions require a special signature which is generated from the values ​​of variables that are sent to the function and are sorted by variables name in ascending order + password API, separated by colons (:).

For example, if the function is being called with the following parameters:

Order_Create (
	APIID = 123456,
	signature = ‘b32602bdf44c5165b14a86a7592d2b88’,
	currencyPairID = 1,
	price = 50.12345000,
	amount = 20.50000000,
	type = 0
)

First, we will put all the names of function parameters in alphabetical order (Important!):

  • Amount (=20.5)
  • APIID (=123456)
  • currencyPairID (=1)
  • price (=50.12345000)
  • type (=0)

Assuming that your API Key Password is ‘AABBCC’ (from your account settings). Then we get the md5 hash of the following string:

signature = md5 (‘20.5:123456:1:50.12345:0:AABBCC’)

The result of the md5 function is:

signature = ‘b32602bdf44c5165b14a86a7592d2b88’

Now having filled signature variable you are ready to call protected function Order_Create as shown above.

Making API Request

Most API requests need an authentication. You can find out more on authentication in section above (see Authorization Scheme above).

All requests need to be sent to the following URL:
https://www.crxzone.com/API/Order_Create?APIID=12345&signature=5e45dd0ad68772e6a152d8629a7b8091¤cyPairID=1&price=50.12345&amount=20.5&type=0

Where: FunctionName — Name of called function
            ?APIID=12345&signature=5e45dd0ad68772e6a152d8629a7b8091¤cyPairID=1&price=50.12345&amount=20.5&type=0 — Request parametres

Parameters can be sent both with POST or GET methods.

Important! All decimal numbers should be positive and no more than 8 characters after dot.

Response Example:

{
	"ErrorMessage":" ... error message if occured ... ",
	"IsSuccess":"1",
	"Result":" ... some data ... "
}
Name Type Example Description
ErrorMessage String API_Wrong_Hash Error Code
IsSuccess Boolean true Operation Success
Result Array/Object   Result

API Functions

All functions are logically divided into the following sections:

Below we will describe each function in more detail.

Ticker() Function

[TickerResult Object]  Ticker  Integer  currencyPairID )

Allows to get information about the last trades for selected currency pair.

Parameters:

Name Type Example Description
currencyPairID Integer 4 Pair ID

Return value: TickerResult Object.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":{
		"High":1.12730113,
		"Low":0.70044260,
		"Open":1.00000000,
		"Last":0.80914046,
		"Volume":3743.07246800,
		"Ask":1.12730113,
		"Bid":0.69413861,
		"TimeStamp":1401192420
	}
}

Trades() Function

[Array of Trade Objects]  Trades  Integer  currencyPairID, Integer tradeID)

Allows to get list of trades or single trade infromation.

Parameters:

Name Type Example Description
currencyPairID Integer 3 Pair ID
tradeID Integer 52341 Trade ID

Return value: Array of Trade Objects.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":[
		{
			"ID":300001,
			"Price":689.88064082,
			"Amount":2.90600000,
			"TimeStamp":1401192420
		},
		{
			"ID":300002,
			"Price":689.88064082,
			"Amount":0.28188200,
			"TimeStamp":1401192420
		}
	]
}

CurrencyPairs() Function

[Array of CurrencyPair Objects]  CurrencyPairs ()

Allows to get list of currency pairs existing on CRXzone exchange.

Parameters: None

Return value: Array of CurrencyPair Objects.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":[
		{
			"ID":1,
			"PrimaryCurrencyName":"BTC",
			"PrimaryCurrencyCode":"BTC",
			"SecondaryCurrencyName":"USD",
			"SecondaryCurrencyCode":"USD",
			"MinimumOrderAmount":0.00000001
		},
		{
			"ID":2,
			"PrimaryCurrencyName":"BTC",
			"PrimaryCurrencyCode":"BTC",
			"SecondaryCurrencyName":"EUR",
			"SecondaryCurrencyCode":"EUR",
			"MinimumOrderAmount":0.00000001
		}
	]
}

Market_Depth() Functuion

[MarketDepthResult Object]  Market_Depth  Integer  currencyPairID )

Allows to get current market depth information.

Parameters:

Name Type Example Description
currencyPairID Integer 3 Pair ID

Return value: MarketDepthResult Object.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":{
		"Bids":[
			[
				0.82124714,
				0.23917400
			],
			[
				0.85102372,
				0.06567600
			]
		],
		"Asks":[
			[
				0.80646470,
				0.84933300
			],
			[
				0.79950556,
				1.78476700
			]
		],
	"TimeStamp":1401192420
		}
}

Order_Create() Function

[Void]  Order_Create  Integer  APIID, Decimal  amount, Integer currencyPairID,  Decimal price,  String signature,  Integer type)

Allows to create buy/sell orders in the market.

Parameters:

Name Type Example Description
APIID Integer 3444 API Identificator
currencyPairID Integer 4 Pair ID
price Decimal 1.12730113 Price
amount Decimal 1230.69413861 Volume
type Integer 0 Order type (0 - buy, 1 - sell)

Return value: None.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":947636
}

Order_Get() Function

[Order ObjectOrder_Get  Integer  APIID, Integer  orderID, String signature )

Allows to get the order details by order ID.

Parameters:

Name Type Example Description
APIID Integer None API Identificator
orderID Integer None Order ID

Return value: Order Object.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":{
		"ID":947636,
		"CurrencyPairID":1,
		"Amount":4.58315200,
		"AmountLeft":0.24715200,
		"Price":0.90614512,
		"Fee":0,
		"TimeStamp":1401192420,
		"Type":0,
		"IsCompleted":true,
		"IsCanceled":true,
		"Trades":[
			{
				"ID":799727,
				"Price":0.90614512,
				"Amount":4.33600000,
				"TimeStamp":1401192420
			}
		]
	}
}

Order_Cancel() Function

[Void]  Order_Cancel  Integer  APIID, Integer  orderID, String signature )

Allows to get order cancellation information.

Parameters:

Name Type Example Description
APIID Integer 3444 API Identificator
orderID Integer 239870 Order ID

Return value: None.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":null
}

Orders_Active() Function

[Array of Order Objects]  Orders_Active  Integer  APIID, Integer  currencyPairID, String signature )

Allows to receive the list of active orders.

Parameters:

Name Type Example Description
APIID Integer None API Identificator
currencyPairID Integer None Pair ID

Return value: Array of Order Objects.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":[
			{
				"ID":947797,
				"CurrencyPairID":1,
				"Amount":5.36613000,
				"AmountLeft":5.36613000,
				"Price":0.88364974,
				"Fee":0,
				"TimeStamp":1401192420,
				"Type":0,
				"IsCompleted":false,
				"IsCanceled":false,
				"Trades":[
					{
						"ID":799727,
						"Price":0.90614512,
						"Amount":4.33600000,
						"TimeStamp":1401192420
					}
				]
			}
	]
}

Orders_Closed() Function

[Array of Order Objects]  Orders_Closed  Integer  APIID, Integer  currencyPairID, Integer recordsCount ,  Integer startIndex ,  String signature )

Allows to receiv the list of closed/cancelled orders.

Parameters:

Name Type Example Description
APIID Integer None API Identificator
currencyPairID Integer None Pair ID
recordsCount Integer None Number of Records
startIndex Integer None Start Index

Return value: Array of Order Objects.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":{
	"Orders":[
			{
				"ID":947782,
				"CurrencyPairID":1,
				"Amount":3.54000000,
				"AmountLeft":0,
				"Price":0.88630867,
				"Fee":0,
				"TimeStamp":1401192420,
				"Type":1,
				"IsCompleted":true,
				"IsCanceled":false,
				"Trades":null
			}
		],
		"TotalRecordsCount":86727
	}
}

Accounts() Function

[Array of Account Objects]  Accounts  Integer  APIID, String signature )

Allows to get balance of all currencies in your account.

Parameters:

Name Type Example Description
APIID Integer 3444 API Identificator

Return value: Array of Account Objects.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":[
		{
			"CurrencyCode":"USD",
			"Available":16855.28033317,
			"InOrders":1.79539021,
			"InWithdrawals":0
		},
		{
			"CurrencyCode":"EUR",
			"Available":94999.73069543,
			"InOrders":11.81808727,
			"InWithdrawals":0
		}
	]
}

Withdrawal() Function

[Integer] Withdrawal ( Integer APIID, String currencyCode, String paySystemCode, String remoteAddress, Decimal amount )

Initiate withdrawal process. Returns withrdrawal transaction ID.

Parameters:

Name Type Example Description
APIID Integer None API Identifier
currencyCode String None Code of currency
paySystemCode String None Code of payment system
remoteAddress String None Address/wallet ID/etc. in payment system
amount Decimal None Amount to withdrawal

Return value: Integer.

Response example:

{
	"ErrorMessage":null,
	"IsSuccess":true,
	"Result":81318
}

API Error Codes

Error Code Description
API_Wrong_Hash Wrong request signature. check parameters order and number format (must be eight signs decimal)
Invoice_Not_Found Wrong ivoice code
Currency_Not_Found Wrong currency code
Currency_Not_Crypto Create wallet with fiat currency
Parameter_Validation_Error Price is negative
PaySystem_Currency_Deposit_Is_Prohibited Withdrawal for selected currency is prohibited for payment system
Negative_Balance_Is_Prohibited Not enough money to make this action
InternalError `startIndex` or `recordCount` is negative, Crypto Withdrawal, all other errors

Data Structures

Object  TickerResult
Name Type Example Description
High Decimal 1.12730113 Maximum Value
Low Decimal 0.70044260 Minimum Value
Open Decimal 1.00000000 Open Price
Last Decimal 0.80914046 Last Price
Volume Decimal 3743.07246800 Market Volume
Ask Decimal 1.12730113 Sell Price
Bid Decimal 0.69413861 Buy Price
TimeStamp Integer 1401192420 Creation Date/Time (UNIX Timestamp)
Object  Trade
Name Type Example Description
ID Integer 300014 ID
Price Decimal 1.12730113 Price
Amount Decimal 1230.69413861 Ammount
TimeStamp Integer 1401192420 Creation Date/Time (UNIX Timestamp)
Object  CurrencyPair
Name Type Example Description
ID Integer 2 Pair ID
PrimaryCurrencyName String BTC First Currency in Pair
PrimaryCurrencyCode String BTC First Currency Code in Pair
SecondaryCurrencyName Sring USD Second Currency Name in Pair
SecondaryCurrencyCode Sring USD Second Currency Code in Pair
MinimumOrderAmount Decimal 0.01000000 Minimum Order Ammount
Object  MarketDepthResult
Name Type Example Description
Bids Array Array of Bid Objects
Asks Array Array of Ask Objects
Object  Bid
Name Type Example Description
Decimal 1.12730113 Price
Decimal 1230.69413861 Order Volume
Object  Ask
Name Type Example Description
Decimal 1.12730113 Price
Decimal 1230.69413861 Order Volume
Object  Account
Name Type Example Description
CurrencyCode String BTC Currency Code
Available Decimal 1.12730113 Available
InOrders Decimal 1230.69413861 Hold in Orders
InWithdrawals Decimal 1401192420 Hold in Withdrawal
Object  Order
Name Type Example Description
ID Integer 0 Order ID
CurrencyPairID Integer 1 Currency Pair ID
AmountLeft Decimal 0.00000000 Order Amount Left
Price Decimal 0.00000000 Price
Fee Decimal 0.00000000 Fee
TimeStamp Integer null Creation Date/Time (UNIX Timestamp)
Type Integer 0 Order Type
IsCompleted Boolean null Completed Status Identifacator
IsCanceled Boolean null Canceled Status Identifacator
Trades Array null List of Trade Objects

References

Payment Methods

The following is a list that represent all possible funding and withdrawal methods.

Logotype Title Code
Crypto CurrenciesCrypto CurrenciesCRYPTO
Wire TransferWire TransferWIRE
Perfect MoneyPerfect MoneyPM
WebMoneyWebMoneyWM
SkrillSkrillSKRILL
PayzaPayzaPZ
OKPAYOKPAYOKPAY

Fiat Currency Codes

Below are selected world currencies along with their ISO 4217 Currency Code.

Country Currency Code
Euro Member Countries, Andorra, Austria, Azores, Baleares (Balearic Islands), Belgium, Canary Islands, Cyprus, Dutch (Netherlands), Eire (Ireland), Finland, France, French Guiana, French Southern Territories, Germany, Greece, Guadeloupe, Holland (Netherlands), Holy See, (Vatican City), Ireland (Eire), Italy, Luxembourg, Madeira Islands, Malta, Martinique, Mayotte, Miquelon and Saint Pierre, Monaco, Montenegro, Netherlands, Portugal, Reunion, Saint Pierre and Miquelon, Saint-Martin, San Marino, Slovakia, Slovenia, Spain Euro EUR
United States of America, American Samoa, American Virgin Islands, British Indian Ocean Territory, British Virgin Islands, Caicos and Turks Islands, Ecuador, El Salvador, Guam, Haiti, Mariana Islands (Northern), Marshall Islands, Micronesia (Federated States of), Midway Islands, Northern Mariana Islands, Palau, Panama, Puerto Rico, Samoa (American), United States Minor Outlying Islands, Wake Island U.S. Dollar USD
Singapore Singapore Dollar SGD

Crypto Currencies

Name Code
USDUSD
EUREUR
BTCBTC
LTCLTC
SGDSGD
DOGEDOGE
MYRMYR
ETHETH

Code Samples

PHP
 <?php
 	/**
 	* 
 	* API-call related functions
 	*
 	*/
 	
 	class CRXzoneAPI {
 		protected $BUY = '0';
 		protected $SELL = '1';
 		protected $public_api = 'https://www.crxzone.com/API/';
 		
 		protected $api_id;
 		protected $api_key;
 		
 		public $CurrencyPairs = array();
 		public $Balances = array();
 		
 		public function __construct($api_id, $api_key) {
 			$this->api_id = $api_id;
 			$this->api_key = $api_key;
 			
 			// Init currency pairs and balances
 			$this->RefreshCurrencyPairs();
 			$this->RefreshBalances();
 		}
 		
 		/**
 		* Call the API
 		*/
 		public function Query($method = '', $args = array()) {
 			// Prepare request before send
 			$this->Prepare($args);
 			$url = $this->public_api.$method;
 			$ch = curl_init();
 			if(strtolower((substr($url,0,5))=='https')) {
 				curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
 				curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
 			}
 			curl_setopt($ch, CURLOPT_URL, $url);
 			curl_setopt($ch, CURLOPT_REFERER, $url);
 			curl_setopt($ch, CURLOPT_VERBOSE, 0);
 			curl_setopt($ch, CURLOPT_POST, 1);
 			#curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 			curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
 			curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (Windows; U; Windows NT 5.0; En; rv:1.8.0.2) Gecko/20070306 Firefox/1.0.0.4");
 			curl_setopt($ch, CURLOPT_HEADER, 0);
 			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
 			$result = curl_exec($ch);
 			curl_close($ch);
 			return json_decode($result);
 		}
 		
 		/**
 		* Prepare request
 		*/
 		private function Prepare(&$Params) {
 			// Sort array by key (ASC)
 			if(isset($Params['signature'])) {
 				unset($Params['signature']);
 			}
 			
 			$Params = array_reverse($Params, true);
 			$Params['APIID'] = $this->api_id;
 			$Params = array_reverse($Params, true); 
 			
 			$SortedParams = array();
 			$a1 = array_keys($Params);
 			foreach($a1 as $key) {
 				$SortedParams[strtolower($key)] = $Params[$key];
 			}
 			ksort($SortedParams);
 			
 			// Implode values and append API key
 			$Imploded = implode(":", $SortedParams).":".$this->api_key;
 			
 			$SortedParams['signature'] = md5($Imploded);
 			$Params = $SortedParams;
 		}
 		
 		/**
 		* Refresh currency pairs information
 		*/
 		public function RefreshCurrencyPairs() {
 			$CurrencyResult = $this->Query("CurrencyPairs");
 			if($CurrencyResult->IsSuccess) {
 				$this->CurrencyPairs = array();
 				foreach($CurrencyResult->Result as $Pair) {
 					$Code = $Pair->PrimaryCurrencyCode.$Pair->SecondaryCurrencyCode;
 					$this->CurrencyPairs[$Code] = array(
 						"ID" => $Pair->ID,
 						"MinimumOrderAmount" => $Pair->MinimumOrderAmount
 					);
 					$TickerResult = $this->Query("Ticker", array('currencyPairID' => $Pair->ID));
 					
 					if($TickerResult->IsSuccess) {
 						$this->CurrencyPairs[$Code]["Price"] = $TickerResult->Result->Last;
 					} else {
 						$this->CurrencyPairs[$Code]["Price"] = 0;
 					}
 					
 				}
 			} else {
 				throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$CurrencyResult->ErrorMessage);
 			}
 		}
 		
 		/**
 		* Refresh balances information
 		*/
 		public function RefreshBalances() {
 			$AccountsResult = $this->Query("Accounts");
 			
 			if($AccountsResult->IsSuccess) {
 				$this->Balances = array();
 				foreach($AccountsResult->Result as $Account) {
 					$this->Balances[$Account->CurrencyCode] = array(
 						'Available'     => $Account->Available,
 						'InOrders'      => $Account->InOrders,
 						'InWithdrawals' => $Account->InWithdrawals,
 						'TotalHold'     => $Account->InOrders + $Account->InWithdrawals
 					);
 				}
 			} else {
 				throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$AccountsResult->ErrorMessage);
 			}
 		}
 		
 		/**
 		* Get last tick for currency pair
 		*/
 		public function GetTicker($CurrencyPair) {
 			if(array_key_exists($CurrencyPair, $this->CurrencyPairs)) {
 				$PairID = $this->CurrencyPairs[$CurrencyPair]["ID"];
 				$TickerResult = $this->Query("Ticker", array('currencyPairID' => $PairID));
 				if($TickerResult->IsSuccess) {
 					return $TickerResult->Result;
 				} else {
 					throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$TickerResult->ErrorMessage);
 				}
 			} else {
 				throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
 			}
 		}
 		
 		/**
 		* Get market depth
 		*/
 		public function GetMarketDepth($CurrencyPair) {
 			if(array_key_exists($CurrencyPair, $this->CurrencyPairs)) {
 				$PairID = $this->CurrencyPairs[$CurrencyPair]["ID"];
 				$DepthResult = $this->Query("Market_Depth", array('currencyPairID' => $PairID));
 				if($DepthResult->IsSuccess) {
 					return $TickerResult->Result;
 				} else {
 					throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$TickerResult->ErrorMessage);
 				}
 			} else {
 				throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
 			}
 		}
 		
 		/**
 		* Get list of orders
 		*/
 		// $CurrencyPair
 		// $Type = Active/Closed
 		// $RecordsCount = 0;
 		// $StartIndex = 0;
 		public function GetOrdersList($CurrencyPair, $Type = 'Active', $RecordsCount = 0, $StartIndex = 0) {
 			if(!array_key_exists($CurrencyPair, $this->CurrencyPairs)) {
 				throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
 			}
 			$PairID = $this->CurrencyPairs[$CurrencyPair]["ID"];
 			$return = array();
 			switch ($Type) {
 				case 'Active':
 					$OrdersResult = $this->Query("Orders_Active", array('currencyPairID' => $PairID));
 					if($OrdersResult->IsSuccess) {
 						$Orders = array();
 						$StartIndex = ($StartIndex < 0) ? 0 : $StartIndex;
 						$OrdersTotal = count($OrdersResult->Result);
 						if($RecordsCount != 0) {
 							$Counter = 0;
 							$Index = 0;
 							foreach($OrdersResult->Result as $Order) {
 								$Index++;
 								if($StartIndex > $Index) {
 									continue;
 								}
 								if($Counter > $RecordsCount) {
 									break;
 								}
 								$Counter++;
 								$Orders[$Order->ID] = $Order;
 							}
 						} else {
 							// All orders
 							$Index = 0;
 							foreach($OrdersResult->Result as $Order) {
 								$Index++;
 								if($StartIndex > $Index) {
 									continue;
 								}
 								$Orders[$Order->ID] = $Order;
 							}
 						}
 						$return['Orders'] = $Orders;
 						$return['TotalCount'] = $OrdersTotal;
 					} else {
 						throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrdersResult->ErrorMessage);
 					}
 					break;
 				case 'Closed':
 				default:
 					$OrdersResult = $this->Query("Orders_Active", array('currencyPairID' => $PairID, 'recordsCount' => $RecordsCount, 'startIndex' => $StartIndex));
 					if($OrdersResult->IsSuccess) {
 						$Orders = array();
 						foreach($OrdersResult->Result as $Order) {
 							$Orders[$Order->ID] = $Order;
 						}
 						$return['Orders'] = $Orders;
 						$return['TotalCount'] = $OrdersResult->TotalRecordsCount;
 					} else {
 						throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrdersResult->ErrorMessage);
 					}
 					break;
 			}
 			return $return;
 		}
 		
 		/**
 		* Get order by ID
 		*/
 		public function GetOrderByID($OrderID) {
 			if(is_int($OrderID)) {
 				$OrderResult = $this->Query("Order_Get", array('orderID' => $OrderID));
 				if($OrderResult->IsSuccess) {
 					return $OrderResult->Result;
 				} else {
 					throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrderResult->ErrorMessage);
 				}
 			} else {
 				throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Order ID must be Integer.');
 			}
 		}
 		
 		/**
 		* Get market depth
 		*/
 		public function CreateOrder($CurrencyPair, $Price, $Amount, $Type = 'BUY') {
 			if(array_key_exists($CurrencyPair, $this->CurrencyPairs)) {
 				$Pair = $this->CurrencyPairs[$CurrencyPair];
 				if($Amount >= $Pair['MinimumOrderAmount']) {
 					switch(strtolower($Type)) {
 						case 'SELL':
 							$OrderType = $this->SELL;
 							break;
 						case 'BUY':
 						default:
 							$OrderType = $this->BUY;
 							break;
 					}
 					$Amount = number_format($Amount, 8, '.', '');
 					$Price = number_format($Price, 8, '.', '');
 					return $OrderResult = $this->Query("Order_Create", array('amount' => $Amount, 'currencyPairID' => $Pair['ID'], 'price' => $Price, 'type' => $OrderType));
 				} else {
 					throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrderResult->ErrorMessage);
 				}
 			} else {
 				throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
 			}
 		}
 		
 		/**
 		* Get market depth
 		*/
 		public function CancelOrder($OrderID) {
 			if(is_int($OrderID)) {
 				$OrderResult = $this->Query("Order_Cancel", array('orderID' => $OrderID));
 				if($OrderResult->IsSuccess) {
 					return true;
 				} else {
 					throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrderResult->ErrorMessage);
 				}
 			} else {
 				throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Order ID must be Integer.');
 			}
 		}
 	}
 	
 	/**
 	* Exceptions
 	*/
 	class CRXzoneAPIException extends Exception {}
 	class CRXzoneAPIFailureException extends CRXzoneAPIException {}
 	class CRXzoneAPIInvalidParameterException extends CRXzoneAPIException {}
 ?>
				
C#
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Net;
 using System.IO;
 using System.Security.Cryptography;
 using System.Security.Cryptography.X509Certificates;
 using System.Net.Security;
 using Newtonsoft.Json;
 using System.Web; //Add reference to System.Web
 using Newtonsoft.Json.Linq; //"Manage NuGet packages" -> Search for "newtonsoft json". -> click "install".
 namespace CRXZone
 {
 /*
                 {//Call anonymous method
                     var method = new CRXZone.API.MethodCall(CRXZone.API.API_Methods.CurrencyPairs);
                     method.Execute();
                     Console.WriteLine(method.Result.ToString());
                 }
 
                 {//Call secured method
                     var method = new CRXZone.API.MethodCall(CRXZone.API.API_Methods.Order_Create, 21235, "API_KEY_HERE");
                     method.AddParameter("currencyPairID", 1011);
                     method.AddParameter("price", 1M);
                     method.AddParameter("amount", 100M);
                     method.AddParameter("type", 1);
                     method.Execute();
                     Console.WriteLine(method.Result.ToString());
                 }
 */
     public class API
     {
         public enum SellBuy
         {
             Sell = 1,//BID
             Buy = 0,//ASK
         }
 
         public enum API_Methods 
         {
             PaySystems,
             CurrencyPairs,
             Ticker,
             Trades,
             Market_Depth,
             Accounts,
             Order_Cancel,
             Order_Create,
             Order_Get,
             Orders_Active,
             Orders_Closed,
             Withdrawal,
             Invoice_Get,
             Invoice_Create,
             Invoices_Get,
             PaymentAddress_Create,
             PaymentAddress_Update,
             PaymentAddress_Delete,
             PaymentAddresses_Get,
         }
 
         public class MethodCall 
         {
             const string APIURL = @"https://www.crxzone.com/API/";
 
             public long? APIID { get; set; }
             public string APIKey { get; set; }
             public string MethodName { get; set; }
             public JToken Result { get; private set; }
             private Dictionary<string, string> Parameters = new Dictionary<string, string>();
             
             public MethodCall(API_Methods method, long? APIID = null, string APIKey = null) : this(method.ToString(), APIID, APIKey) { }
             public MethodCall(string methodName, long? APIID = null, string APIKey = null)
             {
                 this.MethodName = methodName;
                 this.APIID = APIID;
                 this.APIKey = APIKey;
 
                 if (this.APIID.HasValue) 
                 {
                     this.AddParameter("APIID", APIID);
                 }
             }
 
             public void AddParameter(string name, object value) 
             {
                 Parameters.Add(name, value.ToString());
             }
 
             public void AddParameter(string name, long value)
             {
                 Parameters.Add(name, value.ToString());
             }
 
 
             public void AddParameter(string name, int value)
             {
                 Parameters.Add(name, value.ToString());
             }
 
             public void AddParameter(string name, short value)
             {
                 Parameters.Add(name, value.ToString());
             }
 
             public void AddParameter(string name, byte value)
             {
                 Parameters.Add(name, value.ToString());
             }
 
             public void AddParameter(string name, float value)
             {
                 Parameters.Add(name, value.ToString("0.00000000", System.Globalization.CultureInfo.InvariantCulture.NumberFormat));
             }
 
             public void AddParameter(string name, decimal value)
             {
                 Parameters.Add(name, value.ToString("0.00000000", System.Globalization.CultureInfo.InvariantCulture.NumberFormat));
             }
 
             public void Execute() 
             {
                 var tmpParameters = this.Parameters.ToDictionary(c => c.Key, c => c.Value);
                 var values = tmpParameters.OrderBy(c => c.Key).Select(c => c.Value).ToList();
                 if (!string.IsNullOrEmpty(this.APIKey)) 
                 {
                     values.Add(this.APIKey);
                     var original = string.Join(":", values);
                     tmpParameters.Add("signature",API.GetMd5Hash(original));
                 }
                 string url = APIURL + MethodName + "?" + string.Join("&", tmpParameters.Select(c => HttpUtility.UrlEncode(c.Key) + "=" + HttpUtility.UrlEncode(c.Value)));
                 string result = null;
                 try
                 {
                     using (WebClient wc = new WebClient())
                     {
                         result = wc.DownloadString(url);
                     }
                 }
                 catch
                 {
                     throw new CRXzoneAPIConnectionException();
                 }
                 JObject jObj;
                 string errorMessage;
                 try
                 {
                     jObj = JObject.Parse(result);
                     errorMessage = (string)jObj["ErrorMessage"];
                 }
                 catch 
                 {
                     throw new CRXzoneAPIInvalidAnswerException(); 
                 }
                 if (!string.IsNullOrEmpty(errorMessage))
                 {
                     throw new CRXzoneAPIException(errorMessage);
                 }
                 this.Result = jObj["Result"];
 
 
             }
 
         }
 
       
         internal static string GetMd5Hash(string input)
         {
             using (var md5 = System.Security.Cryptography.MD5.Create())
             {
                 var arr = System.Text.Encoding.ASCII.GetBytes(input);
                 arr = md5.ComputeHash(arr);
                 return BitConverter.ToString(arr).Replace("-", "");
             }
         }
     }
 
     public class CRXzoneAPIConnectionException : Exception
     {
 
     }
     public class CRXzoneAPIInvalidAnswerException : Exception
     {
 
     }
 
     public class CRXzoneAPIException : Exception
     {
         public CRXzoneAPIException(string message):base(message)
         {
         }
     }
 
 }
				
Python
 import hashlib, requests, json, sys
   
 DEBUG = True
   
 #   * API-call related functions
 class CRXzoneAPI(object):
     __BUY = '0'
     __SELL = '1'
     __public_api = 'https://www.crxzone.com/API/'
       
     __api_id = None
     __api_key = None
       
     CurrencyPairs = {};
     Balances = {};
           
     def __init__(self, api_id, api_key):
         self.__api_id = api_id
         self.__api_key = api_key
           
         self.__SESS = requests.Session()
         self.__SESS.headers.update({
             "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36",
         })
         self.__SESS.verify = False
         self.__SESS.timeout = 10
   
         # Init currency pairs and balances
         self.RefreshCurrencyPairs()
         self.RefreshBalances()
           
     # * Call the API
     def Query(self, method = '', args = {}):
         # // Prepare request before send
         self.__addSignature(args)
         url = self.__public_api + method
           
         try:        
             result = self.__SESS.post(url, headers={"Referer":url}, data=args)
             if DEBUG: print method, result.text[:500]
             return json.loads(result.text)
         except:
             if DEBUG: print method, sys.exc_info()
             return {"ErrorMessage":sys.exc_info(), "IsSuccess":False, "Result":None}
       
     # * Prepare request
     def  __addSignature(self, Params):
         if 'signature' in Params:
             del Params['signature']
           
         Params['APIID'] = self.__api_id
           
         p = {}
         for k,v in Params.items():
             p[str(k).lower()] = v
   
         Imploded = ""
         for k in sorted(p):
             Imploded += str(p[k])+":"
           
         Imploded += self.__api_key
           
         Params['signature'] = hashlib.md5(Imploded).hexdigest()
         return Params
       
     # * Refresh currency pairs information
     def RefreshCurrencyPairs(self):
         CurrencyResult = self.Query("CurrencyPairs")
         if CurrencyResult['IsSuccess']:
             self.CurrencyPairs = {}
             for Pair in CurrencyResult['Result']:
                 Code = "%s%s" % (Pair['PrimaryCurrencyCode'], Pair['SecondaryCurrencyCode'])
                 self.CurrencyPairs[Code] = {
                     "ID": Pair['ID'],
                     "MinimumOrderAmount": Pair['MinimumOrderAmount'],
                 }
                 TickerResult = self.Query("Ticker", {'currencyPairID': Pair['ID']})
                   
                 if TickerResult['IsSuccess']:
                     self.CurrencyPairs[Code]["Price"] = TickerResult['Result']['Last']
                 else:
                     self.CurrencyPairs[Code]["Price"] = 0
         else:
             # raise CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$CurrencyResult->ErrorMessage);
             raise CRXzoneAPIFailureException('RefreshCurrencyPairs API Error: %s' % (CurrencyResult['ErrorMessage'],))
           
     # * Refresh balances information
     def RefreshBalances(self):
         AccountsResult = self.Query("Accounts")
           
         if AccountsResult['IsSuccess']:
             self.Balances = {}
             for Account in AccountsResult['Result']:
                 self.Balances[Account['CurrencyCode']] = {
                     'Available'     : Account['Available'],
                     'InOrders'      : Account['InOrders'],
                     'InWithdrawals' : Account['InWithdrawals'],
                     'TotalHold'     : Account['InOrders'] + Account['InWithdrawals'],
                 }
         else:
             # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$AccountsResult->ErrorMessage);
             raise CRXzoneAPIFailureException('RefreshBalances API Error: %s' % (AccountsResult['ErrorMessage'],))
       
     # * Get last tick for currency pair
     def GetTicker(self, CurrencyPair):
         if CurrencyPair in self.CurrencyPairs:
             PairID = self.CurrencyPairs[CurrencyPair]["ID"]
             TickerResult = self.Query("Ticker", {'currencyPairID': PairID})
             if TickerResult['IsSuccess']:
                 return TickerResult['Result']
             else:
                 # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$TickerResult->ErrorMessage);
                 raise CRXzoneAPIFailureException('GetTicker API Error: %s' % (TickerResult['ErrorMessage'],))
         else:
             # throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
             raise CRXzoneAPIInvalidParameterException('GetTicker Error: Currency pair %s not found' % (CurrencyPair,));
       
     # * Get market depth
     def GetMarketDepth(self, CurrencyPair):
         if CurrencyPair in self.CurrencyPairs:
             PairID = self.CurrencyPairs[CurrencyPair]["ID"];
             DepthResult = self.Query("Market_Depth", {'currencyPairID': PairID})
             if DepthResult['IsSuccess']:
                 return TickerResult['Result']
             else:
                 # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$TickerResult->ErrorMessage);
                 raise CRXzoneAPIFailureException('GetMarketDepth API Error: %s ' % (TickerResult['ErrorMessage'],))
         else:
             # throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
             raise CRXzoneAPIInvalidParameterException('GetMarketDepth Error: Currency pair %s not found' % (CurrencyPair,))
       
     # * Get list of orders
     # // $CurrencyPair
     # // $Type = Active/Closed
     # // $RecordsCount = 0;
     # // $StartIndex = 0;
     def GetOrdersList(self, CurrencyPair, Type = 'Active', RecordsCount = 0, StartIndex = 0):
         if not CurrencyPair in self.CurrencyPairs:
             # throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
             raise CRXzoneAPIInvalidParameterException('GetOrdersList Error: Currency pair %s not found' % (CurrencyPair,))
   
         PairID = self.CurrencyPairs[CurrencyPair]["ID"]
         result = {}
         if Type == 'Active':
             OrdersResult = self.Query("Orders_Active", {'currencyPairID': PairID})
             if OrdersResult['IsSuccess']:
                 Orders = {}
                 StartIndex = 0 if StartIndex < 0 else StartIndex
                 OrdersTotal = len(OrdersResult['Result'])
                 if RecordsCount != 0:
                     Counter = 0
                     Index = 0
                     for Order in OrdersResult['Result']:
                         Index += 1
                         if StartIndex > Index:
                             continue
                         if Counter > RecordsCount:
                             break
                         Counter += 1
                         Orders[Order['ID']] = Order
                 else:
                     # // All orders
                     Index = 0
                     for Order in OrdersResult['Result']:
                         Index += 1
                         if StartIndex > Index:
                             continue
                         Orders[Order['ID']] = Order
                 result['Orders'] = Orders
                 result['TotalCount'] = OrdersTotal
             else:
                 # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrdersResult->ErrorMessage);
                 raise CRXzoneAPIFailureException('GetOrdersList API Error: %s' % (OrdersResult['ErrorMessage'],))
         else:
             OrdersResult = self.Query("Orders_Active", {'currencyPairID': PairID, 'recordsCount': RecordsCount, 'startIndex': StartIndex})
             if OrdersResult['IsSuccess']:
                 Orders = {}
                 for Order in OrdersResult['Result']:
                     Orders[Order['ID']] = Order
                 result['Orders'] = Orders
                 result['TotalCount'] = OrdersResult['TotalRecordsCount']
             else:
                 # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrdersResult->ErrorMessage);
                 raise CRXzoneAPIFailureException('GetOrdersList API Error: %s' (OrdersResult['ErrorMessage'],))
   
         return result;
       
     # * Get order by ID
     def GetOrderByID(self, OrderID):
         if isinstance(OrderID, int):
             OrderResult = self.Query("Order_Get", {'orderID': OrderID})
             if OrderResult['IsSuccess']:
                 return OrderResult['Result']
             else:
                 # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrderResult->ErrorMessage);
                 raise CRXzoneAPIFailureException('GetOrderByID API Error: %s' % (OrderResult['ErrorMessage'],))
         else:
             # throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Order ID must be Integer.');
             raise CRXzoneAPIInvalidParameterException('GetOrderByID Error: Order ID must be Integer.')
       
     # * Get market depth
     def CreateOrder(self, CurrencyPair, Price, Amount, Type = 'BUY'):
         if CurrencyPair in self.CurrencyPairs:
             Pair = self.CurrencyPairs[CurrencyPair]
             if Amount >= Pair['MinimumOrderAmount']:
                 if Type.upper()=='SELL':
                     OrderType = self.__SELL
                 else:
                     OrderType = self.__BUY
                 Amount = "%.8f" % Amount
                 Price = "%.8f" % Price
                 return self.Query("Order_Create", {'amount': Amount, 'currencyPairID': Pair['ID'], 'price': Price, 'type': OrderType})
             else:
                 # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrderResult->ErrorMessage);
                 # raise CRXzoneAPIFailureException('CreateOrder API Error: %s' % (OrderResult['ErrorMessage'],))
                 raise CRXzoneAPIFailureException('CreateOrder API Error: ! Amount >= Pair[MinimumOrderAmount]')
         else:
             # throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Currency pair '.$CurrencyPair.' not found');
             raise CRXzoneAPIInvalidParameterException('CreateOrder Error: Currency pair %s not found' % (CurrencyPair,))
       
     # * Get market depth
     def CancelOrder(self, OrderID):
         if isinstance(OrderID, int):
             OrderResult = self.Query("Order_Cancel", {'orderID': OrderID})
             if OrderResult['IsSuccess']:
                 return True
             else:
                 # throw new CRXzoneAPIFailureException('File: '__FILE__.' Line: '.__LINE__.' API Error: '.$OrderResult->ErrorMessage);
                 raise CRXzoneAPIFailureException('CancelOrder API Error: %s' % (OrderResult['ErrorMessage'],))
         else:
             # throw new CRXzoneAPIInvalidParameterException('File: '__FILE__.' Line: '.__LINE__.' Error: Order ID must be Integer.');
             raise CRXzoneAPIInvalidParameterException('CancelOrder Error: Order ID must be Integer.')
   
   
 #   /**
 #   * Exceptions
 #   */
 class CRXzoneAPIException(Exception):
     pass
 class CRXzoneAPIFailureException(CRXzoneAPIException):
     pass
 class CRXzoneAPIInvalidParameterException(CRXzoneAPIException):
     pass
   
   
   
 if __name__=='__main__':
     c = CRXzoneAPI(api_key='b&348fh)32k4', api_id='123456')