Files
ritmex-bot/docs/binance/binance-spot/testnet_websocket-api_general-requests.md
T
DisneyandGitHub d6399b92aa Feat/support binance (#22)
* add docs

* Add Binance exchange support

- Updated the environment configuration to include Binance as a selectable exchange option.
- Enhanced the README documentation to reflect the addition of Binance.
- Implemented the Binance exchange adapter and integrated it into the existing exchange framework.
- Modified the basis arbitrage strategy to support Binance alongside existing exchanges.
- Added tests to ensure proper functionality and integration of Binance within the trading system.

* Enhance README with detailed Binance exchange configuration

- Added comprehensive instructions for setting up Binance as an exchange option.
- Included environment variable specifications for API keys, market types, and trading symbols.
- Provided examples for both perpetual and spot trading strategies.
- Clarified the use of WebSocket and REST for the Binance adapter.

* Enhance exchange support and testing framework

- Added a new test suite for exchange contracts to ensure consistency and functionality across supported exchanges.
- Refactored exchange ID handling to utilize a centralized list of supported exchanges, improving maintainability.
- Updated CLI argument parsing and help documentation to reflect the new exchange structure.
- Introduced utility functions for validating supported exchanges and their display names.
- Enhanced the BasisApp and strategy runner to leverage the new exchange validation logic.
- Added a new test command for running exchange-related tests.

* Refactor exchange contract tests and update CLI commands

- Removed the trailing supported exchanges set and simplified the logic for trailing stop support in the exchange contract tests.
- Updated the test command for exchange contracts to exclude unnecessary tests, streamlining the testing process.
- Enhanced test descriptions for clarity and improved understanding of the functionality being tested.
2026-02-27 11:37:44 +08:00

7.9 KiB
Raw Blame History

title, source, fetched_at
title source fetched_at
General requests | Binance Open Platform https://developers.binance.com/docs/binance-spot-api-docs/testnet/websocket-api/general-requests 2026-02-26T10:38:11.585Z

Test connectivity

{    "id": "922bcc6e-9de8-440d-9e84-7c80933a8d0d",    "method": "ping"}

Test connectivity to the WebSocket API.

Note: You can use regular WebSocket ping frames to test connectivity as well, WebSocket API will respond with pong frames as soon as possible. ping request along with time is a safe way to test request-response handling in your application.

Weight: 1

Parameters: NONE

Data Source: Memory

Response:

{    "id": "922bcc6e-9de8-440d-9e84-7c80933a8d0d",    "status": 200,    "result": {},    "rateLimits": [        {            "rateLimitType": "REQUEST_WEIGHT",            "interval": "MINUTE",            "intervalNum": 1,            "limit": 6000,            "count": 1        }    ]}

Check server time

{    "id": "187d3cb2-942d-484c-8271-4e2141bbadb1",    "method": "time"}

Test connectivity to the WebSocket API and get the current server time.

Weight: 1

Parameters: NONE

Data Source: Memory

Response:

{    "id": "187d3cb2-942d-484c-8271-4e2141bbadb1",    "status": 200,    "result": {        "serverTime": 1656400526260    },    "rateLimits": [        {            "rateLimitType": "REQUEST_WEIGHT",            "interval": "MINUTE",            "intervalNum": 1,            "limit": 6000,            "count": 1        }    ]}

Exchange information

{    "id": "5494febb-d167-46a2-996d-70533eb4d976",    "method": "exchangeInfo",    "params": {        "symbols": ["BNBBTC"]    }}

Query current exchange trading rules, rate limits, and symbol information.

Weight: 20

Parameters:

Name

Type

Mandatory

Description

symbol

STRING

NO

Describe a single symbol

symbols

ARRAY of STRING

Describe multiple symbols

permissions

ARRAY of STRING

Filter symbols by permissions

showPermissionSets

BOOLEAN

Controls whether the content of the permissionSets field is populated or not. Defaults to true.

symbolStatus

ENUM

Filters for symbols that have this tradingStatus.
Valid values: TRADING, HALT, BREAK
Cannot be used in combination with symbol or symbols

Notes:

  • Only one of symbol, symbols, permissions parameters can be specified.

  • Without parameters, exchangeInfo displays all symbols with ["SPOT, "MARGIN", "LEVERAGED"] permissions.

    • In order to list all active symbols on the exchange, you need to explicitly request all permissions.
  • permissions accepts either a list of permissions, or a single permission name. E.g. "SPOT".

  • Available Permissions

Examples of Symbol Permissions Interpretation from the Response:

  • [["A","B"]] means you may place an order if your account has either permission "A" or permission "B".
  • [["A"],["B"]] means you can place an order if your account has permission "A" and permission "B".
  • [["A"],["B","C"]] means you can place an order if your account has permission "A" and permission "B" or permission "C". (Inclusive or is applied here, not exclusive or, so your account may have both permission "B" and permission "C".)

Data Source: Memory

Response:

{    "id": "5494febb-d167-46a2-996d-70533eb4d976",    "status": 200,    "result": {        "timezone": "UTC",        "serverTime": 1655969291181,        // Global rate limits. See "Rate limits" section.        "rateLimits": [            {                "rateLimitType": "REQUEST_WEIGHT",     // Rate limit type: REQUEST_WEIGHT, ORDERS, CONNECTIONS                "interval": "MINUTE",                  // Rate limit interval: SECOND, MINUTE, DAY                "intervalNum": 1,                      // Rate limit interval multiplier (i.e., "1 minute")                "limit": 6000                          // Rate limit per interval            },            {                "rateLimitType": "ORDERS",                "interval": "SECOND",                "intervalNum": 10,                "limit": 50            },            {                "rateLimitType": "ORDERS",                "interval": "DAY",                "intervalNum": 1,                "limit": 160000            },            {                "rateLimitType": "CONNECTIONS",                "interval": "MINUTE",                "intervalNum": 5,                "limit": 300            }        ],        // Exchange filters are explained on the "Filters" page:        // https://github.com/binance/binance-spot-api-docs/blob/master/filters.md        // All exchange filters are optional.        "exchangeFilters": [],        "symbols": [            {                "symbol": "BNBBTC",                "status": "TRADING",                "baseAsset": "BNB",                "baseAssetPrecision": 8,                "quoteAsset": "BTC",                "quotePrecision": 8,                "quoteAssetPrecision": 8,                "baseCommissionPrecision": 8,                "quoteCommissionPrecision": 8,                "orderTypes": [                    "LIMIT",                    "LIMIT_MAKER",                    "MARKET",                    "STOP_LOSS_LIMIT",                    "TAKE_PROFIT_LIMIT"                ],                "icebergAllowed": true,                "ocoAllowed": true,                "otoAllowed": true,                "opoAllowed": true,                "quoteOrderQtyMarketAllowed": true,                "allowTrailingStop": true,                "cancelReplaceAllowed": true,                "amendAllowed": false,                "pegInstructionsAllowed": true,                "isSpotTradingAllowed": true,                "isMarginTradingAllowed": true,                // Symbol filters are explained on the "Filters" page:                // https://github.com/binance/binance-spot-api-docs/blob/master/filters.md                // All symbol filters are optional.                "filters": [                    {                        "filterType": "PRICE_FILTER",                        "minPrice": "0.00000100",                        "maxPrice": "100000.00000000",                        "tickSize": "0.00000100"                    },                    {                        "filterType": "LOT_SIZE",                        "minQty": "0.00100000",                        "maxQty": "100000.00000000",                        "stepSize": "0.00100000"                    }                ],                "permissions": [],                "permissionSets": [["SPOT", "MARGIN", "TRD_GRP_004"]],                "defaultSelfTradePreventionMode": "NONE",                "allowedSelfTradePreventionModes": ["NONE"]            }        ],        // Optional field. Present only when SOR is available.        // https://github.com/binance/binance-spot-api-docs/blob/master/faqs/sor_faq.md        "sors": [            {                "baseAsset": "BTC",                "symbols": ["BTCUSDT", "BTCUSDC"]            }        ]    },    "rateLimits": [        {            "rateLimitType": "REQUEST_WEIGHT",            "interval": "MINUTE",            "intervalNum": 1,            "limit": 6000,            "count": 20        }    ]}