Class BogusFeed.Request

  • Enclosing class:
    BogusFeed

    private static class BogusFeed.Request
    extends Object
    Corresponds to a single market data request submitted to BogusFeed.
    Since:
    1.5.0
    Version:
    $Id$
    Author:
    Colin DuPlantis
    • Field Detail

      • exchangeTokens

        private final List<SimulatedExchange.Token> exchangeTokens
        the collection of subscription tokens associated with this request
      • marketDataRequest

        private final MarketDataRequest marketDataRequest
        the market data request associated with this object
      • id

        private final long id
        the unique identifier of this request
      • feed

        private final BogusFeed feed
        the parent object for this request
      • subscriber

        private final Subscriber subscriber
        the bridge object which receives responses from the parent's nested exchanges and forwards them to the submitter of the request
      • executed

        private boolean executed
        indicates whether this object has been executed yet or not
      • counter

        private static final AtomicLong counter
        counter used to generate unique ids
    • Constructor Detail

      • Request

        private Request​(MarketDataRequest inRequest,
                        BogusFeed inFeed)
        Create a new Request instance.
        Parameters:
        inRequest - a MarketDataRequest value
        inFeed - a BogusFeed value
    • Method Detail

      • execute

        private static String execute​(MarketDataRequest inRequest,
                                      BogusFeed inParentFeed)
                               throws FeedException
        Executes the given MarketDataRequest and returns a handle corresponding to the request.
        Parameters:
        inRequest - a MarketDataRequest value
        inParentFeed - a BogusFeed value
        Returns:
        a String value
        Throws:
        FeedException - if the request could not be executed
      • cancel

        private static void cancel​(String inHandle)
        Cancels the market data request associated with the given handle.
        Parameters:
        inHandle - a String value
      • getUnderlyingInstrument

        private Instrument getUnderlyingInstrument​(String inSymbol)
        Gets the underlying instrument for the given symbol.
        Parameters:
        inSymbol - a String value
        Returns:
        an Instrument value
      • execute

        private void execute()
                      throws FeedException
        Executes the market data request associated with this object.
        Throws:
        IllegalStateException - if this method has already been executed for this object
        FeedException - if the request is for Option asset class and contains a symbol that is not OSI-compliant
      • doStatistics

        private void doStatistics​(ExchangeRequest inExchangeRequest,
                                  String inExchangeToUse)
        Executes a statistics request for the given request using the given exchange code.
        Parameters:
        inExchangeRequest - an ExchangeRequest value
        inExchangeToUse - a String value
      • doDividends

        private void doDividends​(ExchangeRequest inExchangeRequest,
                                 String inExchangeToUse)
        Executes a dividend request for the given request using the given exchange code.
        Parameters:
        inExchangeRequest - an ExchangeRequest value
        inExchangeToUse - a String value
      • doDepthOfBook

        private void doDepthOfBook​(ExchangeRequest inRequest,
                                   String inExchangeToUse)
        Executes a depth-of-book request for the given request using the given exchange code.
        Parameters:
        inRequest - an ExchangeRequest value
        inExchangeToUse - a String value
      • doTopOfBook

        private void doTopOfBook​(ExchangeRequest inRequest,
                                 String inExchangeToUse)
        Executes a top-of-book request for the given request using the given exchange code.
        Parameters:
        inRequest - an ExchangeRequest value
        inExchangeToUse - a String value
      • doLatestTick

        private void doLatestTick​(ExchangeRequest inRequest,
                                  String inExchangeToUse)
        Executes a latest-tick request for the given request using the given exchange code.
        Parameters:
        inRequest - an ExchangeRequest value
        inExchangeToUse - a String value
      • cancel

        private void cancel()
        Cancels all subscriptions associated with this request.
      • getIDAsString

        private String getIDAsString()
        Returns the request ID as a String.
        Returns:
        a String value