SubmitJobParams
The parameter struct and builder for HistoricalClient::batch::submit_job.
The builder can be instantiated with the associated function builder(), and the struct is created from the builder with the build() method.
For every field, there is an identically named setter method on the builder.
Fields
| Parameter | Type | Description |
|---|---|---|
dataset | String | The dataset code (string identifier). Must be one of the values from list_datasets. |
symbols | Symbols | The product symbols to filter for. Takes up to 2,000 symbols per request. If Symbols::All then will select all symbols. |
schema | Schema | The data record schema. Must be one of the values from list_schemas. |
date_time_range | DateTimeRange | The request range with an inclusive start and an exclusive end. Filters on ts_recv if it exists in the schema, otherwise ts_event. |
encoding | Encoding | The data encoding. Defaults to Dbn. |
compression | Compression | |
pretty_px | bool | If prices should be formatted to the correct scale (using the fixed-precision scalar 1e-9). Only applicable for Csv or Json encodings. Defaults to false. |
pretty_ts | bool | If timestamps should be formatted as ISO 8601 strings. Only applicable for Csv or Json encodings. Defaults to false. |
map_symbols | Option<bool> | If a symbol field should be included with each text-encoded record. Defaults to true for Csv or Json encodings, and false for Dbn. |
split_symbols | bool | If files should be split by raw symbol. Cannot be used with limit. Defaults to false. |
split_duration | SplitDuration | The maximum time duration before batched data is split into multiple files. A week starts on Sunday UTC. None means no time-based splitting. Defaults to Day. |
split_size | Option<NonZeroU64> | The maximum size (in bytes) of each batched data file before being split. Must be an integer between 1e9 and 10e9 inclusive (1GB - 10GB). Defaults to None. |
delivery | Delivery | The delivery mechanism for the batched data files once processed. Only Download is supported at this time. |
stype_in | SType | |
stype_out | SType | The symbology type of output symbols. Defaults to InstrumentId. Must be a valid symbology combination with stype_in. See symbology combinations. |
limit | Option<NonZeroU64> | The maximum number of records to return. If None then no limit. Cannot be used with split_symbols. |
API method
pub struct SubmitJobParams {
pub dataset: String,
pub symbols: Symbols,
pub schema: Schema,
pub date_time_range: DateTimeRange,
pub encoding: Encoding,
pub compression: Compression,
pub pretty_px: bool,
pub pretty_ts: bool,
pub map_symbols: Option<bool>,
pub split_symbols: bool,
pub split_duration: SplitDuration,
pub split_size: Option<NonZeroU64>,
pub delivery: Delivery,
pub stype_in: SType,
pub stype_out: SType,
pub limit: Option<NonZeroU64>,
} Example usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
use databento::{
dbn::{Compression, Dataset, Encoding, SType, Schema},
historical::batch::{
Delivery, SplitDuration, SubmitJobParams,
},
};
use time::macros::datetime;
assert_eq!(
SubmitJobParams {
dataset: "GLBX.MDP3".to_owned(),
date_time_range: (datetime!(2019-01-01 00:00 UTC)
..datetime!(2020-09-03 00:00 UTC))
.into(),
symbols: vec!["CL.c.0", "NG.c.0"].into(),
schema: Schema::Ohlcv1M,
stype_in: SType::Continuous,
stype_out: SType::InstrumentId,
limit: None,
encoding: Encoding::Csv,
compression: Compression::None,
pretty_px: true,
pretty_ts: true,
map_symbols: Some(true),
split_symbols: false,
split_duration: SplitDuration::Day,
split_size: None,
delivery: Delivery::Download,
},
SubmitJobParams::builder()
.dataset(Dataset::GlbxMdp3)
.symbols(vec!["CL.c.0", "NG.c.0"])
.stype_in(SType::Continuous)
.date_time_range(
datetime!(2019-01-01 00:00 UTC)
..datetime!(2020-09-03 00:00 UTC)
)
.schema(Schema::Ohlcv1M)
.encoding(Encoding::Csv)
.compression(Compression::None)
.pretty_px(true)
.pretty_ts(true)
.map_symbols(true)
.build()
);