Table of Contents

Class CloudEventExtensions

Namespace
Virtufin.Worker.DevKit
Assembly
Virtufin.Worker.DevKit.dll

Fluent extensions for CloudEvent applied automatically by WorkerBase<TInput, TOutput>.BuildResponse.

public static class CloudEventExtensions
Inheritance
CloudEventExtensions
Inherited Members

Methods

GetClockType(CloudEvent)

The clocktype extension (wall | historical), or null.

public static string? GetClockType(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetCorrelationId(CloudEvent)

The correlationid extension, or null.

public static string? GetCorrelationId(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetEventTime(CloudEvent)

The eventtime extension (RFC3339), or null.

public static DateTimeOffset? GetEventTime(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

DateTimeOffset?

GetExchange(CloudEvent)

The exchange extension, or null.

public static string? GetExchange(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetMarketUniverse(CloudEvent)

The marketuniverse extension, or null.

public static string? GetMarketUniverse(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetMarketWorld(CloudEvent)

The marketworld extension (act | hyp.<name>), or null.

public static string? GetMarketWorld(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetPortfolioWorld(CloudEvent)

The portfolioworld extension, or null.

public static string? GetPortfolioWorld(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetRunId(CloudEvent)

The runid extension as a Guid, or null.

public static Guid? GetRunId(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

Guid?

GetScenarioId(CloudEvent)

The scenarioid extension, or null.

public static string? GetScenarioId(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetStrategyWorld(CloudEvent)

The strategyworld extension, or null.

public static string? GetStrategyWorld(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

string

GetWallTime(CloudEvent)

The walltime extension (RFC3339), or null.

public static DateTimeOffset? GetWallTime(this CloudEvent ce)

Parameters

ce CloudEvent

Returns

DateTimeOffset?

WithClockType(CloudEvent, string)

Sets the clocktype extension attribute (wall or historical).

public static CloudEvent WithClockType(this CloudEvent ce, string clockType)

Parameters

ce CloudEvent
clockType string

Returns

CloudEvent

WithCorrelationId(CloudEvent, CloudEvent)

Copies the correlationid extension attribute from input to ce. No-op if the input has no correlationid.

public static CloudEvent WithCorrelationId(this CloudEvent ce, CloudEvent input)

Parameters

ce CloudEvent
input CloudEvent

Returns

CloudEvent

WithEnvelopeFrom(CloudEvent, CloudEvent)

Copy the Common Envelope Extensions present on source onto ce -- correlationid, scenarioid, runid, exchange, clocktype, the market/portfolio/strategy worlds and marketuniverse -- for a worker that derives its event from an incoming one and doesn't own those values (an executor echoing the order's scenario, an indicator echoing its market data). The per-event eventtime/walltime are deliberately NOT copied: they describe this event, so set them with WithEventTime(CloudEvent, DateTimeOffset) / WithWallTime(CloudEvent, DateTimeOffset?). Attributes absent on the source are left as they are on ce.

public static CloudEvent WithEnvelopeFrom(this CloudEvent ce, CloudEvent source)

Parameters

ce CloudEvent
source CloudEvent

Returns

CloudEvent

WithEventTime(CloudEvent, DateTimeOffset)

Sets the eventtime extension attribute (RFC3339) — the logical event time matching clocktype (historical for backtest replay, real clock otherwise), distinct from Time (which WithTimestamp(CloudEvent, DateTimeOffset?) sets, and which callers typically leave as the real publish time). The ratified spec defines eventtime as equal to ce-time; call ce.WithTimestamp(eventTime) too if a given event genuinely wants both to match -- this method only sets the extension, since unconditionally overwriting Time here would change existing callers that intentionally publish at the real timestamp while carrying a historical eventtime.

public static CloudEvent WithEventTime(this CloudEvent ce, DateTimeOffset eventTime)

Parameters

ce CloudEvent
eventTime DateTimeOffset

Returns

CloudEvent

WithExchange(CloudEvent, string)

Sets the exchange extension attribute (e.g. binance, coinbase).

public static CloudEvent WithExchange(this CloudEvent ce, string exchange)

Parameters

ce CloudEvent
exchange string

Returns

CloudEvent

WithMarketUniverse(CloudEvent, string)

Sets the marketuniverse extension attribute — present for both act and hyp.<name> (use "ALL" for unrestricted).

public static CloudEvent WithMarketUniverse(this CloudEvent ce, string marketUniverse)

Parameters

ce CloudEvent
marketUniverse string

Returns

CloudEvent

WithMarketWorld(CloudEvent, string)

Sets the marketworld extension attribute (act or hyp.<name>).

public static CloudEvent WithMarketWorld(this CloudEvent ce, string marketWorld)

Parameters

ce CloudEvent
marketWorld string

Returns

CloudEvent

WithPortfolioWorld(CloudEvent, string)

Sets the portfolioworld extension attribute (act or hyp.<name>).

public static CloudEvent WithPortfolioWorld(this CloudEvent ce, string portfolioWorld)

Parameters

ce CloudEvent
portfolioWorld string

Returns

CloudEvent

WithRunId(CloudEvent, Guid)

Sets the runid extension attribute.

public static CloudEvent WithRunId(this CloudEvent ce, Guid runId)

Parameters

ce CloudEvent
runId Guid

Returns

CloudEvent

WithScenarioId(CloudEvent, string)

Sets the scenarioid extension attribute.

public static CloudEvent WithScenarioId(this CloudEvent ce, string scenarioId)

Parameters

ce CloudEvent
scenarioId string

Returns

CloudEvent

WithStrategyWorld(CloudEvent, string)

Sets the strategyworld extension attribute (act or hyp.<name>).

public static CloudEvent WithStrategyWorld(this CloudEvent ce, string strategyWorld)

Parameters

ce CloudEvent
strategyWorld string

Returns

CloudEvent

WithTimestamp(CloudEvent, DateTimeOffset?)

Sets Time to timestamp (or UtcNow if null) and returns the same instance for fluent chaining.

public static CloudEvent WithTimestamp(this CloudEvent ce, DateTimeOffset? timestamp = null)

Parameters

ce CloudEvent
timestamp DateTimeOffset?

Returns

CloudEvent

WithWallTime(CloudEvent, DateTimeOffset?)

Sets the walltime extension attribute (RFC3339) to wallTime (or UtcNow if null) — always the real clock at publish time, for tracing and logging, independent of WithEventTime(CloudEvent, DateTimeOffset).

public static CloudEvent WithWallTime(this CloudEvent ce, DateTimeOffset? wallTime = null)

Parameters

ce CloudEvent
wallTime DateTimeOffset?

Returns

CloudEvent