Skip to content

Commit ac2fa1c

Browse files
author
github-actions
committed
Release v24.0.0
**Derivatives Trading Coin Futures** ### Changed (1) #### REST API - Modified response for `query_order()` (`GET /dapi/v1/order`): - property `positionSide` added **Derivatives Trading Options** ### Changed (4) #### REST API - Deleted parameter `price` - affected methods: - `new_block_trade_order()` (`POST /eapi/v1/block/order/create`) - Deleted parameter `quantity` - affected methods: - `new_block_trade_order()` (`POST /eapi/v1/block/order/create`) - Deleted parameter `side` - affected methods: - `new_block_trade_order()` (`POST /eapi/v1/block/order/create`) - Deleted parameter `symbol` - affected methods: - `new_block_trade_order()` (`POST /eapi/v1/block/order/create`) **Spot** ### Changed (4) #### REST API - Modified response for `exchange_info()` (`GET /api/v3/exchangeInfo`): - modified `exchange_filters` and `symbols`.`filters` - Modified response for `my_filters()` (`GET /api/v3/myFilters`): - modified `asset_filters`, `exchange_filters` and `symbol_filters` #### WebSocket API - Modified response for `exchange_info()` (`exchangeInfo` method): - modified `result`.`exchange_filters` and `result`.`symbols`.`filters` - Modified response for `my_filters()` (`myFilters` method): - modified `result`.`asset_filters`, `result`.`exchange_filters` and `result`.`symbol_filters`
1 parent ceb5794 commit ac2fa1c

File tree

151 files changed

+4553
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+4553
-575
lines changed

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,55 @@
11
# Changelog
22

3+
## 24.0.0 - 2025-10-09
4+
5+
**Derivatives Trading Coin Futures**
6+
7+
### Changed (1)
8+
9+
#### REST API
10+
11+
- Modified response for `query_order()` (`GET /dapi/v1/order`):
12+
- property `positionSide` added
13+
14+
**Derivatives Trading Options**
15+
16+
### Changed (4)
17+
18+
#### REST API
19+
20+
- Deleted parameter `price`
21+
- affected methods:
22+
- `new_block_trade_order()` (`POST /eapi/v1/block/order/create`)
23+
- Deleted parameter `quantity`
24+
- affected methods:
25+
- `new_block_trade_order()` (`POST /eapi/v1/block/order/create`)
26+
- Deleted parameter `side`
27+
- affected methods:
28+
- `new_block_trade_order()` (`POST /eapi/v1/block/order/create`)
29+
- Deleted parameter `symbol`
30+
- affected methods:
31+
- `new_block_trade_order()` (`POST /eapi/v1/block/order/create`)
32+
33+
**Spot**
34+
35+
### Changed (4)
36+
37+
#### REST API
38+
39+
- Modified response for `exchange_info()` (`GET /api/v3/exchangeInfo`):
40+
- modified `exchange_filters` and `symbols`.`filters`
41+
42+
- Modified response for `my_filters()` (`GET /api/v3/myFilters`):
43+
- modified `asset_filters`, `exchange_filters` and `symbol_filters`
44+
45+
#### WebSocket API
46+
47+
- Modified response for `exchange_info()` (`exchangeInfo` method):
48+
- modified `result`.`exchange_filters` and `result`.`symbols`.`filters`
49+
50+
- Modified response for `my_filters()` (`myFilters` method):
51+
- modified `result`.`asset_filters`, `result`.`exchange_filters` and `result`.`symbol_filters`
52+
353
## 23.0.0 - 2025-10-06
454

555
**Derivatives Trading Options**

Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "binance-sdk"
3-
version = "23.0.0"
3+
version = "24.0.0"
44
authors = [ "Binance" ]
55
edition = "2024"
66
resolver = "3"
@@ -2994,6 +2994,11 @@ name = "spot_rest_api_account_api_my_allocations"
29942994
path = "examples/spot/rest_api/account_api/my_allocations.rs"
29952995
required-features = [ "spot" ]
29962996

2997+
[[example]]
2998+
name = "spot_rest_api_account_api_my_filters"
2999+
path = "examples/spot/rest_api/account_api/my_filters.rs"
3000+
required-features = [ "spot" ]
3001+
29973002
[[example]]
29983003
name = "spot_rest_api_account_api_my_prevented_matches"
29993004
path = "examples/spot/rest_api/account_api/my_prevented_matches.rs"
@@ -3204,6 +3209,11 @@ name = "spot_websocket_api_account_api_my_allocations"
32043209
path = "examples/spot/websocket_api/account_api/my_allocations.rs"
32053210
required-features = [ "spot" ]
32063211

3212+
[[example]]
3213+
name = "spot_websocket_api_account_api_my_filters"
3214+
path = "examples/spot/websocket_api/account_api/my_filters.rs"
3215+
required-features = [ "spot" ]
3216+
32073217
[[example]]
32083218
name = "spot_websocket_api_account_api_my_prevented_matches"
32093219
path = "examples/spot/websocket_api/account_api/my_prevented_matches.rs"

examples/derivatives_trading_options/rest_api/market_maker_block_trade_api/new_block_trade_order.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
use anyhow::{Context, Result};
2-
use rust_decimal::prelude::*;
32
use std::env;
43
use tracing::info;
54

65
use binance_sdk::config::ConfigurationRestApi;
76
use binance_sdk::derivatives_trading_options::{
8-
DerivativesTradingOptionsRestApi,
9-
rest_api::{NewBlockTradeOrderParams, NewBlockTradeOrderSideEnum},
7+
DerivativesTradingOptionsRestApi, rest_api::NewBlockTradeOrderParams,
108
};
119

1210
#[tokio::main]
@@ -25,15 +23,8 @@ async fn main() -> Result<()> {
2523
let rest_client = DerivativesTradingOptionsRestApi::production(rest_conf);
2624

2725
// Setup the API parameters
28-
let params = NewBlockTradeOrderParams::builder(
29-
"liquidity_example".to_string(),
30-
[].to_vec(),
31-
"symbol_example".to_string(),
32-
NewBlockTradeOrderSideEnum::Buy,
33-
dec!(1.0),
34-
dec!(1.0),
35-
)
36-
.build()?;
26+
let params =
27+
NewBlockTradeOrderParams::builder("liquidity_example".to_string(), [].to_vec()).build()?;
3728

3829
// Make the API call
3930
let response = rest_client
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
use anyhow::{Context, Result};
2+
use std::env;
3+
use tracing::info;
4+
5+
use binance_sdk::config::ConfigurationRestApi;
6+
use binance_sdk::spot::{SpotRestApi, rest_api::MyFiltersParams};
7+
8+
#[tokio::main]
9+
async fn main() -> Result<()> {
10+
// Load credentials from env
11+
let api_key = env::var("API_KEY").context("API_KEY must be set")?;
12+
let api_secret = env::var("API_SECRET").context("API_SECRET must be set")?;
13+
14+
// Build REST config
15+
let rest_conf = ConfigurationRestApi::builder()
16+
.api_key(api_key)
17+
.api_secret(api_secret)
18+
.build()?;
19+
20+
// Create the Spot REST API client
21+
let rest_client = SpotRestApi::production(rest_conf);
22+
23+
// Setup the API parameters
24+
let params = MyFiltersParams::builder("BNBUSDT".to_string()).build()?;
25+
26+
// Make the API call
27+
let response = rest_client
28+
.my_filters(params)
29+
.await
30+
.context("my_filters request failed")?;
31+
32+
info!(?response.rate_limits, "my_filters rate limits");
33+
let data = response.data().await?;
34+
info!(?data, "my_filters data");
35+
36+
Ok(())
37+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
use anyhow::{Context, Result};
2+
use std::env;
3+
use tracing::info;
4+
5+
use binance_sdk::config::ConfigurationWebsocketApi;
6+
use binance_sdk::spot::{SpotWsApi, websocket_api::MyFiltersParams};
7+
8+
#[tokio::main]
9+
async fn main() -> Result<()> {
10+
// Load credentials from env
11+
let api_key = env::var("API_KEY").expect("API_KEY must be set in the environment");
12+
let api_secret = env::var("API_SECRET").expect("API_SECRET must be set in the environment");
13+
14+
// Build WebSocket API config
15+
let ws_api_conf = ConfigurationWebsocketApi::builder()
16+
.api_key(api_key)
17+
.api_secret(api_secret)
18+
.build()?;
19+
20+
// Create the Spot WebSocket API client
21+
let ws_api_client = SpotWsApi::production(ws_api_conf);
22+
23+
// Connect to WebSocket
24+
let connection = ws_api_client
25+
.connect()
26+
.await
27+
.context("Failed to connect to WebSocket API")?;
28+
29+
// Setup the WS API parameters
30+
let params = MyFiltersParams::builder("BNBUSDT".to_string()).build()?;
31+
32+
// Make the WS API call
33+
let response = connection
34+
.my_filters(params)
35+
.await
36+
.context("my_filters request failed")?;
37+
38+
info!(?response.rate_limits, "my_filters rate limits");
39+
let data = response.data()?;
40+
info!(?data, "my_filters data");
41+
42+
// Cleanly disconnect
43+
connection
44+
.disconnect()
45+
.await
46+
.context("Failed to disconnect WebSocket client")?;
47+
48+
Ok(())
49+
}

src/derivatives_trading_coin_futures/rest_api/apis/market_data_api.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,7 +3286,7 @@ mod tests {
32863286
);
32873287
}
32883288

3289-
let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BLZUSDT","adjustedFundingRateCap":"0.02500000","adjustedFundingRateFloor":"-0.02500000","fundingIntervalHours":8,"disclaimer":false}]"#).unwrap();
3289+
let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BTCUSD_PERP","adjustedFundingRateCap":"0.02500000","adjustedFundingRateFloor":"-0.02500000","fundingIntervalHours":8,"disclaimer":false}]"#).unwrap();
32903290
let dummy_response: Vec<models::GetFundingRateInfoResponseInner> =
32913291
serde_json::from_value(resp_json.clone())
32923292
.expect("should parse into Vec<models::GetFundingRateInfoResponseInner>");
@@ -4117,7 +4117,7 @@ mod tests {
41174117
let client = MockMarketDataApiClient { force_error: false };
41184118

41194119

4120-
let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BLZUSDT","adjustedFundingRateCap":"0.02500000","adjustedFundingRateFloor":"-0.02500000","fundingIntervalHours":8,"disclaimer":false}]"#).unwrap();
4120+
let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BTCUSD_PERP","adjustedFundingRateCap":"0.02500000","adjustedFundingRateFloor":"-0.02500000","fundingIntervalHours":8,"disclaimer":false}]"#).unwrap();
41214121
let expected_response : Vec<models::GetFundingRateInfoResponseInner> = serde_json::from_value(resp_json.clone()).expect("should parse into Vec<models::GetFundingRateInfoResponseInner>");
41224122

41234123
let resp = client.get_funding_rate_info().await.expect("Expected a response");
@@ -4133,7 +4133,7 @@ mod tests {
41334133
let client = MockMarketDataApiClient { force_error: false };
41344134

41354135

4136-
let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BLZUSDT","adjustedFundingRateCap":"0.02500000","adjustedFundingRateFloor":"-0.02500000","fundingIntervalHours":8,"disclaimer":false}]"#).unwrap();
4136+
let resp_json: Value = serde_json::from_str(r#"[{"symbol":"BTCUSD_PERP","adjustedFundingRateCap":"0.02500000","adjustedFundingRateFloor":"-0.02500000","fundingIntervalHours":8,"disclaimer":false}]"#).unwrap();
41374137
let expected_response : Vec<models::GetFundingRateInfoResponseInner> = serde_json::from_value(resp_json.clone()).expect("should parse into Vec<models::GetFundingRateInfoResponseInner>");
41384138

41394139
let resp = client.get_funding_rate_info().await.expect("Expected a response");

src/derivatives_trading_coin_futures/rest_api/apis/trade_api.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,7 +3252,7 @@ mod tests {
32523252
);
32533253
}
32543254

3255-
let resp_json: Value = serde_json::from_str(r#"{"avgPrice":"0.0","clientOrderId":"abc","cumBase":"0","executedQty":"0","orderId":1917641,"origQty":"0.40","origType":"TRAILING_STOP_MARKET","price":"0","reduceOnly":false,"side":"BUY","status":"NEW","stopPrice":"9300","closePosition":false,"symbol":"BTCUSD_200925","pair":"BTCUSD","time":1579276756075,"timeInForce":"GTC","type":"TRAILING_STOP_MARKET","activatePrice":"9020","priceRate":"0.3","updateTime":1579276756075,"workingType":"CONTRACT_PRICE","priceProtect":false,"priceMatch":"NONE","selfTradePreventionMode":"NONE"}"#).unwrap();
3255+
let resp_json: Value = serde_json::from_str(r#"{"avgPrice":"0.0","clientOrderId":"abc","cumBase":"0","executedQty":"0","orderId":1917641,"origQty":"0.40","origType":"TRAILING_STOP_MARKET","price":"0","reduceOnly":false,"side":"BUY","positionSide":"SHORT","status":"NEW","stopPrice":"9300","closePosition":false,"symbol":"BTCUSD_200925","pair":"BTCUSD","time":1579276756075,"timeInForce":"GTC","type":"TRAILING_STOP_MARKET","activatePrice":"9020","priceRate":"0.3","updateTime":1579276756075,"workingType":"CONTRACT_PRICE","priceProtect":false,"priceMatch":"NONE","selfTradePreventionMode":"NONE"}"#).unwrap();
32563256
let dummy_response: models::QueryOrderResponse =
32573257
serde_json::from_value(resp_json.clone())
32583258
.expect("should parse into models::QueryOrderResponse");
@@ -4379,7 +4379,7 @@ mod tests {
43794379

43804380
let params = QueryOrderParams::builder("symbol_example".to_string(),).build().unwrap();
43814381

4382-
let resp_json: Value = serde_json::from_str(r#"{"avgPrice":"0.0","clientOrderId":"abc","cumBase":"0","executedQty":"0","orderId":1917641,"origQty":"0.40","origType":"TRAILING_STOP_MARKET","price":"0","reduceOnly":false,"side":"BUY","status":"NEW","stopPrice":"9300","closePosition":false,"symbol":"BTCUSD_200925","pair":"BTCUSD","time":1579276756075,"timeInForce":"GTC","type":"TRAILING_STOP_MARKET","activatePrice":"9020","priceRate":"0.3","updateTime":1579276756075,"workingType":"CONTRACT_PRICE","priceProtect":false,"priceMatch":"NONE","selfTradePreventionMode":"NONE"}"#).unwrap();
4382+
let resp_json: Value = serde_json::from_str(r#"{"avgPrice":"0.0","clientOrderId":"abc","cumBase":"0","executedQty":"0","orderId":1917641,"origQty":"0.40","origType":"TRAILING_STOP_MARKET","price":"0","reduceOnly":false,"side":"BUY","positionSide":"SHORT","status":"NEW","stopPrice":"9300","closePosition":false,"symbol":"BTCUSD_200925","pair":"BTCUSD","time":1579276756075,"timeInForce":"GTC","type":"TRAILING_STOP_MARKET","activatePrice":"9020","priceRate":"0.3","updateTime":1579276756075,"workingType":"CONTRACT_PRICE","priceProtect":false,"priceMatch":"NONE","selfTradePreventionMode":"NONE"}"#).unwrap();
43834383
let expected_response : models::QueryOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::QueryOrderResponse");
43844384

43854385
let resp = client.query_order(params).await.expect("Expected a response");
@@ -4396,7 +4396,7 @@ mod tests {
43964396

43974397
let params = QueryOrderParams::builder("symbol_example".to_string(),).order_id(1).orig_client_order_id("1".to_string()).recv_window(5000).build().unwrap();
43984398

4399-
let resp_json: Value = serde_json::from_str(r#"{"avgPrice":"0.0","clientOrderId":"abc","cumBase":"0","executedQty":"0","orderId":1917641,"origQty":"0.40","origType":"TRAILING_STOP_MARKET","price":"0","reduceOnly":false,"side":"BUY","status":"NEW","stopPrice":"9300","closePosition":false,"symbol":"BTCUSD_200925","pair":"BTCUSD","time":1579276756075,"timeInForce":"GTC","type":"TRAILING_STOP_MARKET","activatePrice":"9020","priceRate":"0.3","updateTime":1579276756075,"workingType":"CONTRACT_PRICE","priceProtect":false,"priceMatch":"NONE","selfTradePreventionMode":"NONE"}"#).unwrap();
4399+
let resp_json: Value = serde_json::from_str(r#"{"avgPrice":"0.0","clientOrderId":"abc","cumBase":"0","executedQty":"0","orderId":1917641,"origQty":"0.40","origType":"TRAILING_STOP_MARKET","price":"0","reduceOnly":false,"side":"BUY","positionSide":"SHORT","status":"NEW","stopPrice":"9300","closePosition":false,"symbol":"BTCUSD_200925","pair":"BTCUSD","time":1579276756075,"timeInForce":"GTC","type":"TRAILING_STOP_MARKET","activatePrice":"9020","priceRate":"0.3","updateTime":1579276756075,"workingType":"CONTRACT_PRICE","priceProtect":false,"priceMatch":"NONE","selfTradePreventionMode":"NONE"}"#).unwrap();
44004400
let expected_response : models::QueryOrderResponse = serde_json::from_value(resp_json.clone()).expect("should parse into models::QueryOrderResponse");
44014401

44024402
let resp = client.query_order(params).await.expect("Expected a response");

src/derivatives_trading_coin_futures/rest_api/models/query_order_response.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ pub struct QueryOrderResponse {
3737
pub reduce_only: Option<bool>,
3838
#[serde(rename = "side", skip_serializing_if = "Option::is_none")]
3939
pub side: Option<String>,
40+
#[serde(rename = "positionSide", skip_serializing_if = "Option::is_none")]
41+
pub position_side: Option<String>,
4042
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
4143
pub status: Option<String>,
4244
#[serde(rename = "stopPrice", skip_serializing_if = "Option::is_none")]
@@ -86,6 +88,7 @@ impl QueryOrderResponse {
8688
price: None,
8789
reduce_only: None,
8890
side: None,
91+
position_side: None,
8992
status: None,
9093
stop_price: None,
9194
close_position: None,

0 commit comments

Comments
 (0)