Сryptex.net API documentation

Common Request Description

url — https://cryptex.net/api/v1

key — API key from cryptex.net

sign — Signed nonce and username with Secret Key and API Key from cryptex.net

method — One of API method names. ‘Info’, ‘AcriveOrders’, ‘OrderInfo’, ‘CancelOrder’, ‘TradeHistory’, ‘Trade’

nonce — Incremental Nonce. Integer value. Must be greater than nonce from previous request. Min: 0. 0 -> 1 -> 2 -> 3 -> 4 -> 5

API Methods:

Info — Return general information about currency balances and the number of open orders for a given user

POST request parameters:

with_reserves  optional flag indicating the need to account for balance sheet reserves (0|1|TRUE|FALSE|YES|NO)

Example of a response from the server

  
    {
      'status': 'ok',
      'data': {
          'balances': {'BTC': 1000},
          'open_orders': 1000,
      },
    }
  


GetNewAddress - Get a new address for the deposit

POST request parameters:

currency - currency code in the format "XXX" (BTC)

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          'address': '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2',
      },
    }
  


DepositInfo - Getting information about the deposit

POST request parameters:

address - crypto deposit address.

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          'status': 0,
          'amount': 100,
          'confirmations': 3,
          'txid': 'a4c5c72984d8cd9d34e9caf5538d6dcfaf20aabae45c7c09d2794027704b729c',
      },
    }
  


Withdraw - Withdrawing funds to the specified address

POST request parameters:

amount - crypto deposit address.
address - crypto receipt address.
currency - currency code in the format "XXX" (BTC).

Example of a response from the server


  
    {
      'status': 'ok',
      'data': 'Opened'
    }
  


ActiveOrders - Return information about active user orders in the form of a dictionary

POST request parameters:

pair - optional filter by currency pair as a string "XXX_YYY"
order - optional sorting mode of the result, string from the list ["ASC", "DESC"]

Example of a response from the server


  
    {
      'status': 'ok',
      'data': [
          {
              "order_id":1,
              "timestamp":20140812003842,
              "pair":"BTC_USD",
              "type":"sell",
              "price":2500,
              "amount":10,
              "filled": 3,
              "status": 1
          },
      ]
    }
  


UnconfirmedTransactions - Return information about the last 1000 unconfirmed user transactions, for the specified cryptocurrencies

POST request parameters:

pair - optional filter by currency pair as a string "XXX_YYY"
order - optional sorting mode of the result, string from the list ["ASC", "DESC"]

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          'BTC': [
              {
              'id':100,
              'address': '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2',
              'txid': 'a4c5c72984d8cd9d34e9caf5538d6dcfaf20aabae45c7c09d2794027704b729c',
              'amount': 100.00,
              'confirmations': 3,
              'timestamp': 31556926,
              },
          ]
      },
    }
  


OrderInfo - Return information about the specified user order in the form of a dictionary

POST request parameters:

order_id - mandatory order identifier

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          1: {
              "order_id":1,
              "timestamp":20140812003842,
              "pair":"BTC_USD",
              "type":"sell",
              "price":2500,
              "amount":10,
              "filled": 3,
              "status": 1
          }
      }
    }
  


CancelOrder - Cancel the specified user order and return information about the canceled order and updated currency balances

POST request parameters:

order_id - mandatory order identifier

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          'order_id': 1,
          'balances': {'BTC': 1000},
      },
    }
  


TradeHistory - Return trading history

POST request parameters:

pair - optional filter by currency pair as a string "XXX_YYY"
since - optional filter of the beginning of the time period of history
end - optional filter of the end of time period of history
count - optional filter of the number of received history records (up to 1000 records max)
order - optional result ordering feature ("ASC" | "DESC")

Example of a response from the server


  
    {
      'status': 'ok',
      'data': [
          {
              "transaction_id":1,
              "buy_order_id":1,
              "sell_order_id":2,
              "timestamp":20140812003842,
              "pair":"USD_BTC",
              "type":"sell",
              "price":2500,
              "amount":10,
              "is_instant_buy":0
          },
          {
              "transaction_id":2,
              "buy_order_id":3,
              "sell_order_id":4,
              "timestamp":20140812003842,
              "pair":"BTC_USD",
              "type":"buy",
              "price":2500,
              "amount":10,
              "is_instant_buy":1
          }
      ],
    }
  


Trade - Place a trade order on a currency pair for a specified user, and return information about balances

POST request parameters:

pair - trading currency pair as a string "XXX_YYY"
type - order type ("sell" | "buy")
price - price (> 0)
amount - amount (> 0)

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          'balances': {'BTC': 100,'USD': 10000,}
          'order': 1,
      },
    }
  


CouponCreate - Write a cryptex-code coupon and return its amount and code

POST request parameters:

currency - currency code in the format "XXX"
amount - amount in the currency of the coupon
recipient - optional coupon recipient identifier

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          'amount': '100',
          'code': 'CTX-USD-AnrNiDs1-YuXvcE31-GfurFFvt-I5f1QnQE',
      },
    }

    {
      'status': 'ok',
      'data': 'send_to_moderation',
    }
  


CouponRedeem - Redeem the cryptex-code coupon and return its amount

POST request parameters:

code - cryptex-code coupon code

Example of a response from the server


  
    {
      'status': 'ok',
      'data': {
          'amount': '100',
      },
    }
  

Python Example


  
      import requests
      import hmac
      import hashlib

      auth = {
      'key': YOUR_KEY,
      'secret': YOUR_SECRET,
      'nonce': 109,
      }

      def get_sign():
      message = str(auth['nonce']) + 'username' + auth['key']
      return hmac.new(auth['secret'].encode(), msg=message.encode(),
      digestmod=hashlib.sha256).hexdigest().upper()

      res = requests.post(
        url='https://cryptex.net/api/v1',
        data={
          'method': 'Info',
          'nonce': auth['nonce'],
        },
        headers={
          'Key': auth['key'],
          'Sign': get_sign(),
        },
      )

      print(res.json())
  

Output:


  
    {
      'status': 'ok', 
      'data': {
        'balances': {
          RUR': 500.0,
          'EUR': 50.0,
          'LTC': 50.0,
          'BTC': 5.4004,
          'USD': 900.33
        },
        'open_orders': 3
      }
    }
  
OlarkChat with us