def save_historical_prices(self, path, ccode, range_type=DAILY, start_date=None, end_date=None, all=False): """過去の株価情報をCSVファイルに保存 ccode: 証券コード range_type: 取得タイプ(RANGE_DAILY, RANGE_WEEKLY, RANGE_MONTHLY) start_date: 取得開始日時(default: end_dateから1ヶ月前) end_date: 取得終了日時(default: 今日) all: Trueなら全データ取得 """ path = to_unicode(path) q = Quotes() prices = q.get_historical_prices(ccode, range_type, start_date, end_date, all) c = csv.writer(open(path, 'w')) for price in prices: c.writerow(self._price_to_csvl(price))
def save_price(self, path, ccode): path = to_unicode(path) q = Quotes() price = q.get_price(ccode) c = csv.writer(open(path, 'w')) c.writerow(self._price_to_csvl(price))