Add long exit (LX) code
This commit is contained in:
@ -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"));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user