### Example GET Request for RFQ Conversions Source: https://docs.bitso.com/bitso-api/docs/get-rfq-conversion-history This example demonstrates how to make a GET request to the Bitso API to retrieve RFQ conversions. It includes optional query parameters for filtering by status and controlling the page size. The response provides details about the conversions, including a token for retrieving subsequent pages. ```http GET https://api.bitso.com/rfq/v1/conversions?status=COMPLETED&page_size=1 ``` -------------------------------- ### List Margin Movements (GET Request Example) Source: https://docs.bitso.com/bitso-api/docs/list-margin-movements Example of how to make a GET request to the Bitso API to list margin funding movements. This demonstrates constructing the URL with optional query parameters for pagination. ```bash curl -X GET "https://api.bitso.com/margin_trading/v1alpha/movements?page_size=10&page_token=your_page_token" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### List Pairs Request Example (GET) Source: https://docs.bitso.com/bitso-api/docs/list-pairs Demonstrates how to make a GET request to the Bitso API to retrieve a list of trading pairs. Optional query parameters 'source' and 'target' can be used to filter the results. This is a basic HTTP request structure. ```HTTP GET https://api.bitso.com/rfq/v1/pairs?source=BTC ``` -------------------------------- ### Fetch Available Books - cURL Example Source: https://docs.bitso.com/bitso-api/docs/list-available-books Example using cURL to fetch a list of available trading books and their associated fee structures from the Bitso API. This request retrieves data about trading pairs and their pricing, margin, and fee details. ```shell curl https://stage.bitso.com/api/v3/available_books ``` -------------------------------- ### Get Margin Available Currencies (JSON Example) Source: https://docs.bitso.com/bitso-api/docs/get-margin-available-currencies Example JSON payload for the 'Get Margin Available Currencies' endpoint. It details the structure of the response, listing each available currency with its code, hourly interest rate for borrowed amounts, and the discount factor used for collateral valuation. ```json { "currencies": [ { "currency_code": "btc", "interest_rate": "0.0001", "discount_factor": "0.9" }, { "currency_code": "eth", "interest_rate": "0.00012", "discount_factor": "0.85" }, { "currency_code": "usd", "interest_rate": "0.00008", "discount_factor": "1.0" } ] } ``` -------------------------------- ### Bitso API Account Balance Response Example (JSON) Source: https://docs.bitso.com/bitso-api/docs/get-account-balance An example JSON object illustrating the structure of the account balance response from the Bitso API. It includes fields like currency, total, locked, available, pending_deposit, and pending_withdrawal. ```json { "success": true, "payload": { "balances": [{ "currency": "mxn", "total": "300.00", "locked": "25.1234", "available": "274.8766", "pending_deposit": "0.00000000", "pending_withdrawal": "200.00000000" }, { "currency": "btc", "total": "100.12345678", "locked": "25.00000000", "available": "75.12345678", "pending_deposit": "10.00000000", "pending_withdrawal": "0.00000000" }, { "currency": "eth", "total": "50.1234", "locked": "40.1234", "available": "10.0000", "pending_deposit": "0.00000000", "pending_withdrawal": "0.00000000" }] } } ``` -------------------------------- ### RFQ Conversions Response Payload Example Source: https://docs.bitso.com/bitso-api/docs/get-rfq-conversion-history This is an example of the JSON payload returned by the `GET /conversions` endpoint. It includes a list of conversion objects, each with details like ID, currencies, amounts, rate, status, and timestamps. It also contains a `next_page_token` for pagination and the `total_count` of conversions. ```json { "conversions": [ { "id": "38c441b2-b192-401d-a33e-8c36d03ad90c", "source": "USDT", "target": "BTC", "source_amount": "10.0000000000", "target_amount": "0.0000866500", "quote_id": "38c441b2-b192-401d-a33e-8c36d03ad90c", "rate": "115406.8090017311", "status": "COMPLETED", "quoted_at": "2025-08-07T10:26:42Z", "created_at": "2025-08-07T10:26:42Z", "updated_at": "2025-08-07T10:26:43Z" } ], "next_page_token": "eyJwYXlsb2FkIjoiMiIsInNpZ25hdHVyZSI6InRuaWQwQ3BVRmdOS3E1dUMifQ", "total_count": 4 } ``` -------------------------------- ### Create Margin Account Response Example Source: https://docs.bitso.com/bitso-api/docs/create-margin-account Example JSON response when a margin account is successfully created or already exists. It includes the account status, margin levels, financial figures, and balances. ```json { "status": "ACTIVE", "margin_levels": { "current": "2.5", "safe": "1.5", "maintenance": "1.1" }, "margin_figures": { "currency": "usd", "total_assets": "10000.00", "total_liabilities": "4000.00", "trading_power": "5000.00" }, "balances": [ { "currency": "btc", "net_amount": "0.50000000" }, { "currency": "usd", "net_amount": "-1000.00" } ] } ``` -------------------------------- ### Update Order JSON Payload Example Source: https://docs.bitso.com/bitso-api/docs/modify-an-order Provides an example of a JSON request body used for updating an order. It includes optional parameters like 'major', 'minor', 'price', 'stop', and 'cancel'. At least one of 'major', 'minor', 'price', or 'stop' must be present. ```JSON { "major": "0.1", "price": "10000.00", "cancel": "0" } ``` -------------------------------- ### Get RFQ Conversion Details (Example) Source: https://docs.bitso.com/bitso-api/docs/get-rfq-conversion This snippet demonstrates how to make a GET request to retrieve specific RFQ conversion details using the conversion ID. It requires the conversion ID as a path parameter. The response includes transaction details such as source, target, amounts, rate, and status. ```HTTP GET https://api.bitso.com/rfq/v1/conversions/38af5e7e-2dd0-4af0-a03c-895662a1ea21 ``` -------------------------------- ### Create Signed HTTP GET Request (Shell) Source: https://docs.bitso.com/bitso-api/docs/create-signed-requests This script demonstrates how to create a signed HTTP GET request to the Bitso API using shell commands. It requires `httpie` and `openssl` to be installed. The script constructs the authentication header by calculating an HMAC-SHA256 signature based on the nonce, HTTP method, request path, and an empty JSON payload. ```shell #!/bin/bash # requires: # -httpie: https://github.com/jkbrzt/httpie URL="https://stage.bitso.com/api/v3/balance/" #Use your Bitso credentials API_KEY="vToM******" API_SECRET="*****197c28f2b782ed5ae**********" SECS=$(date +%s) DNONCE=$(expr 1000 '*' "$SECS") HTTPmethod=GET JSONPayload="" RequestPath="/api/v3/balance/" SIGNATURE=$(echo -n $DNONCE$HTTPmethod$RequestPath$JSONPayload | openssl dgst -binary -sha256 -hmac $API_SECRET | xxd -p -c 256 ) AUTH_HEADER="Bitso $API_KEY:$DNONCE:$SIGNATURE" http GET $URL Authorization:"$AUTH_HEADER" ``` -------------------------------- ### Create Margin Account Error Response Example Source: https://docs.bitso.com/bitso-api/docs/create-margin-account Example JSON response when an error occurs, such as the user not being eligible to create a margin account. It contains an array of errors with their respective codes and messages. ```json { "errors": [ { "code": "not_eligible_user", "message": "User is not eligible to create a margin account." } ] } ``` -------------------------------- ### GET /ticker/ Source: https://docs.bitso.com/bitso-api/docs/ticker Retrieves trading information from the specified book using the /ticker/ endpoint. ```APIDOC ## GET /ticker/ ### Description Retrieves trading information from the specified book. ### Method GET ### Endpoint https://stage.bitso.com/api/v3/ticker ### Parameters #### Query Parameters - **book** (string) - Required - Specifies which book to use. ### Response #### Success Response (200) - **[Fields will vary based on the book specified]** - Description of the ticker data returned. ``` -------------------------------- ### GET /available_books/ Source: https://docs.bitso.com/bitso-api/docs/list-available-books Retrieves a list of existing exchange order books and their respective order placement limits. ```APIDOC ## GET /available_books/ ### Description Retrieves a list of existing exchange order books and their respective order placement limits. ### Method GET ### Endpoint /v3/available_books ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **data** (object) - Contains the list of available books and their limits. - **book** (string) - The name of the order book. - **minimum_amount** (number) - The minimum amount for an order in this book. - **maximum_amount** (number) - The maximum amount for an order in this book. - **minimum_price** (number) - The minimum price for an order in this book. - **maximum_price** (number) - The maximum price for an order in this book. - **minimum_amount_of_funds** (number) - The minimum amount of funds for an order in this book. - **maximum_amount_of_funds** (number) - The maximum amount of funds for an order in this book. - **fund_currency** (string) - The currency of the funds. - **traded_currency** (string) - The currency being traded. - **order_types** (array) - Allowed order types for this book. #### Response Example ```json { "status": "success", "data": [ { "book": "btc_mxn", "minimum_amount": "0.0001", "maximum_amount": "1000000", "minimum_price": "1", "maximum_price": "10000000", "minimum_amount_of_funds": "10", "maximum_amount_of_funds": "10000000", "fund_currency": "mxn", "traded_currency": "btc", "order_types": ["market", "limit", "stop_limit"] } ] } ``` ``` -------------------------------- ### GET /orders/{oid} Source: https://docs.bitso.com/bitso-api/docs/look-up-orders Retrieve the details of a specific order using its Bitso-supplied identifier as a path parameter. ```APIDOC ## GET /orders/{oid} ### Description Retrieve the details of a specific order using its Bitso-supplied identifier. ### Method GET ### Endpoint https://stage.bitso.com/api/v3/orders/{oid} ### Parameters #### Path Parameters - **oid** (string) - Optional - Specifies the Bitso-supplied identifier of the order to retrieve. ### Request Example ```json { "oid": "some_order_id" } ``` ### Response #### Success Response (200) - **order** (object) - Contains the details of the order. - **id** (string) - The Bitso-supplied order ID. - **origin_id** (string) - The user-supplied order ID. - **amount** (string) - The amount of the order. - **currency** (string) - The currency pair of the order. - **type** (string) - The type of order (buy or sell). - **order_type** (string) - The type of order (market or limit). - **price** (string) - The price of the order (for limit orders). - **created_at** (string) - The timestamp when the order was created. - **updated_at** (string) - The timestamp when the order was last updated. - **state** (string) - The current state of the order (e.g., pending, partial_fill, filled, canceled). #### Response Example ```json { "success": true, "data": { "order": { "id": "12345", "origin_id": "user_order_1", "amount": "1.00000000", "currency": "btc_mxn", "type": "buy", "order_type": "limit", "price": "10000.00000000", "created_at": "2024-01-01T10:00:00Z", "updated_at": "2024-01-01T10:05:00Z", "state": "partial_fill" } } } ``` ``` -------------------------------- ### Execute Conversion Response Example Source: https://docs.bitso.com/bitso-api/docs/execute-a-conversion-quote Example of a successful JSON response when executing a conversion quote. The 'payload' contains the 'oid', which is the unique identifier for the executed conversion and is used to get its status. ```json { "success": true, "payload": { "oid": "7316" } } ``` -------------------------------- ### Place a Margin Order Source: https://docs.bitso.com/bitso-api/docs/place-margin-order This section explains how to place a margin order by using the standard 'Place an Order' endpoint with a specific parameter for margin orders. It also outlines the prerequisites for margin trading. ```APIDOC ## POST /api/orders ### Description Places a margin order. This endpoint is used for both regular and margin orders. For margin orders, the `margin_order_type` parameter must be set. ### Method POST ### Endpoint /api/orders ### Parameters #### Query Parameters - **margin_order_type** (string) - Required - Specifies the type of margin order. Use `CROSS_MARGIN` for placing a cross-margin order. #### Request Body - **book** (string) - Required - The trading pair for the order (e.g., `btc_mxn`). - **side** (string) - Required - The order side, either `buy` or `sell`. - **fund_amount** (number) - Required - The amount of the base currency to trade. - **order_type** (string) - Required - The type of order, e.g., `limit` or `market`. - **limit_price** (number) - Required if `order_type` is `limit` - The price at which to execute the order. - **time_in_force** (string) - Optional - The duration for which the order remains active (e.g., `GTC`, `FOK`, `IOC`). ### Request Example ```json { "book": "btc_mxn", "side": "buy", "fund_amount": 0.001, "order_type": "limit", "limit_price": 50000, "margin_order_type": "CROSS_MARGIN" } ``` ### Response #### Success Response (200) - **order_id** (string) - The unique identifier for the placed order. - **status** (string) - The current status of the order (e.g., `pending`, `open`, `filled`). - **created_at** (string) - The timestamp when the order was created. - **fund_amount** (string) - The amount of funds for the order. - **acciones** (string) - The amount of shares or currency to be traded. #### Response Example ```json { "order_id": "12345", "status": "open", "created_at": "2023-10-27T10:00:00Z", "fund_amount": "0.001", "acciones": "0.001" } ``` ### Prerequisites Before placing margin orders, ensure the following conditions are met: 1. **Margin Account Funding**: Your margin account must be funded with the required collateral. Use the [Process Margin Funds Movement](https://docs.bitso.com/bitso-api/docs/process-margin-funds-movement) endpoint with `DEPOSIT` movement type. 2. **Check Book Availability**: Margin orders are only supported on books where `margin_enabled` is `true`. Verify using the [List Available Books](https://docs.bitso.com/bitso-api/docs/list-available-books) endpoint. 3. **Currency Configurations**: Understand interest rates and collateral discount factors using the [Get Margin Available Currencies](https://docs.bitso.com/bitso-api/docs/get-margin-available-currencies) endpoint. 4. **Margin Level Requirements**: Maintain a margin level above the safe threshold. Monitor and check thresholds using the [Get Margin Account Summary](https://docs.bitso.com/bitso-api/docs/get-margin-account-summary) endpoint. ``` -------------------------------- ### Update Order Request Examples Source: https://docs.bitso.com/bitso-api/docs/modify-an-order Demonstrates different ways to construct the PATCH request URL for updating an order. It shows how to specify the order identifier using a path parameter or query parameters (oid or origin_id). ```HTTP PATCH https://stage.bitso.com/api/v4/orders/`{oid}` PATCH https://stage.bitso.com/api/v4/orders?oid=`{oid}` PATCH https://stage.bitso.com/api/v4/orders?origin_id=`{origin_id}` ``` -------------------------------- ### List Pairs Response Payload Example (JSON) Source: https://docs.bitso.com/bitso-api/docs/list-pairs Provides an example of the JSON payload returned by the Bitso API's GET /pairs endpoint. The response is an array of objects, where each object represents a trading pair with its source, target, and precision details. ```JSON { "pairs": [ { "source": "BTC", "target": "USDT", "source_precision": "8", "target_precision": "6" }, { "source": "USDT", "target": "BTC", "source_precision": "6", "target_precision": "8" }, { "source": "USDT", "target": "MXN", "source_precision": "8", "target_precision": "2" }, { "source": "MXN", "target": "USDT", "source_precision": "2", "target_precision": "8" } ] } ``` -------------------------------- ### RFQ Conversion Error Response Example Source: https://docs.bitso.com/bitso-api/docs/get-rfq-conversion This JSON payload illustrates an error response from the Bitso API when an RFQ conversion is not found. It contains an 'errors' array with details about the error code and message. ```JSON { "errors": [ { "code": "rfq_conversion_not_found", "message": "Transaction not found" } ] } ``` -------------------------------- ### POST /websites/bitso_bitso-api Source: https://docs.bitso.com/bitso-api/docs/update-an-order This endpoint allows you to place an order on the Bitso platform. You must provide at least one of the following parameters: `major`, `minor`, `price`, or `stop`. The `cancel` parameter can be used to specify if the order should be canceled if it cannot be processed immediately. ```APIDOC ## POST /websites/bitso_bitso-api ### Description Allows users to place an order on the Bitso platform. Requires at least one of `major`, `minor`, `price`, or `stop` in the request body. The `cancel` parameter can control immediate order processing behavior. ### Method POST ### Endpoint /websites/bitso_bitso-api ### Parameters #### Request Body - **`cancel`** (boolean) - Optional - A boolean flag to indicate whether to cancel the order if it cannot be processed. Set to `true` (1) to enable cancellation or `false` (0) to keep the order active. Defaults to `false` (0). - **`major`** (number) - Optional - The amount of the major currency to update. - **`minor`** (number) - Optional - The amount of the minor currency to update, the order's value. You must specify an order in terms of either `major` or `minor`, never both. - **`price`** (number) - Optional - The price in minor at which to buy or sell the amount, the rate of the major/minor combination. - **`stop`** (number) - Optional - The price per unit of major at which to stop and place the order. Use this parameter only with Stop Orders. > **Note**: The request body must not be empty. At least one of `major`, `minor`, `price`, or `stop` must be included. The `cancel` parameter cannot be sent alone. ### Request Example ```json { "major": 0.5, "price": 50000.00 } ``` ### Response #### Success Response (200) - **`oid`** (string) - The order's unique ID. #### Response Example ```json { "success": true, "payload": { "oid": "qlbga6b600n3xta7" } } ``` ``` -------------------------------- ### Bitso API Deposit Fees Response Object Example Source: https://docs.bitso.com/bitso-api/docs/list-fees This JSON object demonstrates a response from the Bitso API for deposit fees. It details the currency, deposit method, fee amount, and whether the fee is fixed for specific deposit transactions. ```json { "success":true, "payload":{ "deposit_fees":[ { "currency":"cop", "method":"bdb", "fee":"0.00", "is_fixed":false }, { "currency":"ars", "method":"bind", "fee":"0.01", "is_fixed":false } ] } } ``` -------------------------------- ### Retrieve Quote by ID (API Request) Source: https://docs.bitso.com/bitso-api/docs/retrieve-a-quote This example demonstrates how to make a GET request to the Bitso API to retrieve a specific quote using its unique identifier. The endpoint requires the quote_id as a path parameter. The response will contain the details of the quote if found, or an error if the quote does not exist or has expired. ```http GET https://api.bitso.com/rfq/v1/quotes/{quote_id} ``` -------------------------------- ### Get Account Balance Source: https://docs.bitso.com/bitso-api/docs/get-account-balance Retrieves account balances for all Bitso-supported currencies using the GET /balance/ method. ```APIDOC ## GET /balance/ ### Description Retrieves information related to your account balances for all Bitso-supported currencies. ### Method GET ### Endpoint https://stage.bitso.com/api/v3/balance ### Parameters #### Header Parameters - **key** (string) - Required - See the section, Authorization - **signature** (string) - Required - See the section, Authorization - **nonce** (string) - Required - See the section, Authorization ### Request Example ``` GET /api/v3/balance HTTP/1.1 Host: stage.bitso.com Authorization: ... ``` ### Response #### Success Response (200) - **balances** (array) - An array of balance objects, each containing currency, total, available, and pending amounts. - **success** (boolean) - Indicates if the request was successful. #### Response Example ```json { "data": { "balances": [ { "currency": "btc", "total": "0.1", "available": "0.09", "pending": "0.01" }, { "currency": "mxn", "total": "1000.00", "available": "950.00", "pending": "50.00" } ] }, "success": true } ``` ``` -------------------------------- ### POST /order Source: https://docs.bitso.com/bitso-api/docs/replace-an-order This endpoint allows you to place a new order on the Bitso platform. You must provide at least one of the following parameters: `major`, `minor`, `price`, or `stop`. The request body must be JSON encoded. ```APIDOC ## POST /order ### Description Place a new order on the Bitso platform. Requires at least one of `major`, `minor`, `price`, or `stop` in the request body. ### Method POST ### Endpoint /order ### Parameters #### Request Body - **major** (float) - Optional - The amount of the major currency to update. - **minor** (float) - Optional - The amount of the minor currency to update. Use only with Stop-Loss Orders. Specify order in terms of `major` or `minor`, never both. - **origin_id** (string) - Optional - The order's client-supplied, unique ID. Valid characters: `a-z`, `A-Z`, `0-9`, `_`, `-`. Max length: 40 characters. - **price** (float) - Optional - The price in minor at which to buy or sell the amount. - **stop** (float) - Optional - The price per unit of major at which to stop and place the order. Use only with Stop Orders. > The request body cannot be empty. Your request must include at least one of the possible body parameters. ### Request Example ```json { "major": 0.0001, "price": 20000, "origin_id": "my_custom_order_id_123" } ``` ### Response #### Success Response (200) - **oid** (string) - The replacement order's unique ID. #### Response Example ```json { "success": true, "payload": { "oid": "qlbga6b600n3xta7" } } ``` ``` -------------------------------- ### GET /orders?oids={oid},{oid} Source: https://docs.bitso.com/bitso-api/docs/look-up-orders Retrieve the details of multiple orders using their Bitso-supplied identifiers as a query parameter. ```APIDOC ## GET /orders?oids={oid},{oid} ### Description Retrieve the details of multiple orders by specifying their Bitso-supplied identifiers using the `oids` query parameter. ### Method GET ### Endpoint https://stage.bitso.com/api/v3/orders?oids={oid},{oid},{oid} ### Parameters #### Query Parameters - **oids** (string) - Optional - Specifies the Bitso-supplied identifiers of the orders to retrieve. Use a comma to separate multiple IDs. ### Request Example ```json { "oids": "order_id_1,order_id_2,order_id_3" } ``` ### Response #### Success Response (200) - **orders** (array) - An array of order objects, each containing the details of an order. - **id** (string) - The Bitso-supplied order ID. - **origin_id** (string) - The user-supplied order ID. - **amount** (string) - The amount of the order. - **currency** (string) - The currency pair of the order. - **type** (string) - The type of order (buy or sell). - **order_type** (string) - The type of order (market or limit). - **price** (string) - The price of the order (for limit orders). - **created_at** (string) - The timestamp when the order was created. - **updated_at** (string) - The timestamp when the order was last updated. - **state** (string) - The current state of the order (e.g., pending, partial_fill, filled, canceled). #### Response Example ```json { "success": true, "data": { "orders": [ { "id": "12345", "origin_id": "user_order_1", "amount": "1.00000000", "currency": "btc_mxn", "type": "buy", "order_type": "limit", "price": "10000.00000000", "created_at": "2024-01-01T10:00:00Z", "updated_at": "2024-01-01T10:05:00Z", "state": "partial_fill" }, { "id": "67890", "origin_id": "user_order_2", "amount": "0.50000000", "currency": "eth_mxn", "type": "sell", "order_type": "market", "price": null, "created_at": "2024-01-01T11:00:00Z", "updated_at": "2024-01-01T11:00:00Z", "state": "filled" } ] } } ``` ``` -------------------------------- ### Get RFQ Conversion Source: https://docs.bitso.com/bitso-api/docs/get-rfq-conversion Retrieve details of a specific RFQ conversion transaction using its unique conversion ID. ```APIDOC ## GET /rfq/v1/conversions/{conversion_id} ### Description Retrieve details of a specific RFQ conversion transaction using its unique conversion ID. ### Method GET ### Endpoint `https://api.bitso.com/rfq/v1/conversions/{conversion_id}` ### Parameters #### Path Parameters - **conversion_id** (string) - Required - The unique identifier of the RFQ conversion ### Request Example `GET https://api.bitso.com/rfq/v1/conversions/38af5e7e-2dd0-4af0-a03c-895662a1ea21` ### Response #### Success Response (200) - **id** (string) - Unique conversion transaction ID - **source** (string) - Source currency (what was sold) - **target** (string) - Target currency (what was bought) - **source_amount** (string) - Amount of source currency converted - **target_amount** (string) - Amount of target currency received - **quote_id** (string) - Original quote ID that was executed - **rate** (string) - Exchange rate applied (including fees) - **status** (string) - Conversion status: `INITIATED`, `TERMINATED`, `COMPLETED`, `FAILED` - **quoted_at** (string) - When the original quote was created - **created_at** (string) - When the conversion was executed - **updated_at** (string) - Last update timestamp #### Response Example ```json { "id": "38af5e7e-2dd0-4af0-a03c-895662a1ea21", "source": "USDT", "target": "BTC", "source_amount": "68206.00", "target_amount": "1.0", "quote_id": "38af5e7e-2dd0-4af0-a03c-895662a1ea21", "rate": "68206.00", "status": "COMPLETED", "quoted_at": "2025-08-04T20:50:33Z", "created_at": "2024-06-24T14:15:22Z", "updated_at": "2024-06-24T14:15:22Z" } ``` ### Error #### Error Responses - **400** - `bad_request` - Invalid conversion ID format - **403** - `forbidden_request` - User not allowed to access this conversion - **404** - `rfq_conversion_not_found` - Transaction not found #### Error Example ```json { "errors": [ { "code": "rfq_conversion_not_found", "message": "Transaction not found" } ] } ``` ``` -------------------------------- ### GET /margin_trading/v1alpha/currencies Source: https://docs.bitso.com/bitso-api/docs/get-margin-available-currencies Fetches a list of all currencies available for margin trading. This includes configuration details such as interest rates for borrowed amounts and discount factors for collateral valuation. ```APIDOC ## GET /margin_trading/v1alpha/currencies ### Description Returns a list of all currencies available for margin trading with their configuration, including interest rates applied to borrowed amounts and discount factors used for collateral valuation. ### Method GET ### Endpoint https://api.bitso.com/margin_trading/v1alpha/currencies ### Parameters This endpoint requires no request parameters. ### Response #### Success Response (200) - **currencies** (array) - List of available currencies for margin trading. - **currency_code** (string) - Currency code. - **interest_rate** (string) - Hourly interest rate applied to borrowed amounts. This rate is charged when you borrow this currency for margin trading. - **discount_factor** (string) - Discount factor used for collateral valuation. This factor is applied when using this currency as collateral #### Response Example ```json { "currencies": [ { "currency_code": "btc", "interest_rate": "0.0001", "discount_factor": "0.9" }, { "currency_code": "eth", "interest_rate": "0.00012", "discount_factor": "0.85" }, { "currency_code": "usd", "interest_rate": "0.00008", "discount_factor": "1.0" } ] } ``` ``` -------------------------------- ### Quote Error Response Example (JSON) Source: https://docs.bitso.com/bitso-api/docs/request-a-quote Example JSON payload for an error response when requesting a quote. It includes an array of errors, each with an error code and a descriptive message, indicating why the request failed. ```json { "errors": [ { "code": "invalid_provided_amount", "message": "Incorrect provided amount" } ] } ``` -------------------------------- ### Bitso API Trading Fees Response Object Example Source: https://docs.bitso.com/bitso-api/docs/list-fees This JSON object represents a typical response from the Bitso API when querying trading fees. It includes details about maker and taker fees, fee percentages and decimals, and volume-based fee tiers. ```json { "success":true, "payload":{ "fees":[ { "book":"btc_mxn", "fee_percent":"0.6500", "fee_decimal":"0.00650000", "taker_fee_percent":"0.6500", "taker_fee_decimal":"0.00650000", "maker_fee_percent":"0.5000", "maker_fee_decimal":"0.00500000", "volume_currency":"mxn", "current_volume":"4375.99", "next_volume":"1500000.00", "next_maker_fee_percent":"0.490", "next_taker_fee_percent":"0.637", "nextVolume":"1500000.00", "nextFee":"0.490", "nextTakerFee":"0.637" }, { "book":"eth_btc", "fee_percent":"0.0980", "fee_decimal":"0.00098000", "taker_fee_percent":"0.0980", "taker_fee_decimal":"0.00098000", "maker_fee_percent":"0.0750", "maker_fee_decimal":"0.00075000", "volume_currency":"btc", "current_volume":"0.00000000", "next_volume":"8.00000000", "next_maker_fee_percent":"0.072", "next_taker_fee_percent":"0.094", "nextVolume":"8.00000000", "nextFee":"0.072", "nextTakerFee":"0.094" } ] } } ``` -------------------------------- ### GET /websites/bitso_bitso-api Source: https://docs.bitso.com/bitso-api/docs/look-up-orders Retrieves a list of open orders from the Bitso API. The response includes details about each order, such as its ID, creation timestamp, amounts, price, status, and more. Note that this endpoint primarily returns 'queued', 'open', or 'partially filled' orders, with a limited window for retrieving 'cancelled' or 'completed' orders. ```APIDOC ## GET /websites/bitso_bitso-api ### Description Retrieves a list of open orders from the Bitso API. The response includes details about each order, such as its ID, creation timestamp, amounts, price, status, and more. Note that this endpoint primarily returns 'queued', 'open', or 'partially filled' orders, with a limited window for retrieving 'cancelled' or 'completed' orders. ### Method GET ### Endpoint /websites/bitso_bitso-api ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) An array of JSON objects, where each object represents an open order and contains the following fields: - **`book`** (String) - The order book symbol. - **`created_at`** (String) - The date and time when the service created the order (ISO 8601 timestamp). - **`oid`** (String) - The order's ID. - **`original_amount`** (String) - The order's initial major currency amount. - **`origin_id`** (String) - The order's client-supplied, unique ID (if any). - **`original_value`** (String) - The order's initial minor currency amount. - **`price`** (String) - The order's price. - **`side`** (String) - The order's side (`buy` or `sell`). - **`status`** (String) - The order's status (`queued`, `open`, `partially filled`, `cancelled`, or `completed`). - **`stop`** (String) - The stop price for Stop Orders. - **`time_in_force`** (String) - The time in force parameter for Limit Orders. - **`triggered_at`** (String) - The date and time when the service triggered a Stop Order (ISO 8601 timestamp). - **`type`** (String) - The order's type (`market` or `limit`). - **`unfilled_amount`** (String) - The order's unfilled major currency amount. - **`updated_at`** (String) - The date and time when the service updated the order (ISO 8601 timestamp). - **`cancellation_reason`** (String, optional/nullable) - The reason for cancellation, included only if `status` is `cancelled`. - **`margin_order_type`** (String, optional) - The margin order type (e.g., `CROSS_MARGIN`), only returned for margin orders. #### Response Example ```json [ { "book": "btc_mxn", "created_at": "2023-10-27T10:00:00.000Z", "oid": "12345", "original_amount": "0.1", "origin_id": "my_unique_id_1", "original_value": "1000.00", "price": "10000.00", "side": "buy", "status": "open", "stop": null, "time_in_force": "gtc", "triggered_at": null, "type": "limit", "unfilled_amount": "0.1", "updated_at": "2023-10-27T10:00:00.000Z", "cancellation_reason": null, "margin_order_type": null } ] ``` ``` -------------------------------- ### Create WebSocket Instance (JavaScript) Source: https://docs.bitso.com/bitso-api/docs/general Initializes a WebSocket connection to the Bitso API. This is the first step to interacting with the WebSocket service. ```javascript websocket = new WebSocket('wss://ws.bitso.com'); ```