|
Venice 0.7beta | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mov.quote.DatabaseQuoteSource
public class 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| Field Summary | |
|---|---|
static int |
EXTERNAL
External database. |
static int |
HSQLDB
Hypersonic SQL Database. |
static java.lang.String |
HSQLDB_SOFTWARE
|
static int |
INTERNAL
Internal database. |
static int |
MYSQL
MySQL Database. |
static java.lang.String |
MYSQL_SOFTWARE
|
static int |
OTHER
Any generic SQL Database. |
static int |
POSTGRESQL
PostgreSQL Database. |
static java.lang.String |
POSTGRESQL_SOFTWARE
|
| Constructor Summary | |
|---|---|
DatabaseQuoteSource(java.lang.String fileName)
Create a new quote source to connect to an internal HSQL database stored in the given file. |
|
DatabaseQuoteSource(java.lang.String software,
java.lang.String driver,
java.lang.String host,
java.lang.String port,
java.lang.String database,
java.lang.String username,
java.lang.String password)
Creates a new quote source to connect to an external database. |
|
| Method Summary | |
|---|---|
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.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 database. |
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 |
| Field Detail |
|---|
public static final int MYSQL
public static final int POSTGRESQL
public static final int HSQLDB
public static final int OTHER
public static final int INTERNAL
public static final int EXTERNAL
public static final java.lang.String MYSQL_SOFTWARE
public static final java.lang.String POSTGRESQL_SOFTWARE
public static final java.lang.String HSQLDB_SOFTWARE
| Constructor Detail |
|---|
public DatabaseQuoteSource(java.lang.String software,
java.lang.String driver,
java.lang.String host,
java.lang.String port,
java.lang.String database,
java.lang.String username,
java.lang.String password)
software - the database softwaredriver - the class name for the driver to connect to the databasehost - the host location of the databaseport - the port of the databasedatabase - the name of the databaseusername - the user loginpassword - the password for the loginpublic DatabaseQuoteSource(java.lang.String fileName)
fileName - name of database file| 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 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
MissingQuoteExceptionpublic void shutdown()
shutdown in interface QuoteSourcepublic 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
|
Venice 0.7beta | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||