NAV Navbar
ruby
  • API
  • Authentication
  • Private
  • Public
  • API

    Welcome to the CoinFalcon API documentation.

    Here you will find everything you need to working with the CoinFalcon API. To get started, go to your applications page in your account settings to generate your key and secret.

    Status codes

    Status code Reason
    200 Successful response
    400 Bad Request – Invalid request format
    401 Unauthorized – Authentication error
    403 Forbidden – You do not have access to the requested resource
    404 Not Found
    429 Too Many Requests
    500 Internal Server Error – We had a problem with our server

    Limits

    When a rate limit is exceeded, a status of 429 API rate limit exceeded for IP will be returned.

    PUBLIC ENDPOINTS

    We throttle public endpoints by IP: 3 requests per second.

    PRIVATE ENDPOINTS

    We throttle private endpoints by user ID: 3 requests per second.

    Authentication

    Headers

    All REST requests must contain the following headers:

    CF-API-KEY The api key as a string.

    CF-API-TIMESTAMP A timestamp for your request.

    CF-API-SIGNATURE The signature for your request (see Signing a Message).

    All request bodies should have content type application/json and be valid JSON.

    Signing a message

    To generate a signature, use this code:

    class CoinfalconExchange
      def initialize(key, secret, passphrase)
        @secret = secret # 937677a1-c1da-4f2e-b979-d38db9255658
      end
    
      def signature(request_path='', body='', method='GET')
        # Example
        # request_path = '/api/v1/user/orders'
        # method = 'GET'
        # body = '{"market":"BTC-EUR"}'
        # payload = 'GET|/api/v1/user/orders|{"market":"BTC-EUR"}'
    
        body = body.to_json if body.is_a?(Hash)
        payload = "#{method}|#{request_path}|#{body}"
    
        # create a sha256 hmac with the secret
        hash = OpenSSL::HMAC.hexdigest('sha256', secret, payload)
      end
    end
    

    The CF-API-SIGNATURE header is generated by creating a sha256 HMAC using the secret key on the prehash string method|requestPath|params.

    The params is the request body string or the GET parameters or omitted if there is no request body (typically for GET requests).

    Private

    Create order

    The above command returns JSON structured like this:

    {
        "data": {
            "id": 63866,
            "market": "ETH-BTC",
            "price": "0.03993",
            "size": "1.0",
            "size_filled": "0.0",
            "status": "pending",
            "order_type": "buy",
            "operation_type": "limit_order",
            "created_at": "2017-11-03T08:46:14.354945Z"
        }
    }
    

    You can place different types of orders: limit, market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.

    HTTP Request

    POST https://coinfalcon.com/api/v1/user/orders

    Query Parameters

    Parameter Default Description
    market required Create order for specific market e.g. BTC-EUR
    operation_type required instant_order or market_order
    order_type required buy or sell left currency of market
    size required Set the size of the order
    price optional Set the price for limit_order

    Cancel order

    The above command returns JSON structured like this:

    {
        "data": {
            "id": 63866,
            "market": "ETH-BTC",
            "price": "0.03993",
            "size": "1.0",
            "size_filled": "0.0",
            "status": "canceled",
            "order_type": "buy",
            "operation_type": "limit_order",
            "created_at": "2017-11-03T08:46:14.354945Z"
        }
    }
    

    Cancel a previously placed order.

    HTTP Request

    DELETE https://coinfalcon.com/api/v1/user/orders

    Query Parameters

    Parameter Default Description
    id required Order id

    List orders

    The above command returns JSON structured like this:

    {
        "data": [
            {
                "id": 65360,
                "market_name": "BTC-EUR",
                "price": "6420.0",
                "size": "0.1",
                "size_filled": "0.1",
                "status": "fulfilled",
                "order_type": "buy",
                "operation_type": "market_order",
                "created_at": "2017-11-06T09:54:42.723945Z"
            },
            {
                "id": 65361,
                "market_name": "BTC-EUR",
                "price": "6419.0",
                "size": "0.1",
                "size_filled": "0.1",
                "status": "fulfilled",
                "order_type": "buy",
                "operation_type": "market_order",
                "created_at": "2017-11-06T09:53:08.383210Z"
            }
        ]
    }
    

    List your current open orders. Only open or un-settled orders are returned. As soon as an order is no longer open and settled, it will no longer appear in the default request.

    HTTP Request

    GET https://coinfalcon.com/api/v1/user/orders

    Query Parameters

    Parameter Default Description
    market optional Get only orders from specific market e.g. BTC-EUR
    status [pending, open, partially_filled] Use all to get all types of statuses
    since_time optional Returns orders since the given datetime
    start_time optional Returns orders beginning with the given datetime
    end_time optional Returns orders ending with the given datetime

    List trades

    The above command returns JSON structured like this:

    {
        "data": [
            {
                "price": "6420.0",
                "size": "0.1",
                "created_at": "2017-11-06T09:54:42.789639Z"
            },
            {
                "price": "6419.0",
                "size": "0.1",
                "created_at": "2017-11-06T09:53:08.881138Z"
            }
        ]
    }
    

    Get a list of recent trades.

    HTTP Request

    GET https://coinfalcon.com/api/v1/user/trades

    Query Parameters

    Parameter Default Description
    since_time optional Returns orders since the given datetime
    start_time optional Returns orders beginning with the given datetime
    end_time optional Returns orders ending with the given datetime

    Public

    List trades

    The above command returns JSON structured like this:

    {
        "data": [
            {
                "price": "6226.08",
                "size": "0.09958032",
                "market_name": "BTC-EUR",
                "created_at": "2017-11-15T10:10:03.042605Z"
            },
            {
                "price": "6226.09",
                "size": "0.00041968",
                "market_name": "BTC-EUR",
                "created_at": "2017-11-15T10:09:59.949840Z"
            }
        ]
    }
    

    List the latest trades for a market.

    HTTP Request

    GET https://coinfalcon.com/api/v1/markets/:market/trades

    Query Parameters

    Parameter Default Description
    market required Get only orders from specific market e.g. BTC-EUR

    List orderbook

    The above command returns JSON structured like this:

    {
        "data": {
            "bids": [
                {
                    "price": "6225.0",
                    "size": "0.01"
                },
                {
                    "price": "6220.14",
                    "size": "1.31"
                }
            ],
            "asks": [
                {
                    "price": "6400.0",
                    "size": "0.38493686"
                },
                {
                    "price": "6400.07",
                    "size": "0.0303693"
                }
            ]
        }
    }
    

    Get a list of open orders for a market. The amount of detail shown can be customized with the level parameter.

    HTTP Request

    GET https://coinfalcon.com/api/v1/markets/:market/orders

    Query Parameters

    Parameter Default Description
    market required Get only orders from specific market e.g. BTC-EUR
    level 1 Defines the level of the request

    Level Parameter

    Level Description
    1 Only the best bid and ask
    2 Top 50 bids and asks (aggregated)
    3 Full order book (non aggregated)