Table of Contents

Class WireStrings

Namespace
DatabentoDotNet.Dbn
Assembly
DatabentoDotNet.Dbn.dll

Allocation-free, reflection-free text conversions for the DBN enums that have a wire text form.

public static class WireStrings
Inheritance
WireStrings
Inherited Members

Remarks

Two distinct groups of enums are covered, and they are not interchangeable:

None of the string conversions are a mechanical ToString().ToLowerInvariant() — several wire strings insert a hyphen before a leading digit (mbp-1, ohlcv-1s, cbbo-1m) that a naive case-transition splitter would miss. Every switch below mirrors the Rust crate's as_str/FromStr match arms verbatim, including the handful of legacy parse-only aliases upstream still accepts (documented per method).

This is the text/string half of enum conversion. For numeric wire-byte validation (the equivalent of Rust's TryFrom<u8>/TryFrom<u16>), see EnumValues — the two failure modes (an unrecognized string vs. an out-of-range raw byte) are kept on separate call surfaces on purpose, since upstream represents them as different error types.

Methods

ToChar(Action)

Returns the ASCII character this Action is defined as.

public static char ToChar(this Action value)

Parameters

value Action

Returns

char

ToChar(InstrumentClass)

Returns the ASCII character this InstrumentClass is defined as.

public static char ToChar(this InstrumentClass value)

Parameters

value InstrumentClass

Returns

char

ToChar(MatchAlgorithm)

Returns the ASCII character this MatchAlgorithm is defined as.

public static char ToChar(this MatchAlgorithm value)

Parameters

value MatchAlgorithm

Returns

char

ToChar(SecurityUpdateAction)

Returns the ASCII character this SecurityUpdateAction is defined as.

public static char ToChar(this SecurityUpdateAction value)

Parameters

value SecurityUpdateAction

Returns

char

ToChar(Side)

Returns the ASCII character this Side is defined as.

public static char ToChar(this Side value)

Parameters

value Side

Returns

char

ToChar(TriState)

Returns the ASCII character this TriState is defined as.

public static char ToChar(this TriState value)

Parameters

value TriState

Returns

char

ToChar(UserDefinedInstrument)

Returns the ASCII character this UserDefinedInstrument is defined as.

public static char ToChar(this UserDefinedInstrument value)

Parameters

value UserDefinedInstrument

Returns

char

ToWireString(Compression)

Converts value to its DBN wire string.

public static string ToWireString(this Compression value)

Parameters

value Compression

Returns

string

Exceptions

ArgumentOutOfRangeException

value is not a defined Compression.

ToWireString(Encoding)

Converts value to its DBN wire string.

public static string ToWireString(this Encoding value)

Parameters

value Encoding

Returns

string

Exceptions

ArgumentOutOfRangeException

value is not a defined Encoding.

ToWireString(ErrorCode)

Converts value to its DBN wire string.

public static string ToWireString(this ErrorCode value)

Parameters

value ErrorCode

Returns

string

Exceptions

ArgumentOutOfRangeException

value is not a defined ErrorCode.

ToWireString(RType)

Converts value to its DBN wire string.

public static string ToWireString(this RType value)

Parameters

value RType

Returns

string

Exceptions

ArgumentOutOfRangeException

value is not a defined RType.

ToWireString(SType)

Converts value to its DBN wire string.

public static string ToWireString(this SType value)

Parameters

value SType

Returns

string

Exceptions

ArgumentOutOfRangeException

value is not a defined SType.

ToWireString(Schema)

Converts value to its DBN wire string.

public static string ToWireString(this Schema value)

Parameters

value Schema

Returns

string

Exceptions

ArgumentOutOfRangeException

value is not a defined Schema.

ToWireString(SystemCode)

Converts value to its DBN wire string.

public static string ToWireString(this SystemCode value)

Parameters

value SystemCode

Returns

string

Exceptions

ArgumentOutOfRangeException

value is not a defined SystemCode.

TryParseCompression(string?, out Compression)

Tries to parse a DBN wire string into a Compression. No aliases.

public static bool TryParseCompression(string? value, out Compression result)

Parameters

value string
result Compression

Returns

bool

TryParseEncoding(string?, out Encoding)

Tries to parse a DBN wire string into an Encoding. Accepts one parse-only legacy alias that is never emitted by ToWireString(Encoding): dbz (the pre-rename file extension, → Dbn).

public static bool TryParseEncoding(string? value, out Encoding result)

Parameters

value string
result Encoding

Returns

bool

TryParseErrorCode(string?, out ErrorCode)

Tries to parse a DBN wire string into an ErrorCode. No aliases.

public static bool TryParseErrorCode(string? value, out ErrorCode result)

Parameters

value string
result ErrorCode

Returns

bool

TryParseRType(string?, out RType)

Tries to parse a DBN wire string into an RType. No aliases.

public static bool TryParseRType(string? value, out RType result)

Parameters

value string
result RType

Returns

bool

TryParseSType(string?, out SType)

Tries to parse a DBN wire string into an SType. Accepts four parse-only legacy aliases that are never emitted by ToWireString(SType): product_id (→ InstrumentId), native (→ RawSymbol), nasdaq (→ NasdaqSymbol), and cms (→ CmsSymbol).

public static bool TryParseSType(string? value, out SType result)

Parameters

value string
result SType

Returns

bool

TryParseSchema(string?, out Schema)

Tries to parse a DBN wire string into a Schema. No aliases.

public static bool TryParseSchema(string? value, out Schema result)

Parameters

value string
result Schema

Returns

bool

TryParseSystemCode(string?, out SystemCode)

Tries to parse a DBN wire string into a SystemCode. No aliases.

public static bool TryParseSystemCode(string? value, out SystemCode result)

Parameters

value string
result SystemCode

Returns

bool