trading_system_1.epl: pass instrument and units in LongEntry events

This commit is contained in:
2018-09-20 16:43:17 -07:00
parent 5a5f7f7acf
commit b9cac77bcd

View File

@ -170,7 +170,7 @@ insert into MaxHigh3Window
-- Long entry events contain the current tick's midpoint value and
-- timestamp.
create schema LongEntryStream as (current BigDecimal, time org.joda.time.DateTime)
create schema LongEntryStream as (current BigDecimal, time org.joda.time.DateTime, instrument String)
-- The long entry calc below is translated from this entry in the
-- spreadsheet:
@ -183,7 +183,7 @@ create schema LongEntryStream as (current BigDecimal, time org.joda.time.DateTim
-- and PT1 > BT2
insert into LongEntryStream
select C.mid as current, C.time as time
select C.mid as current, C.time as time, C.instrument as instrument
from CurrentTickWindow as C,
MaxHigh3Window as T,
B1#lastevent, B2#lastevent,
@ -203,10 +203,13 @@ 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 org.joda.time.DateTime,
instrument String, units int)
-- TODO need instrument and units too
insert into LongEntryDistinct
select le.current as current, le.time as time
select le.current as current, le.time as time,
le.instrument as instrument, TradeSize as units
from pattern [every-distinct(le.time) le=LongEntryStream]
-- The EsperProcessor java class has a listener for LongEntryDistinct