Venice 0.751beta

nz.org.venice.quote
Interface QuoteSource

All Known Implementing Classes:
DatabaseQuoteSource, FileQuoteSource

public interface QuoteSource

Provides a generic interface in which we can query stock quotes from multiple sources. The source could either be directly from files, a database, a unique internal format or from the internet.

Author:
Andrew Leppard

Method Summary
 void cacheExpiry()
          Force the quote source to reload and not use cached values.
 boolean containsDate(TradingDate date)
          Returns whether the source contains any quotes for the given date.
 int getAdvanceDecline(TradingDate date)
          Return the advance/decline for the given date.
 java.util.HashMap getAdvanceDecline(TradingDate startDate, TradingDate endDate)
          Return the advance/decline for the given date range.
 java.util.List getDates()
          Return all the dates which we have quotes for.
 java.util.List getExchangeRates(Currency sourceCurrency, Currency destinationCurrency)
          Return all the stored exchange rates between the two currencies.
 TradingDate getFirstDate()
          Return the earliest date we have any stock quotes for.
 TradingDate getLastDate()
          Return the latest date we have any stock quotes for.
 Symbol getSymbol(java.lang.String partialCompanyName)
          Returns the symbol associated with the given company.
 java.lang.String getSymbolName(Symbol symbol)
          Returns the company name associated with the given symbol.
 boolean isMarketIndex(Symbol symbol)
          Is the given symbol a market index?
 boolean loadQuoteRange(EODQuoteRange quoteRange)
          Load the given quote range into the quote cache.
 void shutdown()
          Shutdown the quote source.
 boolean symbolExists(Symbol symbol)
          Returns whether we have any quotes for the given symbol.
 

Method Detail

getSymbolName

public java.lang.String getSymbolName(Symbol symbol)
Returns the company name associated with the given symbol.

Parameters:
symbol - the stock symbol
Returns:
the company name

getSymbol

public Symbol getSymbol(java.lang.String partialCompanyName)
Returns the symbol associated with the given company.

Parameters:
partialCompanyName - a partial company name
Returns:
the company symbol

symbolExists

public boolean symbolExists(Symbol symbol)
Returns whether we have any quotes for the given symbol.

Parameters:
symbol - the symbol we are searching for
Returns:
whether the symbol was found or not

getLastDate

public TradingDate getLastDate()
Return the latest date we have any stock quotes for.

Returns:
the most recent quote date

getFirstDate

public TradingDate getFirstDate()
Return the earliest date we have any stock quotes for.

Returns:
the oldest quote date

loadQuoteRange

public boolean loadQuoteRange(EODQuoteRange quoteRange)
Load the given quote range into the quote cache.

Parameters:
quoteRange - the range of quotes to load
Returns:
TRUE if the operation suceeded
See Also:
EODQuoteCache

containsDate

public boolean containsDate(TradingDate date)
Returns whether the source contains any quotes for the given date.

Parameters:
date - the date
Returns:
wehther the source contains the given date

getDates

public java.util.List getDates()
Return all the dates which we have quotes for.

Returns:
a vector of dates

isMarketIndex

public boolean isMarketIndex(Symbol symbol)
Is the given symbol a market index?

Parameters:
symbol - to test
Returns:
yes or no

getAdvanceDecline

public int getAdvanceDecline(TradingDate date)
                      throws MissingQuoteException
Return the advance/decline for the given date. This returns the number of all ordinary stocks that rose (day close > day open) - the number of all ordinary stocks that fell.

Parameters:
date - the date
Returns:
the difference between the number of advances and declines for date
Throws:
throw - MissingQuoteException if the date isn't in the source
MissingQuoteException

getAdvanceDecline

public java.util.HashMap getAdvanceDecline(TradingDate startDate,
                                           TradingDate endDate)
                                    throws MissingQuoteException
Return the advance/decline for the given date range. This returns the number of all ordinary stocks that rose (day close > day open) - the number of all ordinary stocks that fell.

Parameters:
startDate - the start of the inclusive date range
endDate - the end of the inclusive date range
Returns:
A map of dates and advance/decline differences for each date in the range
Throws:
throw - MissingQuoteException if the date range isn't in the source
MissingQuoteException

getExchangeRates

public java.util.List getExchangeRates(Currency sourceCurrency,
                                       Currency destinationCurrency)
Return all the stored exchange rates between the two currencies.

Parameters:
sourceCurrency - the currency to convert from
destinationCurrency - the currency to convert to
Returns:
the exchange rate being the number of destinationCurrency that you can buy per sourceCurrency

shutdown

public void shutdown()
Shutdown the quote source.


cacheExpiry

public void cacheExpiry()
Force the quote source to reload and not use cached values.


Venice 0.751beta