Add long exit (LX) code

This commit is contained in:
2018-11-14 21:14:31 -08:00
parent 7680ed81a2
commit d83b1da903
2 changed files with 51 additions and 0 deletions

View File

@ -61,6 +61,20 @@ public class EsperProcessor implements TickProcessor {
newData[0].get("current"),
newData[0].get("time"));
});
// respond to long exit events
addStatement("select * from LongExitStream",
(newData, oldData) -> {
String instrument = (String)newData[0].get("instrument");
Integer units = (Integer)newData[0].get("units");
trader.placeOrder(new MarketOrderRequest(instrument, units));
log.debug("Long exit triggered: {} of {} at price {} at time {}",
units,
instrument,
newData[0].get("current"),
newData[0].get("time"));
});
}
/**