Class Wire
- Namespace
- Virtufin.Worker.DevKit
- Assembly
- Virtufin.Worker.DevKit.dll
Readers for the JSON wire payloads every devkit decodes by hand (candles, trades, positions, order submissions): one copy of the required-field checks, the wire precision and the timestamp parsing, so a malformed payload fails the same way, with the field named, whichever devkit reads it.
public static class Wire
- Inheritance
-
Wire
- Inherited Members
Remarks
Every failure is an InvalidOperationException naming the field. The readers never change a wire format: writing (field names, casing, time format) stays with each payload's own codec.
Fields
Precision
Decimal places a wire amount is read with: prices, quantities and values on the JSON wire carry at most this many.
public const int Precision = 8
Field Value
Methods
ReadAmount(JsonNode, string, int)
A required JSON number as an amount with precision decimals.
public static DecimalAmount ReadAmount(JsonNode payload, string key, int precision = 8)
Parameters
Returns
- DecimalAmount
ReadDecimal(JsonNode, string)
A required JSON number.
public static decimal ReadDecimal(JsonNode payload, string key)
Parameters
Returns
ReadNonEmptyString(JsonNode, string)
A required, non-empty string field.
public static string ReadNonEmptyString(JsonNode payload, string key)
Parameters
Returns
ReadOptionalAmount(JsonNode, string, int)
An optional JSON number (absent or null: null) as an amount.
public static DecimalAmount? ReadOptionalAmount(JsonNode payload, string key, int precision = 8)
Parameters
Returns
- DecimalAmount?
ReadString(JsonNode, string)
A required string field (may be empty).
public static string ReadString(JsonNode payload, string key)
Parameters
Returns
ReadTime(JsonNode, string)
A required timestamp field (RFC 3339 / ISO 8601). A timestamp without an offset is read as UTC, never as the host's local time.
public static DateTimeOffset ReadTime(JsonNode payload, string key)
Parameters
Returns
TryParseTime(string?, out DateTimeOffset)
Parse an RFC 3339 / ISO 8601 timestamp; one without an offset is UTC.
public static bool TryParseTime(string? raw, out DateTimeOffset time)
Parameters
rawstringtimeDateTimeOffset