Skip to content

Commit 2164600

Browse files
committed
chore: fix deprecated API usage in examples, update changelog
- batch_orders: use BatchCancelOrdersRequest::with_orders() instead of deprecated new() - rfq_verify: use target_cost_dollars field instead of deprecated target_cost_as_dollars() method - Expand changelog Deprecated section to cover all items aligned with kalshi_python_async v3.2.0
1 parent 41de4cd commit 2164600

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
113113

114114
- `CreateOrderRequest::sell_position_floor()` — use `reduce_only` instead. Only
115115
accepts value of 0.
116+
- `Rfq::target_cost_as_dollars()` and `Quote::rfq_target_cost_as_dollars()`
117+
use the `target_cost_dollars` / `rfq_target_cost_dollars` fields directly.
118+
- `BatchCancelOrdersRequest::new()` and `try_new()` — use `with_orders()` /
119+
`try_with_orders()` for per-order subaccount support.
116120
- `target_cost_centi_cents` on RFQ/Quote types — use `target_cost_dollars`
117121
instead.
122+
- `Order.queue_position` — always returns 0; use the `get_order_queue_position`
123+
endpoint instead.
124+
- `Fill.price` and `Trade.price` — use `yes_price` / `no_price` instead.
125+
- `Fill.trade_id`, `Fill.market_ticker`, `Fill.ts` — legacy field names.
126+
- `Event.category` — use series-level category instead.
127+
- `MarketPosition.resting_orders_count` — deprecated by the API.
118128

119129
## [0.2.0] - 2026-01-18
120130

examples/batch_orders.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
//! Run with: cargo run --example batch_orders
1111
1212
use kalshi_trade_rs::{
13-
Action, BatchCancelOrdersRequest, BatchCreateOrdersRequest, CreateOrderRequest,
14-
GetMarketsParams, KalshiClient, KalshiConfig, MarketFilterStatus, OrderType, Side, TimeInForce,
15-
cents_to_dollars,
13+
Action, BatchCancelOrderItem, BatchCancelOrdersRequest, BatchCreateOrdersRequest,
14+
CreateOrderRequest, GetMarketsParams, KalshiClient, KalshiConfig, MarketFilterStatus,
15+
OrderType, Side, TimeInForce, cents_to_dollars,
1616
};
1717
use std::time::{SystemTime, UNIX_EPOCH};
1818

@@ -171,7 +171,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
171171
println!("=== Batch Cancel Orders ===");
172172
println!("Canceling {} orders...", successful_order_ids.len());
173173

174-
let cancel_request = BatchCancelOrdersRequest::new(successful_order_ids.clone());
174+
let cancel_items: Vec<BatchCancelOrderItem> = successful_order_ids
175+
.iter()
176+
.map(BatchCancelOrderItem::new)
177+
.collect();
178+
let cancel_request = BatchCancelOrdersRequest::with_orders(cancel_items);
175179
let cancel_response = client.batch_cancel_orders(cancel_request).await?;
176180

177181
println!("\nBatch cancel results:");

examples/rfq_verify.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
9999
let size = match rfq.contracts {
100100
Some(c) if c > 0 => format!("{} contracts", c),
101101
_ => rfq
102-
.target_cost_as_dollars()
103-
.map(|d| format!("${:.2} target", d))
102+
.target_cost_dollars
103+
.as_deref()
104+
.map(|d| format!("${} target", d))
104105
.unwrap_or_else(|| "unknown size".to_string()),
105106
};
106107
println!(

0 commit comments

Comments
 (0)