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.
This commit is contained in:
Disney
2026-02-27 11:37:44 +08:00
committed by GitHub
parent 422ee6f465
commit d6399b92aa
588 changed files with 96879 additions and 106 deletions
@@ -0,0 +1,138 @@
---
title: "General endpoints | Binance Open Platform"
source: "https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/general-endpoints"
fetched_at: "2026-02-26T10:38:10.484Z"
---
### Test connectivity[](https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/general-endpoints)
```
GET /api/v3/ping
```
Test connectivity to the Rest API.
**Weight:** 1
**Parameters:** NONE
**Data Source:** Memory
**Response:**
```
{}
```
### Check server time[](https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/general-endpoints)
```
GET /api/v3/time
```
Test connectivity to the Rest API and get the current server time.
**Weight:** 1
**Parameters:** NONE
**Data Source:** Memory
**Response:**
```
{ "serverTime": 1499827319559}
```
### Exchange information[](https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/general-endpoints)
```
GET /api/v3/exchangeInfo
```
Current exchange trading rules and symbol information
**Weight:** 20
**Parameters:**
Name
Type
Mandatory
Description
symbol
STRING
No
Example: curl -X GET "[https://api.binance.com/api/v3/exchangeInfo?symbol=BNBBTC](https://api.binance.com/api/v3/exchangeInfo?symbol=BNBBTC)"
symbols
ARRAY OF STRING
No
Examples: curl -X GET "[https://api.binance.com/api/v3/exchangeInfo?symbols=%5B%22BNBBTC%22,%22BTCUSDT%22%5D](https://api.binance.com/api/v3/exchangeInfo?symbols=%5B%22BNBBTC%22,%22BTCUSDT%22%5D)"
or
curl -g -X GET '[https://api.binance.com/api/v3/exchangeInfo?symbols=\["BTCUSDT","BNBBTC](https://api.binance.com/api/v3/exchangeInfo?symbols=%5B%22BTCUSDT%22,%22BNBBTC)"\]'
permissions
ENUM
No
Examples: curl -X GET "[https://api.binance.com/api/v3/exchangeInfo?permissions=SPOT](https://api.binance.com/api/v3/exchangeInfo?permissions=SPOT)"
or
curl -X GET "[https://api.binance.com/api/v3/exchangeInfo?permissions=%5B%22MARGIN%22%2C%22LEVERAGED%22%5D](https://api.binance.com/api/v3/exchangeInfo?permissions=%5B%22MARGIN%22%2C%22LEVERAGED%22%5D)"
or
curl -g -X GET '[https://api.binance.com/api/v3/exchangeInfo?permissions=\["MARGIN","LEVERAGED](https://api.binance.com/api/v3/exchangeInfo?permissions=%5B%22MARGIN%22,%22LEVERAGED)"\]'
showPermissionSets
BOOLEAN
No
Controls whether the content of the `permissionSets` field is populated or not. Defaults to `true`
symbolStatus
ENUM
No
Filters for symbols that have this `tradingStatus`.
Valid values: `TRADING`, `HALT`, `BREAK`
Cannot be used in combination with `symbols` or `symbol`.
**Notes:**
- If the value provided to `symbol` or `symbols` do not exist, the endpoint will throw an error saying the symbol is invalid.
- All parameters are optional.
- `permissions` can support single or multiple values (e.g. `SPOT`, `["MARGIN","LEVERAGED"]`). This cannot be used in combination with `symbol` or `symbols`.
- If `permissions` parameter not provided, all symbols that have either `SPOT`, `MARGIN`, or `LEVERAGED` permission will be exposed.
- To display symbols with any permission you need to specify them explicitly in `permissions`: (e.g. `["SPOT","MARGIN",...]`.). See [Account and Symbol Permissions](https://developers.binance.com/docs/binance-spot-api-docs/testnet/enums) for the full list.
**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:**
```
{ "timezone": "UTC", "serverTime": 1565246363776, "rateLimits": [ { // These are defined in the `ENUM definitions` section under `Rate Limiters (rateLimitType)`. // All limits are optional } ], "exchangeFilters": [ // These are the defined filters in the `Filters` section. // All filters are optional. ], "symbols": [ { "symbol": "ETHBTC", "status": "TRADING", "baseAsset": "ETH", "baseAssetPrecision": 8, "quoteAsset": "BTC", "quotePrecision": 8, // will be removed in future api versions (v4+) "quoteAssetPrecision": 8, "baseCommissionPrecision": 8, "quoteCommissionPrecision": 8, "orderTypes": [ "LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS", "STOP_LOSS_LIMIT", "TAKE_PROFIT", "TAKE_PROFIT_LIMIT" ], "icebergAllowed": true, "ocoAllowed": true, "otoAllowed": true, "opoAllowed": true, "quoteOrderQtyMarketAllowed": true, "allowTrailingStop": false, "cancelReplaceAllowed": false, "amendAllowed": false, "pegInstructionsAllowed": true, "isSpotTradingAllowed": true, "isMarginTradingAllowed": true, "filters": [ // These are defined in the Filters section. // All filters are optional ], "permissions": [], "permissionSets": [["SPOT", "MARGIN"]], "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"] } ]}
```
- [Test connectivity](https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/general-endpoints)
- [Check server time](https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/general-endpoints)
- [Exchange information](https://developers.binance.com/docs/binance-spot-api-docs/testnet/rest-api/general-endpoints)