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 Type
    Method
    Description
    boolean
    cancel(long orderId)
    Cancels a working limit order.
    double
     
    double
    lastPrice(int symbolId)
    Last traded price for the symbol (NaN before its first tick).
    long
    position(int symbolId)
     
    long
    submitLimit(int symbolId, Side side, double price, long quantity)
    Places a passive limit order.
    long
    submitMarket(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

      long submitLimit(int symbolId, Side side, double price, long quantity)
      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

      long submitMarket(int symbolId, Side side, long quantity)
      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

      String symbolName(int symbolId)
      Symbol name for an id from the tick file.