Make DateTime available without package prefix in epl
This commit is contained in:
@ -97,7 +97,7 @@ insert into SMACloseStream
|
|||||||
-- A stream that feeds B1 and B2. Each event contains a double
|
-- A stream that feeds B1 and B2. Each event contains a double
|
||||||
-- precision floating point value "low", and a timestamp called
|
-- precision floating point value "low", and a timestamp called
|
||||||
-- "time".
|
-- "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
|
-- Listen to the last "RefSize" number of SMACloseStream events. Look
|
||||||
-- for an OHLC bar with a lower average close than its neighbors. Add
|
-- 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
|
-- 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.
|
-- B1 contains the most recent low value and time from BStream.
|
||||||
-- This is the last time an average close was lower
|
-- 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
|
-- B2 contains the *second* most recent occurrence in BStream, but is
|
||||||
-- otherwise the same as B1.
|
-- 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
|
insert into B2 select prev(1, low) as low, prev(1, time) as time
|
||||||
from BStream#length(RefSize)
|
from BStream#length(RefSize)
|
||||||
|
|
||||||
|
|
||||||
-- A stream that feeds P1 and P2.
|
-- 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.
|
-- Find an OHLC bar with a higher average close than its neighbors.
|
||||||
-- Add that low value and its timestamp to the stream.
|
-- 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
|
-- This is the last time an average close was higher
|
||||||
-- than the ones before and after.
|
-- than the ones before and after.
|
||||||
-- Since the time is included in the event, no separate PT1 is needed.
|
-- 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
|
insert into P1 select prev(0, low) as low, prev(0, time) as time
|
||||||
from PStream#length(RefSize)
|
from PStream#length(RefSize)
|
||||||
|
|
||||||
-- P2 contains the second most recent occurrence in PStream.
|
-- 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
|
insert into P2 select prev(1, low) as low, prev(1, time) as time
|
||||||
from PStream#length(RefSize)
|
from PStream#length(RefSize)
|
||||||
@ -167,9 +167,9 @@ insert into MaxHigh3Window
|
|||||||
select max(high) as high from OHLCStream#length(3)
|
select max(high) as high from OHLCStream#length(3)
|
||||||
|
|
||||||
|
|
||||||
-- Long entry events contain the current tick's midpoint value and
|
-- Long entry events contain the current tick's midpoint value,
|
||||||
-- timestamp.
|
-- timestamp, and instrument name.
|
||||||
create schema LongEntryStream as (current BigDecimal, time org.joda.time.DateTime, instrument String)
|
create schema LongEntryStream as (current BigDecimal, time DateTime, instrument String)
|
||||||
|
|
||||||
-- The long entry calc below is translated from this entry in the
|
-- The long entry calc below is translated from this entry in the
|
||||||
-- spreadsheet:
|
-- spreadsheet:
|
||||||
@ -202,7 +202,7 @@ insert into LongEntryStream
|
|||||||
--
|
--
|
||||||
-- LongEntryDistinct filters out duplicate LongEntryStream events,
|
-- LongEntryDistinct filters out duplicate LongEntryStream events,
|
||||||
-- leaving a maximum of one event per tick.
|
-- 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)
|
instrument String, units int)
|
||||||
|
|
||||||
insert into LongEntryDistinct
|
insert into LongEntryDistinct
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.espertech.esper.client.StatementAwareUpdateListener;
|
|||||||
import com.espertech.esper.client.UpdateListener;
|
import com.espertech.esper.client.UpdateListener;
|
||||||
import com.espertech.esper.client.time.CurrentTimeEvent;
|
import com.espertech.esper.client.time.CurrentTimeEvent;
|
||||||
|
|
||||||
|
import org.joda.time.DateTime;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ public class EsperProcessor implements TickProcessor {
|
|||||||
config.addEventType(TickEvent.class);
|
config.addEventType(TickEvent.class);
|
||||||
config.addEventType(OHLCEvent.class);
|
config.addEventType(OHLCEvent.class);
|
||||||
config.addEventType(OHLCValueEvent.class);
|
config.addEventType(OHLCValueEvent.class);
|
||||||
|
config.addEventType(DateTime.class);
|
||||||
|
|
||||||
// add OHLC plugin
|
// add OHLC plugin
|
||||||
config.addPlugInView("ATS", "OHLC", OHLCPlugInViewFactory.class.getName());
|
config.addPlugInView("ATS", "OHLC", OHLCPlugInViewFactory.class.getName());
|
||||||
|
|||||||
Reference in New Issue
Block a user