Apama 10.3 | Apama Capital Markets Foundation Documentation | Capital Markets Foundation | Market Data Management | Using low-level MDA interfaces | Accessing quotebook datastream information
 
Accessing quotebook datastream information
This section contains details about accessing quotebook datastream information along with an example.
*The prices in a quotebook use the Apama decimal data type, introduced in the Apama 5.0 release.
*The quotebook can be accessed and iterated over by both Price ordering (the *PriceLevel() actions) and by Quantity ordering (the *QuantityLevel() actions.
*You can use the following helper actions:
*getBestPriceForQuantity() - Get the best price for a quantity with a matching quote in the book.
*getPriceForQuantity() - Get the worst price for any quantity by accumulating the quote quantities.
*getVWAP() - Calculate the VWAP for the whole book.
*getVWAPForQuantities() - Calculate the VWAP for a given sequence of quantities.
The following example uses the getVWAP() helper action and then iterates over the datastream using the getQuotesByQuantityLevel() action.
action onAllQuotes(com.apama.md.client.CurrentQuotebookInterface
currQuotebook) {
log "Got Quotebook using Callback -" at INFO;
log " for symbol: " + currQuotebook.getSymbol() at INFO;
log " Ask VWAP: " + currQuotebook.getAsks().getVWAP().toString() at INFO;
log " Bid VWAP: " + currQuotebook.getBids().getVWAP().toString() at INFO;
 
// Loop through all the Ask quotes in Quantity order
integer maxLevels := currQuotebook.getAsks().getMaxKnownQuoteQuantityLevel();
integer level := 0;
while (level < maxLevels) {
sequence<com.apama.md.client.QuoteEntryInterface> quotes :=
currQuotebook.getAsks().getQuotesByQuantityLevel(level);
com.apama.md.client.QuoteEntryInterface quote;
 
log " Asks for Level: " + level.toString() at INFO;
 
for quote in quotes {
log " Quantity: " + quote.getQuantity().toString() at INFO;
log " Price: " + quote.getPrice().toString() at INFO;
log " Party: " + quote.getParty().toString() at INFO;
log " QuoteId: " + quote.getQuoteId().toString() at INFO;
log " RequestId:" + quote.getRequestId().toString() at INFO;
log " Tradeable:" + quote.getTradeable().toString() at INFO;
}
 
level := level + 1;
}
}

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.