Skip to content

Commit 5af1441

Browse files
committed
MOD: Enable map_symbols by default for clients
1 parent 268db3b commit 5af1441

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

CHANGELOG.md

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

3+
## 0.37.0 - TBD
4+
5+
#### Breaking changes
6+
- The `map_symbols` parameter for `SubmitJobParams::builder()` now defaults to `true` for JSON and CSV encodings
7+
38
## 0.36.0 - 2025-11-19
49

510
### Enhancements

src/historical/batch.rs

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
use std::{
44
cmp::Ordering,
55
collections::HashMap,
6-
fmt,
7-
fmt::Write,
6+
fmt::{self, Write},
87
num::NonZeroU64,
98
path::{Path, PathBuf},
109
str::FromStr,
@@ -382,9 +381,9 @@ pub struct SubmitJobParams {
382381
#[builder(default)]
383382
pub pretty_ts: bool,
384383
/// If `true`, a symbol field will be included with each text-encoded
385-
/// record, reducing the need to look at the `symbology.json`. Only valid for
386-
/// [`Encoding::Csv`] and [`Encoding::Json`].
387-
#[builder(default)]
384+
/// record. If `None`, will default to `true` for [`Encoding::Csv`] and [`Encoding::Json`] encodings,
385+
/// and `false` for [`Encoding::Dbn`].
386+
#[builder(default_code = "*encoding != Encoding::Dbn")]
388387
pub map_symbols: bool,
389388
/// If `true`, files will be split by raw symbol. Cannot be requested with [`Symbols::All`].
390389
#[builder(default)]
@@ -672,6 +671,7 @@ enum Header {
672671

673672
#[cfg(test)]
674673
mod tests {
674+
use dbn::Dataset;
675675
use reqwest::StatusCode;
676676
use serde_json::json;
677677
use time::macros::datetime;
@@ -759,6 +759,45 @@ mod tests {
759759
Ok(())
760760
}
761761

762+
#[tokio::test]
763+
async fn test_submit_job_param_map_symbols() -> crate::Result<()> {
764+
const START: time::OffsetDateTime = datetime!(2023 - 06 - 14 00:00 UTC);
765+
const END: time::OffsetDateTime = datetime!(2023 - 06 - 17 00:00 UTC);
766+
767+
let params = SubmitJobParams::builder()
768+
.dataset(Dataset::GlbxMdp3)
769+
.encoding(Encoding::Dbn)
770+
.symbols("ESM5")
771+
.schema(Schema::Mbo)
772+
.date_time_range(START..END)
773+
.build();
774+
assert_eq!(params.encoding, Encoding::Dbn);
775+
assert_eq!(params.map_symbols, false);
776+
777+
let params = SubmitJobParams::builder()
778+
.dataset(Dataset::GlbxMdp3)
779+
.encoding(Encoding::Csv)
780+
.symbols("ESM5")
781+
.schema(Schema::Mbo)
782+
.date_time_range(START..END)
783+
.build();
784+
assert_eq!(params.encoding, Encoding::Csv);
785+
assert_eq!(params.map_symbols, true);
786+
787+
let params = SubmitJobParams::builder()
788+
.dataset(Dataset::GlbxMdp3)
789+
.encoding(Encoding::Json)
790+
.symbols("ESM5")
791+
.schema(Schema::Mbo)
792+
.date_time_range(START..END)
793+
.map_symbols(false)
794+
.build();
795+
assert_eq!(params.encoding, Encoding::Json);
796+
assert_eq!(params.map_symbols, false);
797+
798+
Ok(())
799+
}
800+
762801
#[tokio::test]
763802
async fn test_list_jobs() -> crate::Result<()> {
764803
const SCHEMA: Schema = Schema::Trades;

0 commit comments

Comments
 (0)