Package org.wkh.bateman.fetch

Examples of org.wkh.bateman.fetch.YahooQuoteFetcher


        return optimizer.learn();
    }

    public static double getMedianHighOpenSpread(String symbol, int days) throws Exception {
        YahooQuoteFetcher yahooFetcher = new YahooQuoteFetcher();
        String quoteStr = yahooFetcher.fetchQuotes(symbol, days, 60*60*24);
        List<Quote> dailyQuoteList = yahooFetcher.parseQuotes(quoteStr, 60*60*24);
       
        DescriptiveStatistics stats = new DescriptiveStatistics();
       
        for(Quote quote : dailyQuoteList) {
            stats.addValue(quote.getHigh().subtract(quote.getOpen()).doubleValue());
View Full Code Here


        GoogleQuoteFetcher fetcher = new GoogleQuoteFetcher();

        TimeSeries series = fetcher.fetchAndParse(symbol, days, 60); // one minute
        BigDecimal firstPrice = series.getPrices().firstEntry().getValue();
       
        BigDecimal lastBidAskSpread = new YahooQuoteFetcher().fetchBidAskSpread(symbol);
       
        final double minBuy = 0; // allow buying at open price
        final double minSell = firstPrice.multiply(new BigDecimal("0.002")).doubleValue(); // 0.2% of first price to sell (which is hopefully on the order of twice the bid-ask spread)
        final double minStop = minSell;
        final double maxBuy = yearlyMedianDailyIncrease;
View Full Code Here

TOP

Related Classes of org.wkh.bateman.fetch.YahooQuoteFetcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.