2. Bitso API Authentication

Creating Account

  • Create an account in Bitso staging environment stage.bitso
  • Create an API key inside that account
  • Send an email to developers@bitso.com to request funds for your Bitso testing account

Bitso API Authentication

To generate a signature for an HTTP request, you must create a hash-based message authentication code (HMAC) that uses the hash function SHA-256.

To create an SHA-256 HMAC, use your generated Bitso API Secret as the cryptographic key on the concatenation of

nonce + HTTP method + request path + JSON payload

Do not include the plus signs, +, in the concatenated string. Hex encode the obtained output.

Ensure the following is true when creating the signature:

  • The nonce value is the same as the nonce field in the Authorization header.
  • The request path and JSON payload values are precisely the same as those used in the request.

Construct the header with the fields described at the beginning of the article as follows:

`Auth_Header`: Bitso <`key`>:<`nonce`>:<`signature`>

Placing an order

This documentation explains how to use the Bitso API to place an order for buying or selling cryptocurrencies.

HTTP Request:

  • Method: POST
  • URL: https://sandbox.bitso.com/api/v3/orders/

Body Parameters:

  • These are parameters included in the body of the POST request, encoded in JSON format.

Required parameters

  • book: Specifies the trading pair (e.g., BTC/USD
  • side: Specifies whether the order is a buy or sell order
  • type: Specifies the order type, either market or limit.

Optional parameters

  • major: The amount of major currency for the order (e.g., BTC).
  • minor: The amount of minor currency for the order (e.g., USD
  • origin_id: A client-supplied unique ID for the order
  • price: The price per unit of major currency. Only used with Limit Orders
  • stop: The price per unit of major currency at which to trigger a stop order
  • time_in_force: Specifies how long the order will remain active before it's executed or expires.

Depending on the type of order (market or limit), different parameters are required

  • For a market order, you'd typically specify the trading pair (book), the side (buy or sell), and the order type (market). Optionally, you can include the major or minor parameters to specify the amount.
  • For a limit order, in addition to the above parameters, you also need to include the price parameter to specify the price at which you want the order to be executed.
  • There are also optional parameters for additional customization, such as stop for stop orders and time_in_force to specify how long the order will remain active.

Major and minor currencies

  • The terms "major" and "minor" currencies refer to the currencies involved in a trading pair. For example, let's consider a trading pair like BTC/USD.
    • BTC is the major currency.
    • USD is the minor currency.
  • When placing an order, you have the option to specify the amount in terms of either the major currency (BTC in this example) or the minor currency (USD in this example).
  • If you specify the amount in terms of the major currency (e.g., BTC), you're indicating how much of that major currency you want to buy or sell.
  • If you specify the amount in terms of the minor currency (e.g., USD), you're indicating how much of that minor currency you want to spend or receive in exchange.