|
Venice 0.751beta | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnz.org.venice.quote.DatabaseQuoteSource
Provides functionality to obtain stock quotes from a database. This class implements the QuoteSource interface to allow users to obtain stock quotes in the fastest possible manner. Example:
EODQuoteRange quoteRange = new EODQuoteRange("CBA");
EODQuoteBundle quoteBundle = new EODQuoteBundle(quoteRange);
try {
float = quoteBundle.getQuote("CBA", Quote.DAY_OPEN, 0);
}
catch(QuoteNotLoadedException e) {
//...
}
Quote,
EODQuote,
EODQuoteRange,
EODQuoteBundle| Constructor Summary | |
DatabaseQuoteSource(DatabaseManager manager)
Creates a new quote source to connect to an external database. |
|
| Method Summary | |
void |
cacheExpiry()
Force the database to reset the first and last dates so that new data can be displayed. |
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 firstDate,
TradingDate lastDate)
Return the advance/decline for the given date. |
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 first date in the database that has any quotes. |
TradingDate |
getLastDate()
Return the last date in the database that has any quotes. |
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. |
void |
importExchangeRates(java.util.List exchangeRates)
Import currency exchange rates into the database. |
int |
importQuotes(java.util.List quotes)
Import quotes into the database. |
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DatabaseQuoteSource(DatabaseManager manager)
manager - The DatabaseManager object which manages software,
username/host/port etc.| Method Detail |
public java.lang.String getSymbolName(Symbol symbol)
getSymbolName in interface QuoteSourcesymbol - the stock symbol.
public Symbol getSymbol(java.lang.String partialCompanyName)
getSymbol in interface QuoteSourcepartialCompanyName - a partial company name.
public boolean symbolExists(Symbol symbol)
symbolExists in interface QuoteSourcesymbol - the symbol we are searching for
public TradingDate getFirstDate()
getFirstDate in interface QuoteSourcepublic void cacheExpiry()
cacheExpiry in interface QuoteSourcepublic TradingDate getLastDate()
getLastDate in interface QuoteSourcepublic boolean isMarketIndex(Symbol symbol)
isMarketIndex in interface QuoteSourcesymbol - to test
public boolean loadQuoteRange(EODQuoteRange quoteRange)
loadQuoteRange in interface QuoteSourcequoteRange - the range of quotes to load
TRUE if the operation suceededEODQuote,
EODQuoteCachepublic int importQuotes(java.util.List quotes)
quotes - list of quotes to import
public boolean containsDate(TradingDate date)
containsDate in interface QuoteSourcedate - the date
public java.util.List getDates()
getDates in interface QuoteSource
public int getAdvanceDecline(TradingDate date)
throws MissingQuoteException
getAdvanceDecline in interface QuoteSourcedate - the date
throws - MissingQuoteException if the date wasn't in the source
MissingQuoteException
public java.util.HashMap getAdvanceDecline(TradingDate firstDate,
TradingDate lastDate)
throws MissingQuoteException
getAdvanceDecline in interface QuoteSourcefirstDate - the first date in the rangelastDate - the last date in the range
throw - MissingQuoteException if none of the dates are in the source
MissingQuoteExceptionpublic void importExchangeRates(java.util.List exchangeRates)
exchangeRates - a list of exchange rates to import.
public java.util.List getExchangeRates(Currency sourceCurrency,
Currency destinationCurrency)
QuoteSource
getExchangeRates in interface QuoteSourcesourceCurrency - the currency to convert fromdestinationCurrency - the currency to convert to
public void shutdown()
QuoteSource
shutdown in interface QuoteSource
|
Venice 0.751beta | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||