예제 #1
0
파일: __init__.py 프로젝트: keithseahus/jsm
 def get_historical_prices(self, ccode, range_type=DAILY, start_date=None, end_date=None, all=False):
     """過去の株価情報を取得
     ccode: 証券コード
     range_type: 取得タイプ(RANGE_DAILY, RANGE_WEEKLY, RANGE_MONTHLY)
     start_date: 取得開始日時(default: end_dateから1ヶ月前)
     end_date: 取得終了日時(default: 今日)
     all: Trueなら全データ取得
     """
     ccode = to_utf8(ccode)
     if range_type == DAILY:
         p = HistoricalDailyPrices()
     elif range_type == WEEKLY:
         p = HistoricalWeeklyPrices()
     elif range_type == MONTHLY:
         p = HistoricalMonthlyPrices()
     else:
         raise Exception('Illegal range type: %s' % range_type)
     
     if all:
         return p.get_all(ccode)
     
     if not end_date:
         end_date = datetime.date.today()
     if not start_date:
         start_date = datetime.date.fromtimestamp(time.mktime(end_date.timetuple()) - 2592000)
     end_date = datetime.date.today()
     return p.get_range(ccode, start_date, end_date)
예제 #2
0
파일: __init__.py 프로젝트: tkyn/jsm
    def get_historical_prices(self,
                              ccode,
                              range_type=DAILY,
                              start_date=None,
                              end_date=None,
                              all=False):
        """過去の株価情報を取得
        ccode: 証券コード
        range_type: 取得タイプ(RANGE_DAILY, RANGE_WEEKLY, RANGE_MONTHLY)
        start_date: 取得開始日時(default: end_dateから1ヶ月前)
        end_date: 取得終了日時(default: 今日)
        all: Trueなら全データ取得
        """
        ccode = to_utf8(ccode)
        if range_type == DAILY:
            p = HistoricalDailyPrices()
        elif range_type == WEEKLY:
            p = HistoricalWeeklyPrices()
        elif range_type == MONTHLY:
            p = HistoricalMonthlyPrices()
        else:
            raise Exception('Illegal range type: %s' % range_type)

        if all:
            return p.get_all(ccode)

        if not end_date:
            end_date = datetime.date.today()
        if not start_date:
            start_date = datetime.date.fromtimestamp(
                time.mktime(end_date.timetuple()) - 2592000)
        return p.get_range(ccode, start_date, end_date)
예제 #3
0
파일: __init__.py 프로젝트: keithseahus/jsm
 def get_price(self, ccode):
     """現在の株価を取得
     ccode: 証券コード
     """
     ccode = to_utf8(ccode)
     p = Price()
     return p.get(ccode)
예제 #4
0
파일: __init__.py 프로젝트: tkyn/jsm
 def get_price(self, ccode):
     """現在の株価を取得
     ccode: 証券コード
     """
     ccode = to_utf8(ccode)
     p = Price()
     return p.get(ccode)
예제 #5
0
파일: __init__.py 프로젝트: keithseahus/jsm
 def get_brand(self, brand_id=None):
     """業種別銘柄リストを取得
     brand_id: 業種種類
             '0050': 農林・水産業
             '1050': 鉱業
             '2050': 建設業
             '3050': 食料品
             '3100': 繊維製品
             '3150': パルプ・紙
             '3200': 化学
             '3250': 医薬品
             '3300': 石油・石炭製品
             '3350': ゴム製品
             '3400': ガラス・土石製品
             '3450': 鉄鋼
             '3500': 非鉄金属
             '3550': 金属製品
             '3600': 機械
             '3650': 電気機器
             '3700': 輸送機器
             '3750': 精密機器
             '3800': その他製品
             '4050': 電気・ガス業
             '5050': 陸運業
             '5100': 海運業
             '5150': 空運業
             '5200': 倉庫・運輸関連業
             '5250': 情報・通信
             '6050': 卸売業
             '6100': 小売業
             '7050': 銀行業
             '7100': 証券業
             '7150': 保険業
             '7200': その他金融業
             '8050': 不動産業
             '9050': サービス業
             None: 全業種
     """
     brand_id = to_utf8(brand_id)
     b = Brand()
     if not brand_id:
         return b.get_all()
     return getattr(b, 'get_%s' % brand_id)()
예제 #6
0
파일: __init__.py 프로젝트: tkyn/jsm
 def get_brand(self, brand_id=None):
     """業種別銘柄リストを取得
     brand_id: 業種種類
             '0050': 農林・水産業
             '1050': 鉱業
             '2050': 建設業
             '3050': 食料品
             '3100': 繊維製品
             '3150': パルプ・紙
             '3200': 化学
             '3250': 医薬品
             '3300': 石油・石炭製品
             '3350': ゴム製品
             '3400': ガラス・土石製品
             '3450': 鉄鋼
             '3500': 非鉄金属
             '3550': 金属製品
             '3600': 機械
             '3650': 電気機器
             '3700': 輸送機器
             '3750': 精密機器
             '3800': その他製品
             '4050': 電気・ガス業
             '5050': 陸運業
             '5100': 海運業
             '5150': 空運業
             '5200': 倉庫・運輸関連業
             '5250': 情報・通信
             '6050': 卸売業
             '6100': 小売業
             '7050': 銀行業
             '7100': 証券業
             '7150': 保険業
             '7200': その他金融業
             '8050': 不動産業
             '9050': サービス業
             None: 全業種
     """
     brand_id = to_utf8(brand_id)
     b = Brand()
     if not brand_id:
         return b.get_all()
     return getattr(b, 'get_%s' % brand_id)()
예제 #7
0
파일: __init__.py 프로젝트: keithseahus/jsm
 def get_finance(self, ccode):
     """財務データを取得
     """
     ccode = to_utf8(ccode)
     f = Finance()
     return f.get(ccode)
예제 #8
0
파일: __init__.py 프로젝트: keithseahus/jsm
 def search(self, terms):
     """銘柄検索"""
     terms = to_utf8(terms)
     s = Search()
     return s.get(terms)
예제 #9
0
파일: __init__.py 프로젝트: tkyn/jsm
 def get_finance(self, ccode):
     """財務データを取得
     """
     ccode = to_utf8(ccode)
     f = Finance()
     return f.get(ccode)
예제 #10
0
파일: __init__.py 프로젝트: tkyn/jsm
 def search(self, terms):
     """銘柄検索"""
     terms = to_utf8(terms)
     s = Search()
     return s.get(terms)