Emit

Events can be optionally published to down stream systems using SQL like semantics

Event output can be refined by using the emit section to limit fields and events to downstream systems, if this is not present events will be published without any filtering.

Example

emit:
  eventType: windowQuoteEvent
  select: "symbol, ask_MIN, ask_MAX, bid_MIN, bid_MAX, BidMovingAverage.avg_bid_max;WHERE symbol=${symbol}"
  having: "symbol !='A'"

DSL Elements

eventType

Any events that are published can be retyped by proving a new name.

Default {existing eventType}-View

select

A SQL project can be defined using a declared comma-separated list of event fields. Metrics and simple math functions are also supported.

Using the below event example event structure we can define SQL like expression

symbol: IBM
ask: 101
bid: 100
details: {
   vol: 50
   liq: 60   
}
venue: {
   name: nasdaq
}

Examples expressions

FormatResultDescription

ask, bid

101,100

Get top level field defined within the event

ask,bid 'foo'

101,100

b will be renamed to 'foo'

ask,bid,details

101,100,{vol=50,liq=60}

All of 'details' variables

d.vol

50

Only the 'details.vol' variable

details.*

50,60

All of 'details' attributes

ask-bid

1

Simple math function executed against variables

Using metrics expressions

If you are using metrics in the platform these too can be added to the event output. Refer to the metrics engine documentation on how to set up metrics for your use case.

// Metric lookup expression
metric-family.metric1|metric2|metricN;WHERE clause = ${event-field}

Example expressions

FormatResultDescription

marketMetrics.avg_ask;where symbol = {symbol}

101.34

Query the 'marketMetrics' table where the event symbol joins the matched latest row for attribute 'avg_ask'

marketMetrics.avg_ask|avg_bid;where symbol = {symbol}

101.34, 100.12

Query the 'marketMetrics' table where the event symbol joins the matched latest row for attributes 'avg_ask' and 'avg_bid'

marketMetrics.avg_ask;where symbol = {symbol} AND venue=${venue.name}

101.24, 100.22

Query the 'marketMetrics' table where the event symbol and venue joins the matched latest row for the attribute 'avg_ask'

having

This is a Javascript expression filter that evaluates the expression against the resulting select project. If the expression passes the resulting event is presented to publishing sinks.

Optional

// Only publish IBM events
having: "symbol =='IBM'" 

Last updated