Make DateTime available without package prefix in epl

This commit is contained in:
2018-11-14 18:31:53 -08:00
parent 36cefa32e6
commit 104eb216b5
2 changed files with 12 additions and 10 deletions

View File

@ -97,7 +97,7 @@ insert into SMACloseStream
-- A stream that feeds B1 and B2. Each event contains a double
-- precision floating point value "low", and a timestamp called
-- "time".
create schema BStream as (low double, time org.joda.time.DateTime)
create schema BStream as (low double, time DateTime)
-- Listen to the last "RefSize" number of SMACloseStream events. Look
-- for an OHLC bar with a lower average close than its neighbors. Add
@ -111,7 +111,7 @@ insert into BStream
-- Define B1 to contain the same fields as BStream
create schema B1 (low double, time org.joda.time.DateTime)
create schema B1 (low double, time DateTime)
-- B1 contains the most recent low value and time from BStream.
-- This is the last time an average close was lower
@ -122,14 +122,14 @@ insert into B1 select prev(0, low) as low, prev(0, time) as time
-- B2 contains the *second* most recent occurrence in BStream, but is
-- otherwise the same as B1.
create schema B2 (low double, time org.joda.time.DateTime)
create schema B2 (low double, time DateTime)
insert into B2 select prev(1, low) as low, prev(1, time) as time
from BStream#length(RefSize)
-- A stream that feeds P1 and P2.
create schema PStream as (low double, time org.joda.time.DateTime)
create schema PStream as (low double, time DateTime)
-- Find an OHLC bar with a higher average close than its neighbors.
-- Add that low value and its timestamp to the stream.
@ -142,13 +142,13 @@ insert into PStream
-- This is the last time an average close was higher
-- than the ones before and after.
-- Since the time is included in the event, no separate PT1 is needed.
create schema P1 (low double, time org.joda.time.DateTime)
create schema P1 (low double, time DateTime)
insert into P1 select prev(0, low) as low, prev(0, time) as time
from PStream#length(RefSize)
-- P2 contains the second most recent occurrence in PStream.
create schema P2 (low double, time org.joda.time.DateTime)
create schema P2 (low double, time DateTime)
insert into P2 select prev(1, low) as low, prev(1, time) as time
from PStream#length(RefSize)
@ -167,9 +167,9 @@ insert into MaxHigh3Window
select max(high) as high from OHLCStream#length(3)
-- Long entry events contain the current tick's midpoint value and
-- timestamp.
create schema LongEntryStream as (current BigDecimal, time org.joda.time.DateTime, instrument String)
-- Long entry events contain the current tick's midpoint value,
-- timestamp, and instrument name.
create schema LongEntryStream as (current BigDecimal, time DateTime, instrument String)
-- The long entry calc below is translated from this entry in the
-- spreadsheet:
@ -202,7 +202,7 @@ insert into LongEntryStream
--
-- LongEntryDistinct filters out duplicate LongEntryStream events,
-- leaving a maximum of one event per tick.
create schema LongEntryDistinct as (current BigDecimal, time org.joda.time.DateTime,
create schema LongEntryDistinct as (current BigDecimal, time DateTime,
instrument String, units int)
insert into LongEntryDistinct

View File

@ -9,6 +9,7 @@ import com.espertech.esper.client.StatementAwareUpdateListener;
import com.espertech.esper.client.UpdateListener;
import com.espertech.esper.client.time.CurrentTimeEvent;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,6 +37,7 @@ public class EsperProcessor implements TickProcessor {
config.addEventType(TickEvent.class);
config.addEventType(OHLCEvent.class);
config.addEventType(OHLCValueEvent.class);
config.addEventType(DateTime.class);
// add OHLC plugin
config.addPlugInView("ATS", "OHLC", OHLCPlugInViewFactory.class.getName());