*/
public static final int UPDATE_TIME = 10;
public static void downloadMarketData(String name) {
CreateMarketTrainingDialog dialog = new CreateMarketTrainingDialog(
EncogWorkBench.getInstance().getMainWindow());
dialog.getFromDay().setValue(1);
dialog.getFromMonth().setValue(1);
dialog.getFromYear().setValue(1995);
dialog.getToDay().setValue(31);
dialog.getToMonth().setValue(12);
dialog.getToYear().setValue(2005);
if (dialog.process()) {
String ticker = dialog.getTicker().getValue();
int fromDay = dialog.getFromDay().getValue();
int fromMonth = dialog.getFromMonth().getValue();
int fromYear = dialog.getFromYear().getValue();
int toDay = dialog.getToDay().getValue();
int toMonth = dialog.getToMonth().getValue();
int toYear = dialog.getToYear().getValue();
Calendar begin = new GregorianCalendar(fromYear, fromMonth - 1,
fromDay);
Calendar end = new GregorianCalendar(toYear, toMonth - 1, toDay);
try {
final YahooDownload loader = new YahooDownload();
if (end.getTimeInMillis() < begin.getTimeInMillis()) {
EncogWorkBench.displayError("Dates",
"Ending date should not be before begin date.");
return;
}
File targetFile = new File(EncogWorkBench.getInstance()
.getProjectDirectory(), name);
EncogWorkBench.getInstance().getMainWindow().beginWait();
loader.loadAllData(dialog.getTicker().getValue(),
targetFile, CSVFormat.ENGLISH,
begin.getTime(), end.getTime());
} catch (QuantError e) {
EncogWorkBench.displayError("Ticker Symbol",