Class BogusFeed.Request
- java.lang.Object
-
- org.marketcetera.marketdata.bogus.BogusFeed.Request
-
- Enclosing class:
- BogusFeed
private static class BogusFeed.Request extends Object
Corresponds to a single market data request submitted toBogusFeed.- Since:
- 1.5.0
- Version:
- $Id$
- Author:
- Colin DuPlantis
-
-
Field Summary
Fields Modifier and Type Field Description private static AtomicLongcountercounter used to generate unique idsprivate List<SimulatedExchange.Token>exchangeTokensthe collection of subscription tokens associated with this requestprivate booleanexecutedindicates whether this object has been executed yet or notprivate BogusFeedfeedthe parent object for this requestprivate longidthe unique identifier of this requestprivate MarketDataRequestmarketDataRequestthe market data request associated with this objectprivate static Map<String,BogusFeed.Request>requestsall requests by their ID (represented as string)private Subscribersubscriberthe bridge object which receives responses from the parent's nested exchanges and forwards them to the submitter of the request
-
Constructor Summary
Constructors Modifier Constructor Description privateRequest(MarketDataRequest inRequest, BogusFeed inFeed)Create a new Request instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcancel()Cancels all subscriptions associated with this request.private static voidcancel(String inHandle)Cancels the market data request associated with the given handle.private voiddoDepthOfBook(ExchangeRequest inRequest, String inExchangeToUse)Executes a depth-of-book request for the given request using the given exchange code.private voiddoDividends(ExchangeRequest inExchangeRequest, String inExchangeToUse)Executes a dividend request for the given request using the given exchange code.private voiddoLatestTick(ExchangeRequest inRequest, String inExchangeToUse)Executes a latest-tick request for the given request using the given exchange code.private voiddoStatistics(ExchangeRequest inExchangeRequest, String inExchangeToUse)Executes a statistics request for the given request using the given exchange code.private voiddoTopOfBook(ExchangeRequest inRequest, String inExchangeToUse)Executes a top-of-book request for the given request using the given exchange code.private voidexecute()Executes the market data request associated with this object.private static Stringexecute(MarketDataRequest inRequest, BogusFeed inParentFeed)Executes the givenMarketDataRequestand returns a handle corresponding to the request.private StringgetIDAsString()Returns the request ID as aString.private InstrumentgetUnderlyingInstrument(String inSymbol)Gets the underlying instrument for the given symbol.
-
-
-
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
-
requests
private static final Map<String,BogusFeed.Request> requests
all requests by their ID (represented as string)
-
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- aMarketDataRequestvalueinFeed- aBogusFeedvalue
-
-
Method Detail
-
execute
private static String execute(MarketDataRequest inRequest, BogusFeed inParentFeed) throws FeedException
Executes the givenMarketDataRequestand returns a handle corresponding to the request.- Parameters:
inRequest- aMarketDataRequestvalueinParentFeed- aBogusFeedvalue- Returns:
- a
Stringvalue - 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- aStringvalue
-
getUnderlyingInstrument
private Instrument getUnderlyingInstrument(String inSymbol)
Gets the underlying instrument for the given symbol.- Parameters:
inSymbol- aStringvalue- Returns:
- an
Instrumentvalue
-
execute
private void execute() throws FeedExceptionExecutes the market data request associated with this object.- Throws:
IllegalStateException- if this method has already been executed for this objectFeedException- 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- anExchangeRequestvalueinExchangeToUse- aStringvalue
-
doDividends
private void doDividends(ExchangeRequest inExchangeRequest, String inExchangeToUse)
Executes a dividend request for the given request using the given exchange code.- Parameters:
inExchangeRequest- anExchangeRequestvalueinExchangeToUse- aStringvalue
-
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- anExchangeRequestvalueinExchangeToUse- aStringvalue
-
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- anExchangeRequestvalueinExchangeToUse- aStringvalue
-
doLatestTick
private void doLatestTick(ExchangeRequest inRequest, String inExchangeToUse)
Executes a latest-tick request for the given request using the given exchange code.- Parameters:
inRequest- anExchangeRequestvalueinExchangeToUse- aStringvalue
-
cancel
private void cancel()
Cancels all subscriptions associated with this request.
-
getIDAsString
private String getIDAsString()
Returns the request ID as aString.- Returns:
- a
Stringvalue
-
-