Class BatchJob
- Namespace
- DatabentoDotNet.Historical
- Assembly
- DatabentoDotNet.Historical.dll
Everything the API knows about one batch job.
public sealed record BatchJob : IEquatable<BatchJob>
- Inheritance
-
BatchJob
- Implements
- Inherited Members
Remarks
Port of upstream's BatchJob (batch.rs:502-576). Returned by
SubmitJobAsync(SubmitJobParams, CancellationToken), GetJobDetailsAsync(string, CancellationToken) and the
deprecated ListJobsFullAsync(ListJobsParams?, CancellationToken). It is both the echo of what was asked
for and the record of what happened: the parameters come back beside the sizes, the timings and
the state.
Two fields here are not in upstream's struct, and both were found by probing rather than by
reading. BillId and Packaging appear in every response
batch.list_jobs and batch.get_job_details returned to #39, and upstream models
neither. #39's Definition of done asks for them anyway — "a field silently dropped in
deserialisation is invisible until someone needs it" — and a serde struct is exactly where such
a drop hides, because unmatched properties are skipped without complaint in both languages.
Start and End are two properties rather than a DateTimeRange, matching the wire and matching DatasetRange. They arrive as sibling JSON properties, not as a nested object, so a single range property would need a converter over the whole job. ToDateTimeRange() is the narrowing, named for the same reason ToDateTimeRange() is.
The optional properties are optional because the API has not decided them yet, not because they are rare. A job is answered the moment it is submitted, long before it has a cost, a record count or a finish time; every null below reads as "not yet" rather than "never".
Properties
ActualSize
The total size in bytes of the job's output, or null until it has run.
public ulong? ActualSize { get; init; }
Property Value
BillId
The identifier of the bill this job was charged to, or null.
public string? BillId { get; init; }
Property Value
Remarks
Not modelled by upstream. Every job #39 saw carried it as null — including jobs that
had completed and been priced — so its populated spelling is unmeasured and it is typed as
the string the wire would carry rather than as a guess at more structure.
BilledSize
The size in bytes the job was billed on, or null until it has run.
public ulong? BilledSize { get; init; }
Property Value
Remarks
The size of the raw binary data behind the job, which is what GetBillableSizeAsync(MetadataQueryParams, CancellationToken) quotes in advance — not the size of the files produced, which is ActualSize.
Compression
The compression the job's files are written with.
public required Compression Compression { get; init; }
Property Value
Remarks
Arrives as JSON null rather than "none" when there is none; see
CompressionJsonConverter.
CostUsd
What the job cost in US dollars, or null until it is priced.
public decimal? CostUsd { get; init; }
Property Value
Remarks
decimal rather than upstream's f64, matching
GetCostAsync(MetadataQueryParams, CancellationToken): a price is a decimal quantity, and binary floating
point cannot represent one exactly.
Dataset
The dataset code the job requested.
public required string Dataset { get; init; }
Property Value
Delivery
How the job's files are delivered.
public required Delivery Delivery { get; init; }
Property Value
Encoding
The encoding the job's files are written in.
public required Encoding Encoding { get; init; }
Property Value
End
The exclusive end of the requested range.
public required Instant End { get; init; }
Property Value
ExpirationTimestamp
When the job's files stop being downloadable, or null if not yet known.
[JsonPropertyName("ts_expiration")]
public Instant? ExpirationTimestamp { get; init; }
Property Value
Remarks
After this instant the job's state becomes Expired and its files can no longer be fetched. #39 measured roughly thirty days from submission.
Id
The job's unique identifier — XNAS-20260825-6T3F5G5TYH.
public required string Id { get; init; }
Property Value
Remarks
What GetJobDetailsAsync(string, CancellationToken), ListFilesAsync(string, CancellationToken) and JobId all name a job by, and the directory a download is written into.
Limit
The maximum number of records the job requested, or null for no limit.
public ulong? Limit { get; init; }
Property Value
MapSymbols
Whether each text-encoded record carries a symbol field.
public required bool MapSymbols { get; init; }
Property Value
PackageSize
The total size in bytes of the job's output including its metadata files, or null until it has run.
public ulong? PackageSize { get; init; }
Property Value
Remarks
The number to expect a full DownloadAsync(DownloadParams, CancellationToken) to write, since a
download takes every file ListFilesAsync(string, CancellationToken) reports and that includes
the packaged manifest.json, metadata.json and condition.json.
Packaging
How the job's files are packaged for delivery, or null for none.
public string? Packaging { get; init; }
Property Value
Remarks
Not modelled by upstream, and not sent by SubmitJobParams either — upstream
posts no packaging field, so nothing this library submits can populate it. Captured
because the API returns it on every job. Like BillId, every value #39 measured
was null, so its populated spelling is unmeasured and it is typed accordingly.
PrettyPx
Whether prices are written at their true scale rather than as fixed-precision integers.
public required bool PrettyPx { get; init; }
Property Value
PrettyTs
Whether timestamps are written as ISO 8601 strings rather than as nanoseconds.
public required bool PrettyTs { get; init; }
Property Value
ProcessDoneTimestamp
When processing finished, or null if it has not yet.
[JsonPropertyName("ts_process_done")]
public Instant? ProcessDoneTimestamp { get; init; }
Property Value
ProcessStartTimestamp
When processing began, or null if it has not yet.
[JsonPropertyName("ts_process_start")]
public Instant? ProcessStartTimestamp { get; init; }
Property Value
Progress
How far through processing the job is, from 0 to 100, or null.
public byte? Progress { get; init; }
Property Value
- byte?
Remarks
Upstream carries #[serde(default)] here (batch.rs:574-575) because a
just-submitted job's response omits the field entirely rather than sending null. That
is why this property is not required: an absent field and a
null one must both read as "not yet", and only a non-required property
does that.
QueuedTimestamp
When the job was queued, or null if it has not been yet.
[JsonPropertyName("ts_queued")]
public Instant? QueuedTimestamp { get; init; }
Property Value
ReceivedTimestamp
When Databento received the job.
[JsonPropertyName("ts_received")]
public required Instant ReceivedTimestamp { get; init; }
Property Value
Remarks
ts_received on the wire, and what Since filters on.
RecordCount
How many records the job produced, or null until it has run.
public ulong? RecordCount { get; init; }
Property Value
Schema
The record schema the job requested.
public required Schema Schema { get; init; }
Property Value
SplitDuration
The interval the job's output is split into separate files at.
public required SplitDuration SplitDuration { get; init; }
Property Value
Remarks
Arrives as JSON null rather than "none" when there is no time-based split; see
SplitDurationJsonConverter.
SplitSize
The size in bytes each file is split at, or null for no size split.
public ulong? SplitSize { get; init; }
Property Value
SplitSymbols
Whether the job's output is split into one file per raw symbol.
public required bool SplitSymbols { get; init; }
Property Value
Start
The inclusive start of the requested range.
public required Instant Start { get; init; }
Property Value
State
How far the job has got.
public required JobState State { get; init; }
Property Value
StypeIn
The symbology Symbols was expressed in.
public required SType StypeIn { get; init; }
Property Value
StypeOut
The symbology the job's records name instruments in.
public required SType StypeOut { get; init; }
Property Value
Symbols
The symbols the job requested.
public required Symbols Symbols { get; init; }
Property Value
Remarks
The API echoes this as a bare string, comma-joined for more than one, and as AllWireValue for the whole dataset. See SymbolsJsonConverter, which reads all four shapes the field is documented to take.
UserId
The identifier of the user who submitted the job.
public string? UserId { get; init; }
Property Value
Methods
ToDateTimeRange()
public DateTimeRange ToDateTimeRange()
Returns
- DateTimeRange
The requested range: inclusive start, exclusive end.
Remarks
Named rather than implicit, for the reason ToDateTimeRange() gives. The result is the range the job was submitted with, so it can be handed straight to GetCostAsync(MetadataQueryParams, CancellationToken) to ask what the same request would cost again.