基本日足データのダンプ

private void dumpStockDalily(InvestmentAgent agent, Stock stock){
    InformationManager infoManager = agent.getInformationManager();        
    List list = infoManager.getIndexInformation(stock, Time.getTime(), 2);
    IndexInformation yesterdayInfo = (IndexInformation)list.get(0); 
    IndexInformation todayInfo = (IndexInformation)list.get(1); 

    long neagari = todayInfo.getClosingPrice() - yesterdayInfo.getClosingPrice();
    double neagariRitu = ((double)neagari / yesterdayInfo.getClosingPrice() * 100);
    
    String s
        = new SimpleDateFormat("yyyy/MM/dd").format(todayInfo.getDate().getTime())
        + ",コード=" + stock.getCode()
        + ",銘柄=" + stock.getName()
        + ",始値=" +todayInfo.getOpeningPrice()
        + ",終値="+ todayInfo.getClosingPrice()
        + ",出来高=" + todayInfo.getTurnover()
        + ",前日比=" + neagari
        + ",前日比(%)=" + neagariRitu
        ;
    System.out.println(s);
}
  • InformationManager#getIndexInformation(Stock, Calendar, int)だけだと休みの日のデータも取ってくるので、MarketScheduleも使う 違った
  • これくらい取れれば、ソートして、Yahooファイナンスとかの値上がり率ランキングとかは作れそうな感じ
  • EXCELとかに出して見てみないと正しいのかどうかわからんなー