Files
ritmex-bot/docs/binance/binance-spot/websocket-api_authentication-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

112 lines
4.0 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Authentication requests | Binance Open Platform"
source: "https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests"
fetched_at: "2026-02-26T10:38:12.599Z"
---
**Note:** Only _Ed25519_ keys are supported for this feature.
### Log in with API key (SIGNED)[](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests)
```
{ "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", "method": "session.logon", "params": { "apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A", "signature": "1cf54395b336b0a9727ef27d5d98987962bc47aca6e13fe978612d0adee066ed", "timestamp": 1649729878532 }}
```
Authenticate WebSocket connection using the provided API key.
After calling `session.logon`, you can omit `apiKey` and `signature` parameters for future requests that require them.
Note that only one API key can be authenticated. Calling `session.logon` multiple times changes the current authenticated API key.
**Weight:** 2
**Parameters:**
Name
Type
Mandatory
Description
`apiKey`
STRING
YES
`recvWindow`
DECIMAL
NO
The value cannot be greater than `60000`.
Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.
`signature`
STRING
YES
`timestamp`
LONG
YES
**Data Source:** Memory
**Response:**
```
{ "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", "status": 200, "result": { "apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A", "authorizedSince": 1649729878532, "connectedSince": 1649729873021, "returnRateLimits": false, "serverTime": 1649729878630, "userDataStream": false // is User Data Stream subscription active? }}
```
### Query session status[](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests)
```
{ "id": "b50c16cd-62c9-4e29-89e4-37f10111f5bf", "method": "session.status"}
```
Query the status of the WebSocket connection, inspecting which API key (if any) is used to authorize requests.
**Weight:** 2
**Parameters:** NONE
**Data Source:** Memory
**Response:**
```
{ "id": "b50c16cd-62c9-4e29-89e4-37f10111f5bf", "status": 200, "result": { // if the connection is not authenticated, "apiKey" and "authorizedSince" will be shown as null "apiKey": "vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A", "authorizedSince": 1649729878532, "connectedSince": 1649729873021, "returnRateLimits": false, "serverTime": 1649730611671, "userDataStream": true // is User Data Stream subscription active? }}
```
### Log out of the session[](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests)
```
{ "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", "method": "session.logout"}
```
Forget the API key previously authenticated. If the connection is not authenticated, this request does nothing.
Note that the WebSocket connection stays open after `session.logout` request. You can continue using the connection, but now you will have to explicitly provide the `apiKey` and `signature` parameters where needed.
**Weight:** 2
**Parameters:** NONE
**Data Source:** Memory
**Response:**
```
{ "id": "c174a2b1-3f51-4580-b200-8528bd237cb7", "status": 200, "result": { "apiKey": null, "authorizedSince": null, "connectedSince": 1649729873021, "returnRateLimits": false, "serverTime": 1649730611671, "userDataStream": false // is User Data Stream subscription active? }}
```
- [Log in with API key (SIGNED)](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests)
- [Query session status](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests)
- [Log out of the session](https://developers.binance.com/docs/binance-spot-api-docs/websocket-api/authentication-requests)