This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Overview

日本の株式市場の株価・財務データを取得するツールです。

各種データは、 Yahoo!ファイナンス からスクレイピングしています。

動作は、Python2.7.6, 3.3.5 で確認しています。

Installation

PyPIからのインストールが簡単です:

easy_install jsm
or
pip install jsm

Usage

jsm.Quotesのインスタンスを作成:

import jsm
q = jsm.Quotes()

以後、作成したインスタンスを使って各種データを取得します。

当日の株価の取得(例ではYahoo!の証券コードを指定):

q.get_price(4689)

過去の株価の取得:

q.get_historical_prices(4689)

デフォルトでは当日から過去1ヶ月のデイリー株価を取得します。

週間, 月間の株価の取得:

q.get_historical_prices(4689, jsm.WEEKLY) # 週間株価を取得
q.get_historical_prices(4689, jsm.MONTHLY) # 月間株価を取得

指定した期間の株価の取得:

import datetime
start_date = datetime.date(2011, 1, 1)
end_date = datetime.date(2011, 2, 1)
q.get_historical_prices(4689, jsm.DAILY, start_date, end_date) # 2011/1/1 〜 2011/2/1までの株価を取得

2000/1/1〜現在までの株価の取得:

q.get_historical_prices(4689, jsm.DAILY, all=True) # 負荷をかけるので要注意

株価取得メソッド(get_price, get_historical_prices)の戻り値は、PriceDataクラスのインスタンスです。

PriceDataについては、下記Data項を参照してください。

jsmには、取得した株価をCSV形式で保存する為の便利なクラスが用意されています。

株価をCSV形式で保存:

c = jsm.QuotesCsv()
c.save_price(4689)
c.save_historical_prices(4689) # get_historical_pricesと同じ使い方

対象の財務情報を得る為には、以下のメソッドを利用します。

財務情報の取得:

q.get_finance(4689)

財務情報取得メソッド(get_finance)の戻り値は、FinanceDataクラスのインスタンスです。

FinanceDataについては、下記Data項を参照してください。

またjsmでは、業種別の銘柄情報を得ることができます。

業種別の銘柄情報を得る為には、以下のメソッドを利用します。

業種別の銘柄情報の取得:

q.get_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' # サービス業

銘柄情報取得メソッド(get_brand)の戻り値は、BrandDataクラスのインスタンスです。

BrandDataについては、下記Data項を参照してください。

Data

PriceData:

date      # 日時
open      # 初値
high      # 高値
low       # 安値
close     # 終値
volume    # 出来高

FinanceData:

market_cap        # 時価総額
shares_issued     # 発行済株式数
dividend_yield    # 配当利回り
dividend_one      # 1株配当
per               # 株価収益率
pbr               # 純資産倍率
eps               # 1株利益
bps               # 1株純資産
price_min         # 最低購入代金
round_lot         # 単元株数
years_high        # 年初来高値
years_low         # 年初来安値

BrandData:

ccode     # 証券コード
market    # 市場
name      # 銘柄名
info      # 銘柄情報

Changelog

0.19 (2015-11-10)

  • #24 Fix search
  • #23 Add pypi badge

0.18 (2015-03-24)

  • #22 Added Features support for fund data

0.17 (2015-03-14)

  • #20 Use requests and six to absorb differences of python 2 and 3

0.16 (2015-03-08)

  • #18 Fixed search

0.15 (2015-03-08)

  • #17 Added price._adj_close to function _price_to_csv
  • #19 Add TravisCI configuration

0.14 (2014-11-13)

  • Fixed failed to fetch topix data

0.13 (2014-10-26)

  • Improved exception

0.12 (2014-08-31)

  • Fixed #14 get_historical_prices error

0.11 (2014-08-18)

  • Fixed invalid literal for int() with base 10

0.10 (2014-06-28)

  • Fixed #10 duplicated data
  • Fixed #11 get_latest_one return None

0.9 (2014-06-28)

  • Fixed #9 historicalprices error

0.8 (2014-06-07)

  • Fixed bug

0.7 (2014-04-28)

  • Python3 support
  • Fixed bug

0.6 (2013-02-03)

  • Fixed bug

0.5 (2011-09-08)

  • Fixed bug

0.4 (2011-09-05)

  • Fixed bug

0.3 (2011-09-04)

  • Added search method

0.2 (2011-08-20)

  • Fixed bug
  • Improved API

0.1 (2011-08-08)

  • First release
Release History

Release History

0.19

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.18

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.17

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.16

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.15

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.14

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.13

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.12

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.11

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.10

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.9

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
jsm-0.19.tar.gz (13.2 kB) Copy SHA256 Checksum SHA256 Source Nov 9, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting