Interface TickTradingContext
- All Known Implementing Classes:
TickBacktester
public interface TickTradingContext
Order entry and account access for a
TickStrategy. Orders placed
during onTick are only eligible to fill from the next tick
onwards — you cannot trade against the print you are reacting to.-
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(long orderId) Cancels a working limit order.doublecash()doublelastPrice(int symbolId) Last traded price for the symbol (NaN before its first tick).longposition(int symbolId) longsubmitLimit(int symbolId, Side side, double price, long quantity) Places a passive limit order.longsubmitMarket(int symbolId, Side side, long quantity) Immediate execution at the last trade price plus half the configured spread (aggressor pays the spread).symbolName(int symbolId) Symbol name for an id from the tick file.
-
Method Details
-
submitLimit
Places a passive limit order. It fills when a later tick trades through the price, or partially as traded volume at the price works off the simulated queue ahead of it.- Returns:
- order id for
cancel(long)
-
submitMarket
Immediate execution at the last trade price plus half the configured spread (aggressor pays the spread). Returns a negative id if no price has been seen for the symbol yet. -
cancel
boolean cancel(long orderId) Cancels a working limit order. False if unknown or already filled. -
position
long position(int symbolId) -
cash
double cash() -
lastPrice
double lastPrice(int symbolId) Last traded price for the symbol (NaN before its first tick). -
symbolName
Symbol name for an id from the tick file.
-