├── krx
├── __init__.py
├── listing.py
└── data.py
├── nasdaq
├── __init__.py
└── listing.py
├── naver
├── __init__.py
├── listing.py
└── data.py
├── investing
├── __init__.py
├── listing.py
└── data.py
├── wikipedia
├── __init__.py
└── listing.py
├── _config.yml
├── docs
├── _build
│ ├── html
│ │ ├── _static
│ │ │ ├── custom.css
│ │ │ ├── up.png
│ │ │ ├── down.png
│ │ │ ├── file.png
│ │ │ ├── plus.png
│ │ │ ├── comment.png
│ │ │ ├── minus.png
│ │ │ ├── ajax-loader.gif
│ │ │ ├── down-pressed.png
│ │ │ ├── up-pressed.png
│ │ │ ├── comment-bright.png
│ │ │ ├── comment-close.png
│ │ │ ├── documentation_options.js
│ │ │ ├── translations.js
│ │ │ ├── pygments.css
│ │ │ ├── doctools.js
│ │ │ ├── underscore.js
│ │ │ ├── basic.css
│ │ │ ├── alabaster.css
│ │ │ ├── searchtools.js
│ │ │ └── websupport.js
│ │ ├── objects.inv
│ │ ├── .buildinfo
│ │ ├── _sources
│ │ │ ├── ticker.rst.txt
│ │ │ ├── source
│ │ │ │ └── ticker.rst.txt
│ │ │ ├── tickers.rst.txt
│ │ │ └── index.rst.txt
│ │ ├── genindex.html
│ │ ├── search.html
│ │ ├── ticker.html
│ │ ├── source
│ │ │ └── ticker.html
│ │ ├── searchindex.js
│ │ ├── tickers.html
│ │ └── index.html
│ └── doctrees
│ │ ├── index.doctree
│ │ ├── ticker.doctree
│ │ ├── tickers.doctree
│ │ ├── environment.pickle
│ │ └── source
│ │ └── ticker.doctree
├── Makefile
├── make.bat
├── tickers.rst
├── index.rst
└── conf.py
├── dist
├── finance_datareader-0.2.0-py3-none-any.whl
├── finance_datareader-0.3.0-py3-none-any.whl
├── finance_datareader-0.4.0-py3-none-any.whl
├── finance_datareader-0.5.0-py3-none-any.whl
├── finance_datareader-0.6.0-py3-none-any.whl
├── finance_datareader-0.7.0-py3-none-any.whl
├── finance_datareader-0.7.2-py3-none-any.whl
├── finance_datareader-0.8.0-py3-none-any.whl
├── finance_datareader-0.8.1-py3-none-any.whl
├── finance_datareader-0.8.2-py3-none-any.whl
└── finance_datareader-0.9.0-py3-none-any.whl
├── .gitignore
├── __init__.py
├── _utils.py
├── data.py
└── README.md
/krx/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/nasdaq/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/naver/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/investing/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/wikipedia/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/docs/_build/html/_static/custom.css:
--------------------------------------------------------------------------------
1 | /* This file intentionally left blank. */
2 |
--------------------------------------------------------------------------------
/docs/_build/html/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/objects.inv
--------------------------------------------------------------------------------
/docs/_build/html/_static/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/up.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/down.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/file.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/plus.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/doctrees/index.doctree
--------------------------------------------------------------------------------
/docs/_build/doctrees/ticker.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/doctrees/ticker.doctree
--------------------------------------------------------------------------------
/docs/_build/doctrees/tickers.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/doctrees/tickers.doctree
--------------------------------------------------------------------------------
/docs/_build/html/_static/comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/comment.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/minus.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/environment.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/doctrees/environment.pickle
--------------------------------------------------------------------------------
/docs/_build/html/_static/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/ajax-loader.gif
--------------------------------------------------------------------------------
/docs/_build/html/_static/down-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/down-pressed.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/up-pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/up-pressed.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/source/ticker.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/doctrees/source/ticker.doctree
--------------------------------------------------------------------------------
/docs/_build/html/_static/comment-bright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/comment-bright.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/comment-close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/docs/_build/html/_static/comment-close.png
--------------------------------------------------------------------------------
/dist/finance_datareader-0.2.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.2.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.3.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.3.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.4.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.4.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.5.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.5.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.6.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.6.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.7.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.7.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.7.2-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.7.2-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.8.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.8.0-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.8.1-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.8.1-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.8.2-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.8.2-py3-none-any.whl
--------------------------------------------------------------------------------
/dist/finance_datareader-0.9.0-py3-none-any.whl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaolai/FinanceDataReader/HEAD/dist/finance_datareader-0.9.0-py3-none-any.whl
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | __pycache__
3 | *.pyc
4 | *.egg-info
5 | .coverage
6 | build
7 | docs/build
8 | .tox/
9 | .cache/
10 | .idea
11 | *.iml
12 | *~
13 |
--------------------------------------------------------------------------------
/__init__.py:
--------------------------------------------------------------------------------
1 | from .data import (DataReader)
2 | from .data import (StockListing)
3 |
4 | from .data import (EtfListing)
5 |
6 | __version__ = '0.9.0'
7 |
8 | __all__ = ['__version__', 'DataReader', 'StockListing', 'EtfListing']
9 |
--------------------------------------------------------------------------------
/docs/_build/html/.buildinfo:
--------------------------------------------------------------------------------
1 | # Sphinx build info version 1
2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3 | config: 2a043b2a80b428ab01264a8200dd782e
4 | tags: 645f666f9bcd5a90fca523b33c5a78b7
5 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/documentation_options.js:
--------------------------------------------------------------------------------
1 | var DOCUMENTATION_OPTIONS = {
2 | URL_ROOT: '',
3 | VERSION: '0.4.0',
4 | LANGUAGE: 'ko',
5 | COLLAPSE_INDEX: false,
6 | FILE_SUFFIX: '.html',
7 | HAS_SOURCE: true,
8 | SOURCELINK_SUFFIX: '.txt'
9 | };
--------------------------------------------------------------------------------
/docs/_build/html/_sources/ticker.rst.txt:
--------------------------------------------------------------------------------
1 | 티커 코드
2 | =====================
3 |
4 |
5 |
6 | ===== ===== =======
7 | A B A and B
8 | ===== ===== =======
9 | False False False
10 | True False False
11 | False True False
12 | True True True
13 | ===== ===== =======
14 |
--------------------------------------------------------------------------------
/docs/_build/html/_sources/source/ticker.rst.txt:
--------------------------------------------------------------------------------
1 | 티커 코드
2 | =====================
3 |
4 |
5 |
6 | ===== ===== =======
7 | A B A and B
8 | ===== ===== =======
9 | False False False
10 | True False False
11 | False True False
12 | True True True
13 | ===== ===== =======
14 |
--------------------------------------------------------------------------------
/wikipedia/listing.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 |
3 | class WikipediaStockListing:
4 | def __init__(self, market):
5 | self.market = market
6 |
7 | def read(self):
8 | url = 'https://en.wikipedia.org/wiki/List_of_S&P_500_companies'
9 | df = pd.read_html(url, header=0)[0]
10 | cols_ren = {'Security':'Name', 'Ticker symbol':'Symbol', 'GICS Sector':'Sector', 'GICS Sub Industry':'Industry'}
11 | df = df.rename(columns = cols_ren)
12 | df = df[['Symbol', 'Name', 'Sector', 'Industry']]
13 | df['Symbol'] = df['Symbol'].str.replace('\.', '')
14 | return df
15 |
--------------------------------------------------------------------------------
/_utils.py:
--------------------------------------------------------------------------------
1 | import re
2 | from datetime import datetime
3 | from pandas import to_datetime
4 |
5 | def _convert_letter_to_num(str_num):
6 | powers = {'B': 10 ** 9, 'M': 10 ** 6, 'K': 10 ** 3, '': 1}
7 | m = re.search("([0-9\.]+)(M|B|K|)", str_num)
8 | if m:
9 | val = m.group(1)
10 | mag = m.group(2)
11 | return float(val) * powers[mag]
12 | return 0.0
13 |
14 | def _validate_dates(start, end):
15 | start = to_datetime(start)
16 | end = to_datetime(end)
17 |
18 | if start is None:
19 | start = datetime(1970, 1, 1)
20 | if end is None:
21 | end = datetime.today()
22 | return start, end
23 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SPHINXPROJ = FinanceDataReader
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/nasdaq/listing.py:
--------------------------------------------------------------------------------
1 | import re
2 | import pandas as pd
3 |
4 | from FinanceDataReader._utils import (_convert_letter_to_num, _validate_dates)
5 |
6 | class NasdaqStockListing:
7 | def __init__(self, market):
8 | self.market = market
9 |
10 | def read(self):
11 | url = 'http://old.nasdaq.com/screening/companies-by-name.aspx?' \
12 | 'letter=0&render=download&exchange=' + self.market.lower()
13 | df = pd.read_csv(url)
14 | df['MarketCap'] = df['MarketCap'].fillna('')
15 | df['MarketCap'] = df['MarketCap'].apply(_convert_letter_to_num)
16 | df = df.sort_values('MarketCap', ascending=False)
17 | df = df.drop('Unnamed: 8', axis=1)
18 | df = df.reset_index(drop=True)
19 | df = df.rename(columns={'industry':'Industry'})
20 | return df[['Symbol', 'Name', 'Sector', 'Industry']]
21 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=.
11 | set BUILDDIR=_build
12 | set SPHINXPROJ=FinanceDataReader
13 |
14 | if "%1" == "" goto help
15 |
16 | %SPHINXBUILD% >NUL 2>NUL
17 | if errorlevel 9009 (
18 | echo.
19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
20 | echo.installed, then set the SPHINXBUILD environment variable to point
21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
22 | echo.may add the Sphinx directory to PATH.
23 | echo.
24 | echo.If you don't have Sphinx installed, grab it from
25 | echo.http://sphinx-doc.org/
26 | exit /b 1
27 | )
28 |
29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
30 | goto end
31 |
32 | :help
33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
34 |
35 | :end
36 | popd
37 |
--------------------------------------------------------------------------------
/naver/listing.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import json
3 | from pandas.io.json import json_normalize
4 |
5 | from FinanceDataReader._utils import (_convert_letter_to_num, _validate_dates)
6 |
7 | class NaverEtfListing:
8 | def __init__(self):
9 | pass
10 |
11 | def read(self):
12 | url = 'https://finance.naver.com/api/sise/etfItemList.nhn'
13 | df = json_normalize(json.loads(requests.get(url).text), ['result', 'etfItemList'])
14 | rename_cols = {
15 | 'amonut':'Amount', 'changeRate':'ChangeRate', 'changeVal':'Change',
16 | 'etfTabCode':'Category', 'itemcode':'Symbol', 'itemname':'Name',
17 | 'marketSum':'MarCap', 'nav':'NAV', 'nowVal':'Price',
18 | 'quant':'Volume', 'risefall':'RiseFall', 'threeMonthEarnRate':'EarningRate'
19 | }
20 | df.rename(columns=rename_cols, inplace=True)
21 | # 'Symbol', 'Name', 'Price', 'NAV', 'EarningRate', 'Volume',
22 | # 'Change', 'ChangeRate', 'Amount', 'MarCap', 'EarningRate'
23 | return df[['Symbol', 'Name']]
24 |
--------------------------------------------------------------------------------
/naver/data.py:
--------------------------------------------------------------------------------
1 | import re
2 | import requests
3 | import pandas as pd
4 | from io import StringIO
5 | from FinanceDataReader._utils import (_convert_letter_to_num, _validate_dates)
6 |
7 | class NaverDailyReader:
8 | def __init__(self, symbol, start=None, end=None, exchange=None, kind=None):
9 | self.symbol = symbol
10 | start, end = _validate_dates(start, end)
11 | self.start = start
12 | self.end = end
13 |
14 | def read(self):
15 | url = 'https://fchart.stock.naver.com/sise.nhn?timeframe=day&count=6000&requestType=0&symbol='
16 | r = requests.get(url + self.symbol)
17 |
18 | data_list = re.findall(' ', r.text, re.DOTALL)
19 | if len(data_list) == 0:
20 | return pd.DataFrame()
21 | data = '\n'.join(data_list)
22 | df = pd.read_csv(StringIO(data), delimiter='|', header=None, dtype={0:str})
23 | df.columns = ['Date', 'Open', 'High', 'Low', 'Close', 'Volume']
24 | df['Date'] = pd.to_datetime(df['Date'], format='%Y%m%d')
25 | df.set_index('Date', inplace=True)
26 | df.sort_index(inplace=True)
27 | df['Change'] = df['Close'].pct_change()
28 |
29 | return df.query('index>=%r and index<=%r' % (self.start, self.end))
30 |
--------------------------------------------------------------------------------
/docs/tickers.rst:
--------------------------------------------------------------------------------
1 |
2 | 상장종목 목록 (거래소별)
3 | ===============================
4 | 거래소 별로 상장종목 목록을 가져옵니다
5 |
6 | .. code-block:: python
7 |
8 | df = fdr.StockListing('KRX')
9 | df
10 |
11 | 여기에 사용할 수 있는 거래소 심볼은 다음과 같습니다
12 |
13 |
14 | ============== ====================== =============================
15 | 심볼 거래소 비고
16 | ============== ====================== =============================
17 | KRX KRX 종목 전체 KOSPI,KOSDAQ,KONEX 모두
18 | KOSPI KOSPI 종목
19 | KOSDAQ KOSDAQ 종목
20 | KONEX KONEX 종목
21 | KONEX KONEX 종목
22 | NASDAQ 나스닥 종목
23 | NYSE 뉴욕 증권거래소 종목
24 | AMEX AMEX 종목
25 | SP500 S&P 500 종목
26 | ============== ====================== =============================
27 |
28 |
29 |
30 |
31 | 가격 데이터
32 | =====================
33 |
34 | 국내 주식
35 | ---------------------
36 | - 단축 코드(6자리)를 사용합니다. 예를 들어, '005930'(삼성전자), '215600'(신라젠)
37 | - 전체 코드는 `fdr.StockListing('KRX')` 를 통해 얻을 수 있습니다
38 |
39 |
40 | 미국 주식
41 | ---------------------
42 | - 티커를 사용합니다. 예를 들어, 'AAPL'(애플), 'AMZN'(아마존), 'GOOG'(구글)
43 | - NASDAQ 티커 전체는 `fdr.StockListing('NASDAQ')` 를 통해 얻을 수 있습니다
44 |
45 |
46 |
47 | 참고
48 | =====================
49 |
50 | FinanceDataReader 사용자 안내서
51 | * https://financedata.github.io/posts/finance-data-reader-users-guide.html
52 |
53 |
--------------------------------------------------------------------------------
/docs/_build/html/_sources/tickers.rst.txt:
--------------------------------------------------------------------------------
1 |
2 | 상장종목 목록 (거래소별)
3 | ===============================
4 | 거래소 별로 상장종목 목록을 가져옵니다
5 |
6 | .. code-block:: python
7 |
8 | df = fdr.StockListing('KRX')
9 | df
10 |
11 | 여기에 사용할 수 있는 거래소 심볼은 다음과 같습니다
12 |
13 |
14 | ============== ====================== =============================
15 | 심볼 거래소 비고
16 | ============== ====================== =============================
17 | KRX KRX 종목 전체 KOSPI,KOSDAQ,KONEX 모두
18 | KOSPI KOSPI 종목
19 | KOSDAQ KOSDAQ 종목
20 | KONEX KONEX 종목
21 | KONEX KONEX 종목
22 | NASDAQ 나스닥 종목
23 | NYSE 뉴욕 증권거래소 종목
24 | AMEX AMEX 종목
25 | SP500 S&P 500 종목
26 | ============== ====================== =============================
27 |
28 |
29 |
30 |
31 | 가격 데이터
32 | =====================
33 |
34 | 국내 주식
35 | ---------------------
36 | - 단축 코드(6자리)를 사용합니다. 예를 들어, '005930'(삼성전자), '215600'(신라젠)
37 | - 전체 코드는 `fdr.StockListing('KRX')` 를 통해 얻을 수 있습니다
38 |
39 |
40 | 미국 주식
41 | ---------------------
42 | - 티커를 사용합니다. 예를 들어, 'AAPL'(애플), 'AMZN'(아마존), 'GOOG'(구글)
43 | - NASDAQ 티커 전체는 `fdr.StockListing('NASDAQ')` 를 통해 얻을 수 있습니다
44 |
45 |
46 |
47 | 참고
48 | =====================
49 |
50 | FinanceDataReader 사용자 안내서
51 | * https://financedata.github.io/posts/finance-data-reader-users-guide.html
52 |
53 |
--------------------------------------------------------------------------------
/investing/listing.py:
--------------------------------------------------------------------------------
1 | import pandas as pd
2 | import requests
3 | from bs4 import BeautifulSoup
4 |
5 | from FinanceDataReader._utils import (_convert_letter_to_num, _validate_dates)
6 |
7 | class InvestingEtfListing:
8 | def __init__(self, country):
9 | self.country = country.upper()
10 |
11 | def read(self):
12 | country_map = {
13 | 'US':'usa', 'CN':'china',
14 | 'HK':'hong-kong', 'JP':'japan',
15 | 'UK':'uk', 'FR':'france',
16 | }
17 | if self.country not in country_map.keys():
18 | msg = "country unsupported. support countries:" + str(list(country_map.keys()))
19 | raise ValueError(msg)
20 |
21 | headers = { 'User-Agent':'Mozilla', }
22 | url = 'https://kr.investing.com/etfs/' + country_map[self.country] + '-etfs'
23 | r = requests.get(url, headers=headers)
24 |
25 | soup = BeautifulSoup(r.text, 'lxml')
26 | table = soup.find('table', id='etfs')
27 |
28 | values = []
29 | trs = table.tbody.find_all('tr')
30 | for tr in trs:
31 | tds = tr.find_all('td')
32 | data_id = tds[1].span['data-id']
33 | sym = tds[2].text
34 | name = tds[1].a.text
35 | values.append([sym, name])
36 |
37 | df = pd.DataFrame(values, columns=['Symbol', 'Name'])
38 | return df
39 |
--------------------------------------------------------------------------------
/data.py:
--------------------------------------------------------------------------------
1 | from FinanceDataReader.investing.data import (InvestingDailyReader)
2 | from FinanceDataReader.krx.data import (KrxDelistingReader)
3 | from FinanceDataReader.naver.data import (NaverDailyReader)
4 | from FinanceDataReader.nasdaq.listing import (NasdaqStockListing)
5 | from FinanceDataReader.krx.listing import (KrxStockListing, KrxDelisting)
6 | from FinanceDataReader.wikipedia.listing import (WikipediaStockListing)
7 | from FinanceDataReader.investing.listing import (InvestingEtfListing)
8 | from FinanceDataReader.naver.listing import (NaverEtfListing)
9 |
10 | import re
11 | import pandas as pd
12 | from datetime import datetime, timedelta
13 |
14 | def DataReader(symbol, start=None, end=None, exchange=None, kind=None):
15 | if (symbol.isdigit() and len(symbol)==6 and exchange==None) or \
16 | (symbol.isdigit() and exchange and exchange.upper() in ['KRX', '한국거래소']):
17 | return NaverDailyReader(symbol, start, end, exchange, kind).read()
18 |
19 | if (symbol.isdigit() and exchange and exchange.upper() in ['KRX-DELISTING']):
20 | return KrxDelistingReader(symbol, start, end, exchange, kind).read()
21 |
22 | reader = InvestingDailyReader
23 | df = reader(symbol, start, end, exchange, kind).read()
24 | end = min([pd.to_datetime(end), datetime.today()])
25 | while df.index[-1] < end:
26 | more = reader(symbol, df.index[-1] + timedelta(1), end, exchange, kind).read()
27 | if len(more) == 0:
28 | break
29 | df = df.append(more)
30 | return df
31 |
32 | def StockListing(market):
33 | market = market.upper()
34 | if market in [ 'NASDAQ', 'NYSE', 'AMEX']:
35 | return NasdaqStockListing(market=market).read()
36 | if market in [ 'KRX', 'KOSPI', 'KOSDAQ', 'KONEX']:
37 | return KrxStockListing(market).read()
38 | if market in [ 'KRX-DELISTING' ]:
39 | return KrxDelisting(market).read()
40 | if market in [ 'S&P500', 'SP500']:
41 | return WikipediaStockListing(market).read()
42 | else:
43 | msg = "market=%s is not implemented" % market
44 | raise NotImplementedError(msg)
45 |
46 | def EtfListing(country='KR'):
47 | if country.upper() == 'KR':
48 | return NaverEtfListing().read()
49 | return InvestingEtfListing(country).read()
50 |
--------------------------------------------------------------------------------
/krx/listing.py:
--------------------------------------------------------------------------------
1 | import io
2 | import requests
3 | import pandas as pd
4 |
5 | class KrxStockListing:
6 | def __init__(self, market):
7 | self.market = market
8 |
9 | def read(self):
10 | marketTypeMap = {'KRX':'', 'KOSPI':'stockMkt', 'KOSDAQ':'kosdaqMkt', 'KONEX':'konexMkt' }
11 | url = 'http://kind.krx.co.kr/corpgeneral/corpList.do?' \
12 | 'method=download&searchType=13&marketType=' + marketTypeMap[self.market]
13 | df = pd.read_html(url, header=0)[0]
14 | df['종목코드'] = df['종목코드'].apply(lambda x: '{:06d}'.format(x))
15 | df['상장일'] = pd.to_datetime(df['상장일'])
16 | cols_ren = {'회사명':'Name', '종목코드':'Symbol', '업종':'Sector', '주요제품':'Industry'}
17 | df = df.rename(columns = cols_ren)
18 | return df[['Symbol', 'Name', 'Sector', 'Industry']]
19 |
20 | class KrxDelisting:
21 | def __init__(self, market):
22 | self.market = market
23 |
24 | def read(self):
25 | # STEP 01: Generate OTP
26 | url = 'http://marketdata.krx.co.kr/contents/COM/GenerateOTP.jspx?' \
27 | 'name=fileDown&filetype=xls&url=MKD/04/0406/04060600/mkd04060600&' \
28 | 'market_gubun=ALL&isu_cdnm=%EC%A0%84%EC%B2%B4&isu_cd=&isu_nm=&' \
29 | 'isu_srt_cd=&fromdate=19900101&todate=22001231&del_cd=1&' \
30 | 'pagePath=%2Fcontents%2FMKD%2F04%2F0406%2F04060600%2FMKD04060600.jsp'
31 |
32 | header_data = {
33 | 'User-Agent': 'Chrome/78.0.3904.87 Safari/537.36',
34 | }
35 | r = requests.get(url, headers=header_data)
36 |
37 | # STEP 02: download
38 | url = 'http://file.krx.co.kr/download.jspx'
39 | form_data = {'code': r.text}
40 | header_data = {
41 | 'Referer': 'http://marketdata.krx.co.kr/contents/MKD/04/0406/04060600/MKD04060600.jsp',
42 | 'User-Agent': 'Chrome/78.0.3904.87 Safari/537.36',
43 | }
44 | r = requests.post(url, data=form_data, headers=header_data)
45 | df = pd.read_excel(io.BytesIO(r.content))
46 | df['종목코드'] = df['종목코드'].str.replace('A', '')
47 | df['폐지일'] = pd.to_datetime(df['폐지일'])
48 | col_map = {'종목코드':'Symbol', '기업명':'Name', '폐지일':'DelistingDate', '폐지사유':'Reason'}
49 | return df.rename(columns=col_map)
50 |
--------------------------------------------------------------------------------
/krx/data.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import pandas as pd
3 | from io import BytesIO
4 | from datetime import datetime
5 |
6 | class KrxDelistingReader:
7 | def __init__(self, symbol, start=None, end=None, exchange=None, kind=None):
8 | self.symbol = symbol
9 | self.start = datetime(1990,1,1) if start==None else pd.to_datetime(start)
10 | self.end = datetime(2100,1,1) if end==None else pd.to_datetime(end)
11 |
12 | def read(self):
13 | # STEP 01: Generate OTP
14 | url = "http://marketdata.krx.co.kr/contents/COM/GenerateOTP.jspx"
15 | form_data = {
16 | 'name':'fileDown',
17 | 'filetype':'xls',
18 | 'url':'MKD/04/0406/04060300/mkd04060300',
19 | 'isu_srt_cd':'A' + self.symbol,
20 | 'fromdate': self.start.strftime("%Y%m%d"),
21 | 'todate': self.end.strftime("%Y%m%d"),
22 | 'pagePath':'/contents/MKD/04/0406/04060300/MKD04060300.jsp',
23 | }
24 | header_data = {
25 | 'User-Agent': 'Chrome/78 Safari/537',
26 | }
27 | r = requests.post(url, data=form_data, headers=header_data)
28 | # STEP 02: download
29 | url = 'http://file.krx.co.kr/download.jspx'
30 | form_data = {
31 | 'code': r.text,
32 | }
33 |
34 | header_data = {
35 | 'Referer': 'http://marketdata.krx.co.kr/',
36 | 'User-Agent': 'Chrome/78 Safari/537',
37 | }
38 | r = requests.post(url, form_data, headers=header_data)
39 | dfx = pd.read_excel(BytesIO(r.content), thousands=',')
40 | dfx['일자'] = pd.to_datetime(dfx['일자'])
41 |
42 | col_map = {'일자':'Date', '종가':'Close', '등락구분코드':'UpDown', '대비':'Change',
43 | '거래량':'Volume', '거래대금':'Amount',
44 | '시가':'Open', '고가':'High', '저가':'Low',
45 | '기준가':'StandardPrice', '상장주식수':'Stocks', '액면가':'FaceValue',
46 | '통화구분':'Currency', '거래정지\r여부':'StopOrder', '관리종목\r여부':'Issues' }
47 | dfx.rename(columns=col_map, inplace=True)
48 | dfx.set_index('Date', inplace=True)
49 | dfx.sort_index(inplace=True)
50 | use_cols = ['Open', 'High', 'Low', 'Close', 'Volume', 'Change', 'Amount', 'Stocks',
51 | 'FaceValue', 'StandardPrice', 'StopOrder', 'Issues']
52 | return dfx[use_cols]
53 |
--------------------------------------------------------------------------------
/docs/_build/html/genindex.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
9 |
10 | 색인 — FinanceDataReader 0.4.0 documentation
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
색인
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
68 |
69 |
70 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | FinanceDataReader
2 | =====================
3 | FinanceDataReader, The Ultimate Financial Data Reader
4 |
5 | .. toctree::
6 | :maxdepth: 2
7 |
8 | tickers.rst
9 |
10 |
11 | Features
12 | ---------------------
13 | 금융 데이터를 다루는데 가장 기본이 되는 데이터는 거래소별 전체 종목 코드와 가격 데이터입니다.
14 |
15 | FinanceDataReader는 `pandas-datareader `__ 를 대체하기 보다 보완하기 위한 목적으로 만들어졌으며, 주요한 기능은 다음과 같습니다.
16 |
17 | * 해외주식 가격: AAPL(애플), AMZN(아마존), GOOG(구글) 등
18 | * 국내주식 가격: 005930(삼성전자), 091990(셀트리온헬스케어) 등
19 | * 지수: KS11(코스피), KQ11(코스닥), DJI(다우), IXIC(나스닥), US500(S&P 500)
20 | * 환율: USD/KRX (원달러), USD/EUR(달러/유로화), CNY/KRW: 위엔화/원화
21 | * 암호화폐: BTC/USD (비트코인/달러, Bitfinex), BTC/KRW (비트코인/원화, 빗썸)
22 | * 거래소별 전체 종목 코드: KRX, NASDAQ, NYSE, AMEX, S&P 500 종목
23 |
24 |
25 | Installation
26 | ---------------------
27 | .. code-block:: bash
28 |
29 | pip install -U finance-datareader
30 |
31 |
32 | 설치 (wheel 설치)
33 | --------------------------------
34 | 망분리 혹은 방화벽등의 이슈로 pip로 설치가어려운 경우 아래 디렉토리에서 whl 파일을 다운로드합니다.
35 |
36 | https://github.com/FinanceData/FinanceDataReader/tree/master/dist
37 |
38 | .whl 파일을 다음과 같이 pip로 설치합니다.
39 |
40 | .. code-block:: bash
41 |
42 | pip install finance_datareader-x.x.x-py3-none-any.whl
43 |
44 |
45 | Quick Start
46 | --------------------------------
47 |
48 | 종목과 종목코드 읽기
49 | ...............................
50 | .. code-block:: python
51 |
52 | # 한국거래소 상장종목과 코드명 전체
53 | df_krx = fdr.StockListing('KRX')
54 |
55 | # S&P 500 종목과 코드명 전체
56 | df_spx = fdr.StockListing('S&P500')
57 |
58 |
59 |
60 | 가격 데이터 읽기
61 | .......................
62 |
63 | .. code-block:: python
64 |
65 | import FinanceDataReader as fdr
66 |
67 | # 애플(AAPL), 2017-01-01 ~ 현재
68 | df = fdr.DataReader('AAPL', '2017')
69 |
70 | # 셀트리온(068270), 2017-01-01 ~ 2018-05-30
71 | df = fdr.DataReader('068270', '2017-01-01', '2018-05-30')
72 |
73 | # KS11 (KOSPI 지수), 2015-01-01~현재
74 | df = fdr.DataReader('KS11', '2015')
75 |
76 | # 다우지수, 2015년~현재
77 | df = fdr.DataReader('DJI', '2015-01-01')
78 |
79 | # 원달러 환율, 1995-01-01 ~ 현재
80 | df = fdr.DataReader('USD/KRW', '1995')
81 |
82 | # 비트코인 원화 가격 (빗썸), 2016년~현재
83 | df = fdr.DataReader('BTC/KRW', '2016')
84 |
85 |
86 |
87 |
88 | Release
89 | -------------------
90 | 2018-05-17 v0.2.0
91 | - StockListing, SP500 (S&P 500 Listings, wikipedia), 추가
92 |
93 | 2018-05-16 v0.1.0
94 | - StockListing KRX, KOSPI, KODAQ, KONEX, 추가
95 | - StockListing NASDAQ, NYSE, AMEX, 추가
96 |
97 | 2018-05-14 v0.0.1
98 | - DataReader 국내/매국 주가 데이터, 추가
99 |
100 |
101 | Contribute
102 | ---------------------
103 | 제안, 버그, 개선, 질문 등 이슈는 다음에 등록해 주시면 개선하는데 큰 도움이 됩니다
104 |
105 | - 이슈 트래커: https://github.com/FinanceData/FinanceDataReader/issues
106 |
107 |
108 |
109 | license
110 | ---------------------
111 | MIT license를 따릅니다
112 |
113 |
114 | 찾아보기
115 | ==================
116 | * :ref:`genindex`
117 | * :ref:`search`
118 |
119 |
120 | 2018 FinanceData.KR http://financedata.kr
121 |
122 |
--------------------------------------------------------------------------------
/docs/_build/html/_sources/index.rst.txt:
--------------------------------------------------------------------------------
1 | FinanceDataReader
2 | =====================
3 | FinanceDataReader, The Ultimate Financial Data Reader
4 |
5 | .. toctree::
6 | :maxdepth: 2
7 |
8 | tickers.rst
9 |
10 |
11 | Features
12 | ---------------------
13 | 금융 데이터를 다루는데 가장 기본이 되는 데이터는 거래소별 전체 종목 코드와 가격 데이터입니다.
14 |
15 | FinanceDataReader는 `pandas-datareader `__ 를 대체하기 보다 보완하기 위한 목적으로 만들어졌으며, 주요한 기능은 다음과 같습니다.
16 |
17 | * 해외주식 가격: AAPL(애플), AMZN(아마존), GOOG(구글) 등
18 | * 국내주식 가격: 005930(삼성전자), 091990(셀트리온헬스케어) 등
19 | * 지수: KS11(코스피), KQ11(코스닥), DJI(다우), IXIC(나스닥), US500(S&P 500)
20 | * 환율: USD/KRX (원달러), USD/EUR(달러/유로화), CNY/KRW: 위엔화/원화
21 | * 암호화폐: BTC/USD (비트코인/달러, Bitfinex), BTC/KRW (비트코인/원화, 빗썸)
22 | * 거래소별 전체 종목 코드: KRX, NASDAQ, NYSE, AMEX, S&P 500 종목
23 |
24 |
25 | Installation
26 | ---------------------
27 | .. code-block:: bash
28 |
29 | pip install -U finance-datareader
30 |
31 |
32 | 설치 (wheel 설치)
33 | --------------------------------
34 | 망분리 혹은 방화벽등의 이슈로 pip로 설치가어려운 경우 아래 디렉토리에서 whl 파일을 다운로드합니다.
35 |
36 | https://github.com/FinanceData/FinanceDataReader/tree/master/dist
37 |
38 | .whl 파일을 다음과 같이 pip로 설치합니다.
39 |
40 | .. code-block:: bash
41 |
42 | pip install finance_datareader-x.x.x-py3-none-any.whl
43 |
44 |
45 | Quick Start
46 | --------------------------------
47 |
48 | 종목과 종목코드 읽기
49 | ...............................
50 | .. code-block:: python
51 |
52 | # 한국거래소 상장종목과 코드명 전체
53 | df_krx = fdr.StockListing('KRX')
54 |
55 | # S&P 500 종목과 코드명 전체
56 | df_spx = fdr.StockListing('S&P500')
57 |
58 |
59 |
60 | 가격 데이터 읽기
61 | .......................
62 |
63 | .. code-block:: python
64 |
65 | import FinanceDataReader as fdr
66 |
67 | # 애플(AAPL), 2017-01-01 ~ 현재
68 | df = fdr.DataReader('AAPL', '2017')
69 |
70 | # 셀트리온(068270), 2017-01-01 ~ 2018-05-30
71 | df = fdr.DataReader('068270', '2017-01-01', '2018-05-30')
72 |
73 | # KS11 (KOSPI 지수), 2015-01-01~현재
74 | df = fdr.DataReader('KS11', '2015')
75 |
76 | # 다우지수, 2015년~현재
77 | df = fdr.DataReader('DJI', '2015-01-01')
78 |
79 | # 원달러 환율, 1995-01-01 ~ 현재
80 | df = fdr.DataReader('USD/KRW', '1995')
81 |
82 | # 비트코인 원화 가격 (빗썸), 2016년~현재
83 | df = fdr.DataReader('BTC/KRW', '2016')
84 |
85 |
86 |
87 |
88 | Release
89 | -------------------
90 | 2018-05-17 v0.2.0
91 | - StockListing, SP500 (S&P 500 Listings, wikipedia), 추가
92 |
93 | 2018-05-16 v0.1.0
94 | - StockListing KRX, KOSPI, KODAQ, KONEX, 추가
95 | - StockListing NASDAQ, NYSE, AMEX, 추가
96 |
97 | 2018-05-14 v0.0.1
98 | - DataReader 국내/매국 주가 데이터, 추가
99 |
100 |
101 | Contribute
102 | ---------------------
103 | 제안, 버그, 개선, 질문 등 이슈는 다음에 등록해 주시면 개선하는데 큰 도움이 됩니다
104 |
105 | - 이슈 트래커: https://github.com/FinanceData/FinanceDataReader/issues
106 |
107 |
108 |
109 | license
110 | ---------------------
111 | MIT license를 따릅니다
112 |
113 |
114 | 찾아보기
115 | ==================
116 | * :ref:`genindex`
117 | * :ref:`search`
118 |
119 |
120 | 2018 FinanceData.KR http://financedata.kr
121 |
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # FinanceDataReader
3 | [FinanceData.KR](FinanceData.KR) Open Source Financial data reader
4 |
5 | # Overview
6 | The FinanceDataReader is financial data reader(crawler) for finance.
7 | The main functions are as follows.
8 |
9 | * Stock Symbol listings: 'KRX' ('KOSPI', 'KODAQ', 'KONEX'), 'NASDAQ', 'NYSE', 'AMEX' and 'S&P500'
10 | * KRX delistings: 'KRX-DELISTING'
11 | * ETF Symbol listings: Support for ETF lists for multiple countries ('KR', 'US', 'JP')
12 | * Stock price(KRX): '005930'(Samsung), '091990'(Celltrion Healthcare) ...
13 | * Stock price(Word wide): 'AAPL', 'AMZN', 'GOOG' ... (you can specify exchange(market) and symbol)
14 | * Indexes: 'KOSPI', 'KOSDAQ', 'DJI', 'IXIC', 'US500'(S&P 500) ...
15 | * Exchanges: 'USD/KRX', 'USD/EUR', 'CNY/KRW' ...
16 | * Cryptocurrency price data: 'BTC/USD' (Bitfinex), 'BTC/KRW' (Bithumb)
17 |
18 | # Install
19 |
20 | ```bash
21 | pip install finance-datareader
22 | ```
23 |
24 | # Quick Start
25 |
26 | ```python
27 | import FinanceDataReader as fdr
28 |
29 | # Apple(AAPL), 2017-01-01 ~ Now
30 | df = fdr.DataReader('AAPL', '2017')
31 |
32 | # Ford(F), 1980-01-01 ~ 2019-12-30 (40 years)
33 | df = fdr.DataReader('F', '1980-01-01', '2019-12-30')
34 |
35 | # AMAZON(AMZN), 2017
36 | df = fdr.DataReader('AMZN', '2017-01-01', '2019-12-31')
37 |
38 | # Samsung(005930), 1992-01-01 ~ 2018-10-31
39 | df = fdr.DataReader('068270', '1992-01-01', '2019-10-31')
40 |
41 | # country code: ex) 000150: Doosan(KR), Yihua Healthcare(CN)
42 | df = fdr.DataReader('000150', '2018-01-01', '2019-10-30') # KRX
43 | df = fdr.DataReader('000150', '2018-01-01', '2019-10-30', exchange='KRX') # KRX
44 | df = fdr.DataReader('000150', '2018-01-01', '2019-10-30', exchange='SZSE') # SZSE
45 | df = fdr.DataReader('000150', '2018-01-01', '2019-10-30', exchange='심천') # SZSE
46 |
47 | # KRX delisting stock data 상장폐지 종목 데이터 (상장일~상장폐지일)
48 | df = fdr.DataReader('036360', exchange='krx-delisting')
49 |
50 | # KOSPI index, 2015 ~ Now
51 | ks11 = fdr.DataReader('KS11', '2015-01-01')
52 |
53 | # Dow Jones Industrial(DJI), 2015 ~ Now
54 | dji = fdr.DataReader('DJI', '2015-01-01')
55 |
56 | # USD/KRW, 1995~Now
57 | usdkrw = fdr.DataReader('USD/KRW', '1995-01-01')
58 |
59 | # Bitcoin KRW price (Bithumbs), 2016 ~ Now
60 | btc = fdr.DataReader('BTC/KRW', '2016-01-01')
61 |
62 | # KRX stock symbol list and names
63 | krx = fdr.StockListing('KRX')
64 |
65 | # KRX stock delisting symbol list and names 상장폐지 종목 전체 리스트
66 | krx_delisting = fdr.StockListing('KRX-DELISTING')
67 |
68 | # S&P 500 symbol list
69 | sp500 = fdr.StockListing('S&P500')
70 | ```
71 |
72 | ## Using FinanceDataReader
73 | * [Users-Guide](https://github.com/FinanceData/FinanceDataReader/wiki/Users-Guide)
74 | * [Quick-Reference (Symbol List)](https://github.com/FinanceData/FinanceDataReader/wiki/Quick-Reference)
75 |
76 | ## FinanceDataReader Notebooks
77 | * [S&P500 가격 데이터 수집과 수익률 분석](https://nbviewer.jupyter.org/710b8f0a4bd9a8df91ae1be6c7e838b1)
78 | * [S&P500 팩터 데이터 수집과 분석](https://nbviewer.jupyter.org/35a1b0d5248bc9b09513e53be437ac42)
79 |
80 |
81 | #### 2018-2020 [FinanceData.KR](http://financedata.kr)
82 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/translations.js:
--------------------------------------------------------------------------------
1 | Documentation.addTranslations({"locale": "ko", "messages": {"%(filename)s — %(docstitle)s": "", "© Copyright %(copyright)s.": "", "© Copyright %(copyright)s.": "", ", in ": "", "About these documents": "\uc774 \ubb38\uc11c \uc815\ubcf4", "Automatically generated list of changes in version %(version)s": "\ubc84\uc804 %(version)s\uc758 \ubcc0\uacbd \uc0ac\ud56d (\uc774 \ubaa9\ub85d\uc740 \uc790\ub3d9\uc73c\ub85c \uc0dd\uc131\ud569\ub2c8\ub2e4)", "C API changes": "C API\uc5d0 \ub300\ud55c \ubcc0\uacbd", "Changes in Version %(version)s — %(docstitle)s": "", "Collapse sidebar": "\uc0ac\uc774\ub4dc\ubc14 \ub2eb\uae30", "Complete Table of Contents": "\uc885\ud569 \ubaa9\ucc28", "Contents": "\ub0b4\uc6a9", "Copyright": "\uc800\uc791\uad8c", "Created using Sphinx %(sphinx_version)s.": "", "Expand sidebar": "\uc0ac\uc774\ub4dc\ubc14 \uc5f4\uae30", "From here you can search these documents. Enter your search\n words into the box below and click \"search\". Note that the search\n function will automatically search for all of the words. Pages\n containing fewer words won't appear in the result list.": "", "Full index on one page": "\uc77c\ubc18 \uc0c9\uc778", "General Index": "\uc804\uccb4 \uc0c9\uc778", "Global Module Index": "\ubaa8\ub4c8 \ucd1d \uc0c9\uc778", "Go": "\ubc14\ub85c \uac00\uae30", "Hide Search Matches": "\uac80\uc0c9 \uacb0\uacfc \uc228\uae30\uae30", "Index": "\uc0c9\uc778", "Index – %(key)s": "", "Index pages by letter": "\uc54c\ud30c\ubcb3\ubcc4 \uc0c9\uc778", "Indices and tables:": "\uc0c9\uc778 \ubc0f \ud45c \ubaa9\ub85d:", "Last updated on %(last_updated)s.": "\ucd5c\uc885 \uc5c5\ub370\uc774\ud2b8: %(last_updated)s", "Library changes": "\ub77c\uc774\ube0c\ub7ec\ub9ac\uc5d0 \ub300\ud55c \ubcc0\uacbd", "Navigation": "\ud0d0\uc0c9", "Next topic": "\ub2e4\uc74c \ud56d\ubaa9", "Other changes": "\ub2e4\ub978 \ubcc0\uacbd \uc0ac\ud56d", "Overview": "\uac1c\uc694", "Permalink to this definition": "\uc815\uc758 \uc8fc\uc18c", "Permalink to this headline": "\uc81c\ubaa9 \uc8fc\uc18c", "Please activate JavaScript to enable the search\n functionality.": "", "Preparing search...": "", "Previous topic": "\uc774\uc804 \ud56d\ubaa9", "Quick search": "\ube60\ub978 \uac80\uc0c9", "Search": "\uac80\uc0c9", "Search Page": "\uac80\uc0c9 \ud398\uc774\uc9c0", "Search Results": "\uac80\uc0c9 \uacb0\uacfc", "Search finished, found %s page(s) matching the search query.": "", "Search within %(docstitle)s": "%(docstitle)s\uc5d0\uc11c \ucc3e\uae30", "Searching": "", "Show Source": "\uc18c\uc2a4 \ucf54\ub4dc\ub97c \ubcf4\ub824\uba74", "Table Of Contents": "\ubaa9\ucc28", "This Page": "\ud604\uc7ac \ubb38\uc11c", "Welcome! This is": "", "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "", "all functions, classes, terms": "\ud568\uc218, \ud074\ub798\uc2a4 \ubc0f \uc6a9\uc5b4 \uac1c\uad00", "can be huge": "\ud070 \uacbd\uc6b0\uac00 \uc788\uc73c\ubbc0\ub85c \uc8fc\uc758", "last updated": "", "lists all sections and subsections": "\uc601\uc5ed\ubcc4 \ubaa9\ucc28", "next chapter": "\ub2e4\uc74c \uc7a5", "previous chapter": "\uc774\uc804 \uc7a5", "quick access to all modules": "\ubaa8\ub4e0 \ubaa8\ub4c8 \uc870\uacac\ud45c", "search": "\uac80\uc0c9", "search this documentation": "\ubb38\uc11c \uac80\uc0c9", "the documentation for": ""}, "plural_expr": "0"});
--------------------------------------------------------------------------------
/docs/_build/html/search.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 | 검색 — FinanceDataReader 0.4.0 documentation
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
검색
43 |
44 |
45 |
46 | Please activate JavaScript to enable the search
47 | functionality.
48 |
49 |
50 |
51 | From here you can search these documents. Enter your search
52 | words into the box below and click "search". Note that the search
53 | function will automatically search for all of the words. Pages
54 | containing fewer words won't appear in the result list.
55 |
56 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
79 |
80 |
81 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/investing/data.py:
--------------------------------------------------------------------------------
1 | from io import StringIO
2 | import json
3 | import requests
4 | import pandas as pd
5 | from pandas.io.json import json_normalize
6 | from FinanceDataReader._utils import (_convert_letter_to_num, _validate_dates)
7 |
8 | class InvestingDailyReader:
9 | def __init__(self, symbol, start=None, end=None, exchange=None, kind=None):
10 | self.symbol = symbol
11 | start, end = _validate_dates(start, end)
12 | self.start = start
13 | self.end = end
14 | self.exchange = exchange
15 | self.kind = kind
16 |
17 | def _get_currid_investing(self, symbol, exchange=None, kind=None):
18 | symbol = symbol.upper() if symbol else symbol
19 | exchange = exchange.upper() if exchange else exchange
20 |
21 | url = 'https://www.investing.com/search/service/searchTopBar'
22 | headers = {
23 | 'User-Agent':'Mozilla',
24 | 'X-Requested-With':'XMLHttpRequest',
25 | }
26 |
27 | # Exchage alias
28 | exchange_map = {
29 | 'KRX':'Seoul', '한국거래소':'Seoul',
30 | 'NASDAQ':'NASDAQ', '나스닥':'NASDAQ',
31 | 'NYSE':'NYSE', '뉴욕증권거래소':'NYSE',
32 | 'AMEX':'AMEX',
33 | 'SSE':'Shanghai', '상하이':'Shanghai', '상해':'Shanghai',
34 | 'SZSE':'Shenzhen', '심천':'Shenzhen',
35 | 'HKEX':'Hong Kong', '홍콩':'Hong Kong'
36 | }
37 | exchange = exchange_map[exchange] if exchange and exchange in exchange_map.keys() else exchange
38 |
39 | data = {'search_text': symbol}
40 | r = requests.post(url, data=data, headers=headers)
41 | jo = json.loads(r.text)
42 | if len(jo['quotes']) == 0:
43 | raise ValueError("Symbol('%s') not found" % symbol)
44 | df = json_normalize(jo['quotes'])
45 | df = df[df['exchange'].str.contains(exchange, case=False)] if exchange else df
46 | df = df[df['type'].str.contains(kind + ' - ', case=False)] if kind else df
47 |
48 | if len(df) == 0:
49 | raise ValueError("Symbol('%s'), Exchange('%s'), kind('%s') not found" % (symbol, exchange, kind))
50 | return df.iloc[0]['pairId']
51 |
52 | def read(self):
53 | start_date_str = self.start.strftime('%m/%d/%Y')
54 | end_date_str = self.end.strftime('%m/%d/%Y')
55 | curr_id = self._get_currid_investing(self.symbol, self.exchange, self.kind)
56 | if not curr_id:
57 | raise ValueError("Symbol unsupported or not found")
58 |
59 | url = 'https://www.investing.com/instruments/HistoricalDataAjax'
60 | data = {
61 | 'curr_id':curr_id,
62 | 'st_date': start_date_str,
63 | 'end_date': end_date_str,
64 | 'interval_sec':'Daily',
65 | 'sort_col':'date',
66 | 'sort_ord':'ASC',
67 | 'action':'historical_data',
68 | }
69 |
70 | headers = {
71 | 'User-Agent':'Mozilla',
72 | 'X-Requested-With':'XMLHttpRequest',
73 | }
74 |
75 | r = requests.post(url, data, headers=headers)
76 | dfs = pd.read_html(StringIO(r.text))
77 | df = dfs[0]
78 | if (len(df)==0) or ("No results found" == df.iloc[0]['Date']):
79 | return pd.DataFrame()
80 | df['Date'] = pd.to_datetime(df['Date'])
81 | df = df.set_index('Date')
82 | cols_dict = {'Price':'Close', 'Vol.':'Volume', 'Change %':'Change'}
83 | df = df.rename(columns=cols_dict)
84 | df['Change'] = df['Change'].str.replace(',', '')
85 | df['Change'] = df['Change'].str.rstrip('%').astype('float') / 100.0
86 | if 'Volume' in df.columns:
87 | df['Volume'] = df['Volume'].apply(_convert_letter_to_num)
88 | df = df.sort_index()
89 | return df
90 |
--------------------------------------------------------------------------------
/docs/_build/html/ticker.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 | 티커 코드 — FinanceDataReader 0.4.0 documentation
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
티커 코드
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | A
44 | B
45 | A and B
46 |
47 |
48 |
49 | False
50 | False
51 | False
52 |
53 | True
54 | False
55 | False
56 |
57 | False
58 | True
59 | False
60 |
61 | True
62 | True
63 | True
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
102 |
103 |
104 |
115 |
116 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/docs/_build/html/source/ticker.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 | 티커 코드 — FinanceDataReader 0.4.0 documentation
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
티커 코드
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | A
44 | B
45 | A and B
46 |
47 |
48 |
49 | False
50 | False
51 | False
52 |
53 | True
54 | False
55 | False
56 |
57 | False
58 | True
59 | False
60 |
61 | True
62 | True
63 | True
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
102 |
103 |
104 |
115 |
116 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/pygments.css:
--------------------------------------------------------------------------------
1 | .highlight .hll { background-color: #ffffcc }
2 | .highlight { background: #eeffcc; }
3 | .highlight .c { color: #408090; font-style: italic } /* Comment */
4 | .highlight .err { border: 1px solid #FF0000 } /* Error */
5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */
6 | .highlight .o { color: #666666 } /* Operator */
7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
9 | .highlight .cp { color: #007020 } /* Comment.Preproc */
10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */
14 | .highlight .ge { font-style: italic } /* Generic.Emph */
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */
18 | .highlight .go { color: #333333 } /* Generic.Output */
19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */
23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */
27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
28 | .highlight .kt { color: #902000 } /* Keyword.Type */
29 | .highlight .m { color: #208050 } /* Literal.Number */
30 | .highlight .s { color: #4070a0 } /* Literal.String */
31 | .highlight .na { color: #4070a0 } /* Name.Attribute */
32 | .highlight .nb { color: #007020 } /* Name.Builtin */
33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
34 | .highlight .no { color: #60add5 } /* Name.Constant */
35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
37 | .highlight .ne { color: #007020 } /* Name.Exception */
38 | .highlight .nf { color: #06287e } /* Name.Function */
39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */
43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */
45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */
46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */
47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */
48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */
49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */
50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */
51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */
53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */
56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */
60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */
61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */
62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */
63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */
65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
69 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
--------------------------------------------------------------------------------
/docs/_build/html/searchindex.js:
--------------------------------------------------------------------------------
1 | Search.setIndex({docnames:["index","tickers"],envversion:53,filenames:["index.rst","tickers.rst"],objects:{},objnames:{},objtypes:{},terms:{"2015\ub144":0,"2016\ub144":0,"2017\ub144":[],"6\uc790\ub9ac":1,"\uac00\uaca9":[],"\uac00\uc7a5":0,"\uac00\uc838\uc635\ub2c8\ub2e4":1,"\uac01\uc885":[],"\uac10\uc0ac\ud569\ub2c8\ub2e4":[],"\uac19\uc2b5\ub2c8\ub2e4":[0,1],"\uac19\uc774":0,"\uac1c\uc120":0,"\uac1c\uc120\ud558\ub294\ub370":0,"\uac70\ub798\uc18c":1,"\uac70\ub798\uc18c\ubcc4":0,"\uac80\uc0c9":0,"\uacbd\uc6b0":0,"\uad6c\uae00":[0,1],"\uad6d\ub0b4":0,"\uad6d\ub0b4\uc8fc\uc2dd":0,"\uae08\uc735":0,"\uae30\ub2a5\uc740":0,"\uae30\ubcf8\uc774":0,"\ub098\uc2a4\ub2e5":[0,1],"\ub0b4\uc6a9\uc774\ub098":[],"\ub274\uc695":1,"\ub2e4\ub8e8\ub294\ub370":0,"\ub2e4\uc6b0":0,"\ub2e4\uc6b0\uc9c0\uc218":0,"\ub2e4\uc6b4\ub85c\ub4dc\ud569\ub2c8\ub2e4":0,"\ub2e4\uc74c":[],"\ub2e4\uc74c\uacfc":[0,1],"\ub2e4\uc74c\uc5d0":0,"\ub2e8\ucd95":1,"\ub2ec\ub7ec":0,"\ub2ec\ub7ec\ub2f9":[],"\ub300\uccb4\ud558\uae30":0,"\ub370\uc774\ud130":[],"\ub370\uc774\ud130\ub294":0,"\ub370\uc774\ud130\ub97c":0,"\ub370\uc774\ud130\uc785\ub2c8\ub2e4":0,"\ub3c4\uc6c0\uc774":0,"\ub418\ub294":0,"\ub429\ub2c8\ub2e4":0,"\ub4e4\uc5b4":1,"\ub4f1":0,"\ub4f1\ub85d\ud574":0,"\ub514\ub809\ud1a0\ub9ac\uc5d0\uc11c":0,"\ub530\ub985\ub2c8\ub2e4":0,"\ub97c":[0,1],"\ub9cc\ub4e4\uc5b4\uc84c\uc73c\uba70":0,"\ub9dd\ubd84\ub9ac":0,"\ub9e4\uad6d":0,"\ubaa8\ub450":1,"\ubaa8\ub4c8":[],"\ubaa9\ub85d":0,"\ubaa9\ub85d\uc744":1,"\ubaa9\uc801\uc73c\ub85c":0,"\ubb38\uc11c":[],"\ubbf8\uad6d":0,"\ubc29\ud654\ubcbd\ub4f1\uc758":0,"\ubc84\uadf8":0,"\ubcc4\ub85c":1,"\ubcf4\ub2e4":0,"\ubcf4\uc644\ud558\uae30":0,"\ube44\uace0":1,"\ube44\ud2b8\ucf54\uc778":0,"\ube57\uc378":0,"\uc0ac\uc6a9\uc790":1,"\uc0ac\uc6a9\ud560":1,"\uc0ac\uc6a9\ud569\ub2c8\ub2e4":1,"\uc0bc\uc131\uc804\uc790":[0,1],"\uc0c1\uc7a5\uc885\ubaa9":0,"\uc0c1\uc7a5\uc885\ubaa9\uacfc":0,"\uc0c9\uc778":0,"\uc124\uce58\uac00\uc5b4\ub824\uc6b4":0,"\uc124\uce58\ud569\ub2c8\ub2e4":0,"\uc140\ud2b8\ub9ac\uc628":0,"\uc140\ud2b8\ub9ac\uc628\ud5ec\uc2a4\ucf00\uc5b4":0,"\uc218":1,"\uc2e0\ub77c\uc820":1,"\uc2ec\ubcfc":1,"\uc2ec\ubcfc\uc740":1,"\uc544\ub798":0,"\uc544\ub9c8\uc874":[0,1],"\uc548\ub0b4\uc11c":1,"\uc554\ud638\ud654\ud3d0":0,"\uc560\ud50c":[0,1],"\uc5b4\ub5a4":[],"\uc5bb\uc744":1,"\uc5ec\uae30\uc5d0":1,"\uc608\ub97c":1,"\uc6d0\ub2ec\ub7ec":0,"\uc6d0\ud654":0,"\uc704\uc5d4\ud654":0,"\uc704\ud55c":0,"\uc720\ub85c\ud654":0,"\uc774\ub2e4":[],"\uc774\uc288":0,"\uc774\uc288\ub294":0,"\uc774\uc288\ub85c":0,"\uc774\uc288\uc5d0":[],"\uc788\ub294":1,"\uc788\uc2b5\ub2c8\ub2e4":1,"\uc804\uccb4":[0,1],"\uc804\uccb4\ub294":1,"\uc81c\uc548":0,"\uc885\ubaa9":[0,1],"\uc885\ubaa9\uacfc":[],"\uc8fc\uac00":0,"\uc8fc\uc2dc\uba74":0,"\uc8fc\uc2dd":0,"\uc8fc\uc694\ud55c":0,"\uc99d\uad8c\uac70\ub798\uc18c":1,"\uc9c0\uc218":0,"\uc9c8\ubb38":0,"\ucc38\uace0":0,"\ucd94\uac00":0,"\ucf54\ub4dc":[0,1],"\ucf54\ub4dc\ub294":1,"\ucf54\ub4dc\ub97c":[],"\ucf54\ub4dc\uba85":0,"\ucf54\ub4dc\uc640":0,"\ucf54\uc2a4\ub2e5":0,"\ucf54\uc2a4\ub2e5\uc9c0\uc218":[],"\ucf54\uc2a4\ud53c":0,"\ucf54\uc2a4\ud53c\uc9c0\uc218":[],"\ud070":0,"\ud1b5\ud574":1,"\ud2b8\ub798\ucee4":0,"\ud2f0\ucee4":1,"\ud2f0\ucee4\ub97c":1,"\ud30c\uc77c\uc744":0,"\ud398\uc774\uc9c0":0,"\ud3ec\ud568":[],"\ud55c\uad6d\uac70\ub798\uc18c":0,"\ud574\uc678\uc8fc\uc2dd":0,"\ud604\uc7ac":0,"\ud639\uc740":0,"\ud658\uc728":0,"financedatareader\ub294":0,"import":0,"knx\ubaa8\ub450":[],"license\ub97c":0,"pip\ub85c":0,"true":[],The:0,aapl:[0,1],altern:[],amex:[0,1],amzn:[0,1],ani:0,bitfinex:0,btc:0,cny:0,com:0,content:[],data:[0,1],dataread:0,df_krx:0,df_spx:0,dist:0,dji:0,eur:0,fals:[],fdr:[0,1],financ:[0,1],finance_dataread:0,financedata:[0,1],financedataread:1,financi:0,github:[0,1],goog:[0,1],googl:[],guid:1,html:1,http:[0,1],instal:[],issu:0,ixic:0,knex:[],kodaq:0,konex:[0,1],kosdaq:1,kospi:[0,1],kq11:0,krw:0,krx:[0,1],ks11:0,list:0,master:0,mit:0,nasdaq:[0,1],none:0,nyse:[0,1],p500:0,panda:0,pip:0,post:1,py3:0,reader:[0,1],readthedoc:[],rst:[],sp500:[0,1],stocklist:[0,1],symbol:[],ticker:[],tree:0,ultim:0,us500:0,usd:0,user:1,whl:0,wikipedia:0,yahoo:[]},titles:["FinanceDataReader","\uc0c1\uc7a5\uc885\ubaa9 \ubaa9\ub85d (\uac70\ub798\uc18c\ubcc4)"],titleterms:{"\uac00\uaca9":[0,1],"\uac00\uc838\uc624\uae30":[],"\uac70\ub798\uc18c\ubcc4":1,"\uad6d\ub0b4":1,"\uae30\ub2a5":[],"\ub370\uc774\ud130":[0,1],"\ub77c\uc774\uc13c\uc2a4":[],"\ub9b4\ub9ac\uc988":[],"\ubaa9\ub85d":1,"\ubbf8\uad6d":1,"\uc0ac\uc6a9\ubc95":[],"\uc0c1\uc7a5\uc885\ubaa9":1,"\uc124\uce58":0,"\uc608\uc81c":[],"\uc77d\uae30":0,"\uc885\ubaa9\uacfc":0,"\uc885\ubaa9\ucf54\ub4dc":0,"\uc8fc\uc2dd":1,"\ucc38\uace0":1,"\ucc38\uc5ec":[],"\ucc3e\uc544\ubcf4\uae30":0,"\ucf54\ub4dc":[],"\ud2f0\ucee4":[],contribut:0,document:[],featur:0,financedataread:0,indic:[],instal:0,licens:0,project:[],quick:0,releas:0,start:0,tabl:[],welcom:[],wheel:0}})
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | #
3 | # Configuration file for the Sphinx documentation builder.
4 | #
5 | # This file does only contain a selection of the most common options. For a
6 | # full list see the documentation:
7 | # http://www.sphinx-doc.org/en/master/config
8 |
9 | # -- Path setup --------------------------------------------------------------
10 |
11 | # If extensions (or modules to document with autodoc) are in another directory,
12 | # add these directories to sys.path here. If the directory is relative to the
13 | # documentation root, use os.path.abspath to make it absolute, like shown here.
14 | #
15 | # import os
16 | # import sys
17 | # sys.path.insert(0, os.path.abspath('.'))
18 |
19 |
20 | # -- Project information -----------------------------------------------------
21 |
22 | project = 'FinanceDataReader'
23 | copyright = '2018, plusjune'
24 | author = 'plusjune'
25 |
26 | # The short X.Y version
27 | version = ''
28 | # The full version, including alpha/beta/rc tags
29 | release = '0.4.0'
30 |
31 |
32 | # -- General configuration ---------------------------------------------------
33 |
34 | # If your documentation needs a minimal Sphinx version, state it here.
35 | #
36 | # needs_sphinx = '1.0'
37 |
38 | # Add any Sphinx extension module names here, as strings. They can be
39 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
40 | # ones.
41 | extensions = [
42 | 'sphinx.ext.mathjax',
43 | 'sphinx.ext.viewcode',
44 | ]
45 |
46 | # Add any paths that contain templates here, relative to this directory.
47 | templates_path = ['_templates']
48 |
49 | # The suffix(es) of source filenames.
50 | # You can specify multiple suffix as a list of string:
51 | #
52 | # source_suffix = ['.rst', '.md']
53 | source_suffix = '.rst'
54 |
55 | # The master toctree document.
56 | master_doc = 'index'
57 |
58 | # The language for content autogenerated by Sphinx. Refer to documentation
59 | # for a list of supported languages.
60 | #
61 | # This is also used if you do content translation via gettext catalogs.
62 | # Usually you set "language" from the command line for these cases.
63 | language = 'ko'
64 |
65 | # List of patterns, relative to source directory, that match files and
66 | # directories to ignore when looking for source files.
67 | # This pattern also affects html_static_path and html_extra_path .
68 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
69 |
70 | # The name of the Pygments (syntax highlighting) style to use.
71 | pygments_style = 'sphinx'
72 |
73 |
74 | # -- Options for HTML output -------------------------------------------------
75 |
76 | # The theme to use for HTML and HTML Help pages. See the documentation for
77 | # a list of builtin themes.
78 | #
79 | html_theme = 'alabaster'
80 |
81 | # Theme options are theme-specific and customize the look and feel of a theme
82 | # further. For a list of options available for each theme, see the
83 | # documentation.
84 | #
85 | # html_theme_options = {}
86 |
87 | # Add any paths that contain custom static files (such as style sheets) here,
88 | # relative to this directory. They are copied after the builtin static files,
89 | # so a file named "default.css" will overwrite the builtin "default.css".
90 | html_static_path = ['_static']
91 |
92 | # Custom sidebar templates, must be a dictionary that maps document names
93 | # to template names.
94 | #
95 | # The default sidebars (for documents that don't match any pattern) are
96 | # defined by theme itself. Builtin themes are using these templates by
97 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
98 | # 'searchbox.html']``.
99 | #
100 | # html_sidebars = {}
101 |
102 |
103 | # -- Options for HTMLHelp output ---------------------------------------------
104 |
105 | # Output file base name for HTML help builder.
106 | htmlhelp_basename = 'FinanceDataReaderdoc'
107 |
108 |
109 | # -- Options for LaTeX output ------------------------------------------------
110 |
111 | latex_elements = {
112 | # The paper size ('letterpaper' or 'a4paper').
113 | #
114 | # 'papersize': 'letterpaper',
115 |
116 | # The font size ('10pt', '11pt' or '12pt').
117 | #
118 | # 'pointsize': '10pt',
119 |
120 | # Additional stuff for the LaTeX preamble.
121 | #
122 | # 'preamble': '',
123 |
124 | # Latex figure (float) alignment
125 | #
126 | # 'figure_align': 'htbp',
127 | }
128 |
129 | # Grouping the document tree into LaTeX files. List of tuples
130 | # (source start file, target name, title,
131 | # author, documentclass [howto, manual, or own class]).
132 | latex_documents = [
133 | (master_doc, 'FinanceDataReader.tex', 'FinanceDataReader Documentation',
134 | 'plusjune', 'manual'),
135 | ]
136 |
137 |
138 | # -- Options for manual page output ------------------------------------------
139 |
140 | # One entry per manual page. List of tuples
141 | # (source start file, name, description, authors, manual section).
142 | man_pages = [
143 | (master_doc, 'financedatareader', 'FinanceDataReader Documentation',
144 | [author], 1)
145 | ]
146 |
147 |
148 | # -- Options for Texinfo output ----------------------------------------------
149 |
150 | # Grouping the document tree into Texinfo files. List of tuples
151 | # (source start file, target name, title, author,
152 | # dir menu entry, description, category)
153 | texinfo_documents = [
154 | (master_doc, 'FinanceDataReader', 'FinanceDataReader Documentation',
155 | author, 'FinanceDataReader', 'One line description of project.',
156 | 'Miscellaneous'),
157 | ]
158 |
159 |
160 | # -- Extension configuration -------------------------------------------------
161 |
--------------------------------------------------------------------------------
/docs/_build/html/tickers.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 | 상장종목 목록 (거래소별) — FinanceDataReader 0.4.0 documentation
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
상장종목 목록 (거래소별)
37 |
거래소 별로 상장종목 목록을 가져옵니다
38 |
df = fdr . StockListing ( 'KRX' )
39 | df
40 |
41 |
42 |
여기에 사용할 수 있는 거래소 심볼은 다음과 같습니다
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 심볼
51 | 거래소
52 | 비고
53 |
54 |
55 |
56 | KRX
57 | KRX 종목 전체
58 | KOSPI,KOSDAQ,KONEX 모두
59 |
60 | KOSPI
61 | KOSPI 종목
62 |
63 |
64 | KOSDAQ
65 | KOSDAQ 종목
66 |
67 |
68 | KONEX
69 | KONEX 종목
70 |
71 |
72 | KONEX
73 | KONEX 종목
74 |
75 |
76 | NASDAQ
77 | 나스닥 종목
78 |
79 |
80 | NYSE
81 | 뉴욕 증권거래소 종목
82 |
83 |
84 | AMEX
85 | AMEX 종목
86 |
87 |
88 | SP500
89 | S&P 500 종목
90 |
91 |
92 |
93 |
94 |
95 |
96 |
가격 데이터
97 |
98 |
국내 주식
99 |
100 | 단축 코드(6자리)를 사용합니다. 예를 들어, '005930'(삼성전자), '215600'(신라젠)
101 | 전체 코드는 fdr.StockListing('KRX') 를 통해 얻을 수 있습니다
102 |
103 |
104 |
105 |
미국 주식
106 |
107 | 티커를 사용합니다. 예를 들어, 'AAPL'(애플), 'AMZN'(아마존), 'GOOG'(구글)
108 | NASDAQ 티커 전체는 fdr.StockListing('NASDAQ') 를 통해 얻을 수 있습니다
109 |
110 |
111 |
112 |
117 |
118 |
119 |
120 |
121 |
122 |
163 |
164 |
165 |
176 |
177 |
178 |
179 |
180 |
181 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/doctools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * doctools.js
3 | * ~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for all documentation.
6 | *
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /**
13 | * select a different prefix for underscore
14 | */
15 | $u = _.noConflict();
16 |
17 | /**
18 | * make the code below compatible with browsers without
19 | * an installed firebug like debugger
20 | if (!window.console || !console.firebug) {
21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
23 | "profile", "profileEnd"];
24 | window.console = {};
25 | for (var i = 0; i < names.length; ++i)
26 | window.console[names[i]] = function() {};
27 | }
28 | */
29 |
30 | /**
31 | * small helper function to urldecode strings
32 | */
33 | jQuery.urldecode = function(x) {
34 | return decodeURIComponent(x).replace(/\+/g, ' ');
35 | };
36 |
37 | /**
38 | * small helper function to urlencode strings
39 | */
40 | jQuery.urlencode = encodeURIComponent;
41 |
42 | /**
43 | * This function returns the parsed url parameters of the
44 | * current request. Multiple values per key are supported,
45 | * it will always return arrays of strings for the value parts.
46 | */
47 | jQuery.getQueryParameters = function(s) {
48 | if (typeof s === 'undefined')
49 | s = document.location.search;
50 | var parts = s.substr(s.indexOf('?') + 1).split('&');
51 | var result = {};
52 | for (var i = 0; i < parts.length; i++) {
53 | var tmp = parts[i].split('=', 2);
54 | var key = jQuery.urldecode(tmp[0]);
55 | var value = jQuery.urldecode(tmp[1]);
56 | if (key in result)
57 | result[key].push(value);
58 | else
59 | result[key] = [value];
60 | }
61 | return result;
62 | };
63 |
64 | /**
65 | * highlight a given string on a jquery object by wrapping it in
66 | * span elements with the given class name.
67 | */
68 | jQuery.fn.highlightText = function(text, className) {
69 | function highlight(node, addItems) {
70 | if (node.nodeType === 3) {
71 | var val = node.nodeValue;
72 | var pos = val.toLowerCase().indexOf(text);
73 | if (pos >= 0 &&
74 | !jQuery(node.parentNode).hasClass(className) &&
75 | !jQuery(node.parentNode).hasClass("nohighlight")) {
76 | var span;
77 | var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
78 | if (isInSVG) {
79 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
80 | } else {
81 | span = document.createElement("span");
82 | span.className = className;
83 | }
84 | span.appendChild(document.createTextNode(val.substr(pos, text.length)));
85 | node.parentNode.insertBefore(span, node.parentNode.insertBefore(
86 | document.createTextNode(val.substr(pos + text.length)),
87 | node.nextSibling));
88 | node.nodeValue = val.substr(0, pos);
89 | if (isInSVG) {
90 | var bbox = span.getBBox();
91 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
92 | rect.x.baseVal.value = bbox.x;
93 | rect.y.baseVal.value = bbox.y;
94 | rect.width.baseVal.value = bbox.width;
95 | rect.height.baseVal.value = bbox.height;
96 | rect.setAttribute('class', className);
97 | var parentOfText = node.parentNode.parentNode;
98 | addItems.push({
99 | "parent": node.parentNode,
100 | "target": rect});
101 | }
102 | }
103 | }
104 | else if (!jQuery(node).is("button, select, textarea")) {
105 | jQuery.each(node.childNodes, function() {
106 | highlight(this, addItems);
107 | });
108 | }
109 | }
110 | var addItems = [];
111 | var result = this.each(function() {
112 | highlight(this, addItems);
113 | });
114 | for (var i = 0; i < addItems.length; ++i) {
115 | jQuery(addItems[i].parent).before(addItems[i].target);
116 | }
117 | return result;
118 | };
119 |
120 | /*
121 | * backward compatibility for jQuery.browser
122 | * This will be supported until firefox bug is fixed.
123 | */
124 | if (!jQuery.browser) {
125 | jQuery.uaMatch = function(ua) {
126 | ua = ua.toLowerCase();
127 |
128 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
129 | /(webkit)[ \/]([\w.]+)/.exec(ua) ||
130 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
131 | /(msie) ([\w.]+)/.exec(ua) ||
132 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
133 | [];
134 |
135 | return {
136 | browser: match[ 1 ] || "",
137 | version: match[ 2 ] || "0"
138 | };
139 | };
140 | jQuery.browser = {};
141 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
142 | }
143 |
144 | /**
145 | * Small JavaScript module for the documentation.
146 | */
147 | var Documentation = {
148 |
149 | init : function() {
150 | this.fixFirefoxAnchorBug();
151 | this.highlightSearchWords();
152 | this.initIndexTable();
153 |
154 | },
155 |
156 | /**
157 | * i18n support
158 | */
159 | TRANSLATIONS : {},
160 | PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
161 | LOCALE : 'unknown',
162 |
163 | // gettext and ngettext don't access this so that the functions
164 | // can safely bound to a different name (_ = Documentation.gettext)
165 | gettext : function(string) {
166 | var translated = Documentation.TRANSLATIONS[string];
167 | if (typeof translated === 'undefined')
168 | return string;
169 | return (typeof translated === 'string') ? translated : translated[0];
170 | },
171 |
172 | ngettext : function(singular, plural, n) {
173 | var translated = Documentation.TRANSLATIONS[singular];
174 | if (typeof translated === 'undefined')
175 | return (n == 1) ? singular : plural;
176 | return translated[Documentation.PLURALEXPR(n)];
177 | },
178 |
179 | addTranslations : function(catalog) {
180 | for (var key in catalog.messages)
181 | this.TRANSLATIONS[key] = catalog.messages[key];
182 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
183 | this.LOCALE = catalog.locale;
184 | },
185 |
186 | /**
187 | * add context elements like header anchor links
188 | */
189 | addContextElements : function() {
190 | $('div[id] > :header:first').each(function() {
191 | $('').
192 | attr('href', '#' + this.id).
193 | attr('title', _('Permalink to this headline')).
194 | appendTo(this);
195 | });
196 | $('dt[id]').each(function() {
197 | $('').
198 | attr('href', '#' + this.id).
199 | attr('title', _('Permalink to this definition')).
200 | appendTo(this);
201 | });
202 | },
203 |
204 | /**
205 | * workaround a firefox stupidity
206 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
207 | */
208 | fixFirefoxAnchorBug : function() {
209 | if (document.location.hash && $.browser.mozilla)
210 | window.setTimeout(function() {
211 | document.location.href += '';
212 | }, 10);
213 | },
214 |
215 | /**
216 | * highlight the search words provided in the url in the text
217 | */
218 | highlightSearchWords : function() {
219 | var params = $.getQueryParameters();
220 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
221 | if (terms.length) {
222 | var body = $('div.body');
223 | if (!body.length) {
224 | body = $('body');
225 | }
226 | window.setTimeout(function() {
227 | $.each(terms, function() {
228 | body.highlightText(this.toLowerCase(), 'highlighted');
229 | });
230 | }, 10);
231 | $('' + _('Hide Search Matches') + '
')
233 | .appendTo($('#searchbox'));
234 | }
235 | },
236 |
237 | /**
238 | * init the domain index toggle buttons
239 | */
240 | initIndexTable : function() {
241 | var togglers = $('img.toggler').click(function() {
242 | var src = $(this).attr('src');
243 | var idnum = $(this).attr('id').substr(7);
244 | $('tr.cg-' + idnum).toggle();
245 | if (src.substr(-9) === 'minus.png')
246 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
247 | else
248 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
249 | }).css('display', '');
250 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
251 | togglers.click();
252 | }
253 | },
254 |
255 | /**
256 | * helper function to hide the search marks again
257 | */
258 | hideSearchWords : function() {
259 | $('#searchbox .highlight-link').fadeOut(300);
260 | $('span.highlighted').removeClass('highlighted');
261 | },
262 |
263 | /**
264 | * make the url absolute
265 | */
266 | makeURL : function(relativeURL) {
267 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
268 | },
269 |
270 | /**
271 | * get the current relative url
272 | */
273 | getCurrentURL : function() {
274 | var path = document.location.pathname;
275 | var parts = path.split(/\//);
276 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
277 | if (this === '..')
278 | parts.pop();
279 | });
280 | var url = parts.join('/');
281 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
282 | },
283 |
284 | initOnKeyListeners: function() {
285 | $(document).keyup(function(event) {
286 | var activeElementType = document.activeElement.tagName;
287 | // don't navigate when in search box or textarea
288 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') {
289 | switch (event.keyCode) {
290 | case 37: // left
291 | var prevHref = $('link[rel="prev"]').prop('href');
292 | if (prevHref) {
293 | window.location.href = prevHref;
294 | return false;
295 | }
296 | case 39: // right
297 | var nextHref = $('link[rel="next"]').prop('href');
298 | if (nextHref) {
299 | window.location.href = nextHref;
300 | return false;
301 | }
302 | }
303 | }
304 | });
305 | }
306 | };
307 |
308 | // quick alias for translations
309 | _ = Documentation.gettext;
310 |
311 | $(document).ready(function() {
312 | Documentation.init();
313 | });
--------------------------------------------------------------------------------
/docs/_build/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 | FinanceDataReader — FinanceDataReader 0.4.0 documentation
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
FinanceDataReader
37 |
FinanceDataReader, The Ultimate Financial Data Reader
38 |
49 |
50 |
Features
51 |
금융 데이터를 다루는데 가장 기본이 되는 데이터는 거래소별 전체 종목 코드와 가격 데이터입니다.
52 |
FinanceDataReader는 pandas-datareader 를 대체하기 보다 보완하기 위한 목적으로 만들어졌으며, 주요한 기능은 다음과 같습니다.
53 |
54 | 해외주식 가격: AAPL(애플), AMZN(아마존), GOOG(구글) 등
55 | 국내주식 가격: 005930(삼성전자), 091990(셀트리온헬스케어) 등
56 | 지수: KS11(코스피), KQ11(코스닥), DJI(다우), IXIC(나스닥), US500(S&P 500)
57 | 환율: USD/KRX (원달러), USD/EUR(달러/유로화), CNY/KRW: 위엔화/원화
58 | 암호화폐: BTC/USD (비트코인/달러, Bitfinex), BTC/KRW (비트코인/원화, 빗썸)
59 | 거래소별 전체 종목 코드: KRX, NASDAQ, NYSE, AMEX, S&P 500 종목
60 |
61 |
62 |
63 |
Installation
64 |
pip install -U finance-datareader
65 |
66 |
67 |
68 |
69 |
설치 (wheel 설치)
70 |
망분리 혹은 방화벽등의 이슈로 pip로 설치가어려운 경우 아래 디렉토리에서 whl 파일을 다운로드합니다.
71 |
72 |
73 |
.whl 파일을 다음과 같이 pip로 설치합니다.
74 |
pip install finance_datareader-x.x.x-py3-none-any.whl
75 |
76 |
77 |
78 |
79 |
Quick Start
80 |
81 |
종목과 종목코드 읽기
82 |
# 한국거래소 상장종목과 코드명 전체
83 | df_krx = fdr . StockListing ( 'KRX' )
84 |
85 | # S&P 500 종목과 코드명 전체
86 | df_spx = fdr . StockListing ( 'S&P500' )
87 |
88 |
89 |
90 |
91 |
가격 데이터 읽기
92 |
import FinanceDataReader as fdr
93 |
94 | # 애플(AAPL), 2017-01-01 ~ 현재
95 | df = fdr . DataReader ( 'AAPL' , '2017' )
96 |
97 | # 셀트리온(068270), 2017-01-01 ~ 2018-05-30
98 | df = fdr . DataReader ( '068270' , '2017-01-01' , '2018-05-30' )
99 |
100 | # KS11 (KOSPI 지수), 2015-01-01~현재
101 | df = fdr . DataReader ( 'KS11' , '2015' )
102 |
103 | # 다우지수, 2015년~현재
104 | df = fdr . DataReader ( 'DJI' , '2015-01-01' )
105 |
106 | # 원달러 환율, 1995-01-01 ~ 현재
107 | df = fdr . DataReader ( 'USD/KRW' , '1995' )
108 |
109 | # 비트코인 원화 가격 (빗썸), 2016년~현재
110 | df = fdr . DataReader ( 'BTC/KRW' , '2016' )
111 |
112 |
113 |
114 |
115 |
116 |
Release
117 |
2018-05-17 v0.2.0
118 | - StockListing, SP500 (S&P 500 Listings, wikipedia), 추가
119 |
2018-05-16 v0.1.0
120 | - StockListing KRX, KOSPI, KODAQ, KONEX, 추가
121 | - StockListing NASDAQ, NYSE, AMEX, 추가
122 |
2018-05-14 v0.0.1
123 | - DataReader 국내/매국 주가 데이터, 추가
124 |
125 |
126 |
Contribute
127 |
제안, 버그, 개선, 질문 등 이슈는 다음에 등록해 주시면 개선하는데 큰 도움이 됩니다
128 |
131 |
132 |
133 |
license
134 |
MIT license를 따릅니다
135 |
136 |
137 |
145 |
146 |
147 |
148 |
149 |
150 |
199 |
200 |
201 |
212 |
213 |
214 |
215 |
216 |
217 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/underscore.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.3.1
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3 | // Underscore is freely distributable under the MIT license.
4 | // Portions of Underscore are inspired or borrowed from Prototype,
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating.
6 | // For all details and documentation:
7 | // http://documentcloud.github.com/underscore
8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==
12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};
24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e /g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),
28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
32 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/basic.css:
--------------------------------------------------------------------------------
1 | /*
2 | * basic.css
3 | * ~~~~~~~~~
4 | *
5 | * Sphinx stylesheet -- basic theme.
6 | *
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /* -- main layout ----------------------------------------------------------- */
13 |
14 | div.clearer {
15 | clear: both;
16 | }
17 |
18 | /* -- relbar ---------------------------------------------------------------- */
19 |
20 | div.related {
21 | width: 100%;
22 | font-size: 90%;
23 | }
24 |
25 | div.related h3 {
26 | display: none;
27 | }
28 |
29 | div.related ul {
30 | margin: 0;
31 | padding: 0 0 0 10px;
32 | list-style: none;
33 | }
34 |
35 | div.related li {
36 | display: inline;
37 | }
38 |
39 | div.related li.right {
40 | float: right;
41 | margin-right: 5px;
42 | }
43 |
44 | /* -- sidebar --------------------------------------------------------------- */
45 |
46 | div.sphinxsidebarwrapper {
47 | padding: 10px 5px 0 10px;
48 | }
49 |
50 | div.sphinxsidebar {
51 | float: left;
52 | width: 230px;
53 | margin-left: -100%;
54 | font-size: 90%;
55 | word-wrap: break-word;
56 | overflow-wrap : break-word;
57 | }
58 |
59 | div.sphinxsidebar ul {
60 | list-style: none;
61 | }
62 |
63 | div.sphinxsidebar ul ul,
64 | div.sphinxsidebar ul.want-points {
65 | margin-left: 20px;
66 | list-style: square;
67 | }
68 |
69 | div.sphinxsidebar ul ul {
70 | margin-top: 0;
71 | margin-bottom: 0;
72 | }
73 |
74 | div.sphinxsidebar form {
75 | margin-top: 10px;
76 | }
77 |
78 | div.sphinxsidebar input {
79 | border: 1px solid #98dbcc;
80 | font-family: sans-serif;
81 | font-size: 1em;
82 | }
83 |
84 | div.sphinxsidebar #searchbox input[type="text"] {
85 | float: left;
86 | width: 80%;
87 | padding: 0.25em;
88 | box-sizing: border-box;
89 | }
90 |
91 | div.sphinxsidebar #searchbox input[type="submit"] {
92 | float: left;
93 | width: 20%;
94 | border-left: none;
95 | padding: 0.25em;
96 | box-sizing: border-box;
97 | }
98 |
99 |
100 | img {
101 | border: 0;
102 | max-width: 100%;
103 | }
104 |
105 | /* -- search page ----------------------------------------------------------- */
106 |
107 | ul.search {
108 | margin: 10px 0 0 20px;
109 | padding: 0;
110 | }
111 |
112 | ul.search li {
113 | padding: 5px 0 5px 20px;
114 | background-image: url(file.png);
115 | background-repeat: no-repeat;
116 | background-position: 0 7px;
117 | }
118 |
119 | ul.search li a {
120 | font-weight: bold;
121 | }
122 |
123 | ul.search li div.context {
124 | color: #888;
125 | margin: 2px 0 0 30px;
126 | text-align: left;
127 | }
128 |
129 | ul.keywordmatches li.goodmatch a {
130 | font-weight: bold;
131 | }
132 |
133 | /* -- index page ------------------------------------------------------------ */
134 |
135 | table.contentstable {
136 | width: 90%;
137 | margin-left: auto;
138 | margin-right: auto;
139 | }
140 |
141 | table.contentstable p.biglink {
142 | line-height: 150%;
143 | }
144 |
145 | a.biglink {
146 | font-size: 1.3em;
147 | }
148 |
149 | span.linkdescr {
150 | font-style: italic;
151 | padding-top: 5px;
152 | font-size: 90%;
153 | }
154 |
155 | /* -- general index --------------------------------------------------------- */
156 |
157 | table.indextable {
158 | width: 100%;
159 | }
160 |
161 | table.indextable td {
162 | text-align: left;
163 | vertical-align: top;
164 | }
165 |
166 | table.indextable ul {
167 | margin-top: 0;
168 | margin-bottom: 0;
169 | list-style-type: none;
170 | }
171 |
172 | table.indextable > tbody > tr > td > ul {
173 | padding-left: 0em;
174 | }
175 |
176 | table.indextable tr.pcap {
177 | height: 10px;
178 | }
179 |
180 | table.indextable tr.cap {
181 | margin-top: 10px;
182 | background-color: #f2f2f2;
183 | }
184 |
185 | img.toggler {
186 | margin-right: 3px;
187 | margin-top: 3px;
188 | cursor: pointer;
189 | }
190 |
191 | div.modindex-jumpbox {
192 | border-top: 1px solid #ddd;
193 | border-bottom: 1px solid #ddd;
194 | margin: 1em 0 1em 0;
195 | padding: 0.4em;
196 | }
197 |
198 | div.genindex-jumpbox {
199 | border-top: 1px solid #ddd;
200 | border-bottom: 1px solid #ddd;
201 | margin: 1em 0 1em 0;
202 | padding: 0.4em;
203 | }
204 |
205 | /* -- domain module index --------------------------------------------------- */
206 |
207 | table.modindextable td {
208 | padding: 2px;
209 | border-collapse: collapse;
210 | }
211 |
212 | /* -- general body styles --------------------------------------------------- */
213 |
214 | div.body {
215 | min-width: 450px;
216 | max-width: 800px;
217 | }
218 |
219 | div.body p, div.body dd, div.body li, div.body blockquote {
220 | -moz-hyphens: auto;
221 | -ms-hyphens: auto;
222 | -webkit-hyphens: auto;
223 | hyphens: auto;
224 | }
225 |
226 | a.headerlink {
227 | visibility: hidden;
228 | }
229 |
230 | h1:hover > a.headerlink,
231 | h2:hover > a.headerlink,
232 | h3:hover > a.headerlink,
233 | h4:hover > a.headerlink,
234 | h5:hover > a.headerlink,
235 | h6:hover > a.headerlink,
236 | dt:hover > a.headerlink,
237 | caption:hover > a.headerlink,
238 | p.caption:hover > a.headerlink,
239 | div.code-block-caption:hover > a.headerlink {
240 | visibility: visible;
241 | }
242 |
243 | div.body p.caption {
244 | text-align: inherit;
245 | }
246 |
247 | div.body td {
248 | text-align: left;
249 | }
250 |
251 | .first {
252 | margin-top: 0 !important;
253 | }
254 |
255 | p.rubric {
256 | margin-top: 30px;
257 | font-weight: bold;
258 | }
259 |
260 | img.align-left, .figure.align-left, object.align-left {
261 | clear: left;
262 | float: left;
263 | margin-right: 1em;
264 | }
265 |
266 | img.align-right, .figure.align-right, object.align-right {
267 | clear: right;
268 | float: right;
269 | margin-left: 1em;
270 | }
271 |
272 | img.align-center, .figure.align-center, object.align-center {
273 | display: block;
274 | margin-left: auto;
275 | margin-right: auto;
276 | }
277 |
278 | .align-left {
279 | text-align: left;
280 | }
281 |
282 | .align-center {
283 | text-align: center;
284 | }
285 |
286 | .align-right {
287 | text-align: right;
288 | }
289 |
290 | /* -- sidebars -------------------------------------------------------------- */
291 |
292 | div.sidebar {
293 | margin: 0 0 0.5em 1em;
294 | border: 1px solid #ddb;
295 | padding: 7px 7px 0 7px;
296 | background-color: #ffe;
297 | width: 40%;
298 | float: right;
299 | }
300 |
301 | p.sidebar-title {
302 | font-weight: bold;
303 | }
304 |
305 | /* -- topics ---------------------------------------------------------------- */
306 |
307 | div.topic {
308 | border: 1px solid #ccc;
309 | padding: 7px 7px 0 7px;
310 | margin: 10px 0 10px 0;
311 | }
312 |
313 | p.topic-title {
314 | font-size: 1.1em;
315 | font-weight: bold;
316 | margin-top: 10px;
317 | }
318 |
319 | /* -- admonitions ----------------------------------------------------------- */
320 |
321 | div.admonition {
322 | margin-top: 10px;
323 | margin-bottom: 10px;
324 | padding: 7px;
325 | }
326 |
327 | div.admonition dt {
328 | font-weight: bold;
329 | }
330 |
331 | div.admonition dl {
332 | margin-bottom: 0;
333 | }
334 |
335 | p.admonition-title {
336 | margin: 0px 10px 5px 0px;
337 | font-weight: bold;
338 | }
339 |
340 | div.body p.centered {
341 | text-align: center;
342 | margin-top: 25px;
343 | }
344 |
345 | /* -- tables ---------------------------------------------------------------- */
346 |
347 | table.docutils {
348 | border: 0;
349 | border-collapse: collapse;
350 | }
351 |
352 | table.align-center {
353 | margin-left: auto;
354 | margin-right: auto;
355 | }
356 |
357 | table caption span.caption-number {
358 | font-style: italic;
359 | }
360 |
361 | table caption span.caption-text {
362 | }
363 |
364 | table.docutils td, table.docutils th {
365 | padding: 1px 8px 1px 5px;
366 | border-top: 0;
367 | border-left: 0;
368 | border-right: 0;
369 | border-bottom: 1px solid #aaa;
370 | }
371 |
372 | table.footnote td, table.footnote th {
373 | border: 0 !important;
374 | }
375 |
376 | th {
377 | text-align: left;
378 | padding-right: 5px;
379 | }
380 |
381 | table.citation {
382 | border-left: solid 1px gray;
383 | margin-left: 1px;
384 | }
385 |
386 | table.citation td {
387 | border-bottom: none;
388 | }
389 |
390 | /* -- figures --------------------------------------------------------------- */
391 |
392 | div.figure {
393 | margin: 0.5em;
394 | padding: 0.5em;
395 | }
396 |
397 | div.figure p.caption {
398 | padding: 0.3em;
399 | }
400 |
401 | div.figure p.caption span.caption-number {
402 | font-style: italic;
403 | }
404 |
405 | div.figure p.caption span.caption-text {
406 | }
407 |
408 | /* -- field list styles ----------------------------------------------------- */
409 |
410 | table.field-list td, table.field-list th {
411 | border: 0 !important;
412 | }
413 |
414 | .field-list ul {
415 | margin: 0;
416 | padding-left: 1em;
417 | }
418 |
419 | .field-list p {
420 | margin: 0;
421 | }
422 |
423 | .field-name {
424 | -moz-hyphens: manual;
425 | -ms-hyphens: manual;
426 | -webkit-hyphens: manual;
427 | hyphens: manual;
428 | }
429 |
430 | /* -- other body styles ----------------------------------------------------- */
431 |
432 | ol.arabic {
433 | list-style: decimal;
434 | }
435 |
436 | ol.loweralpha {
437 | list-style: lower-alpha;
438 | }
439 |
440 | ol.upperalpha {
441 | list-style: upper-alpha;
442 | }
443 |
444 | ol.lowerroman {
445 | list-style: lower-roman;
446 | }
447 |
448 | ol.upperroman {
449 | list-style: upper-roman;
450 | }
451 |
452 | dl {
453 | margin-bottom: 15px;
454 | }
455 |
456 | dd p {
457 | margin-top: 0px;
458 | }
459 |
460 | dd ul, dd table {
461 | margin-bottom: 10px;
462 | }
463 |
464 | dd {
465 | margin-top: 3px;
466 | margin-bottom: 10px;
467 | margin-left: 30px;
468 | }
469 |
470 | dt:target, span.highlighted {
471 | background-color: #fbe54e;
472 | }
473 |
474 | rect.highlighted {
475 | fill: #fbe54e;
476 | }
477 |
478 | dl.glossary dt {
479 | font-weight: bold;
480 | font-size: 1.1em;
481 | }
482 |
483 | .optional {
484 | font-size: 1.3em;
485 | }
486 |
487 | .sig-paren {
488 | font-size: larger;
489 | }
490 |
491 | .versionmodified {
492 | font-style: italic;
493 | }
494 |
495 | .system-message {
496 | background-color: #fda;
497 | padding: 5px;
498 | border: 3px solid red;
499 | }
500 |
501 | .footnote:target {
502 | background-color: #ffa;
503 | }
504 |
505 | .line-block {
506 | display: block;
507 | margin-top: 1em;
508 | margin-bottom: 1em;
509 | }
510 |
511 | .line-block .line-block {
512 | margin-top: 0;
513 | margin-bottom: 0;
514 | margin-left: 1.5em;
515 | }
516 |
517 | .guilabel, .menuselection {
518 | font-family: sans-serif;
519 | }
520 |
521 | .accelerator {
522 | text-decoration: underline;
523 | }
524 |
525 | .classifier {
526 | font-style: oblique;
527 | }
528 |
529 | abbr, acronym {
530 | border-bottom: dotted 1px;
531 | cursor: help;
532 | }
533 |
534 | /* -- code displays --------------------------------------------------------- */
535 |
536 | pre {
537 | overflow: auto;
538 | overflow-y: hidden; /* fixes display issues on Chrome browsers */
539 | }
540 |
541 | span.pre {
542 | -moz-hyphens: none;
543 | -ms-hyphens: none;
544 | -webkit-hyphens: none;
545 | hyphens: none;
546 | }
547 |
548 | td.linenos pre {
549 | padding: 5px 0px;
550 | border: 0;
551 | background-color: transparent;
552 | color: #aaa;
553 | }
554 |
555 | table.highlighttable {
556 | margin-left: 0.5em;
557 | }
558 |
559 | table.highlighttable td {
560 | padding: 0 0.5em 0 0.5em;
561 | }
562 |
563 | div.code-block-caption {
564 | padding: 2px 5px;
565 | font-size: small;
566 | }
567 |
568 | div.code-block-caption code {
569 | background-color: transparent;
570 | }
571 |
572 | div.code-block-caption + div > div.highlight > pre {
573 | margin-top: 0;
574 | }
575 |
576 | div.code-block-caption span.caption-number {
577 | padding: 0.1em 0.3em;
578 | font-style: italic;
579 | }
580 |
581 | div.code-block-caption span.caption-text {
582 | }
583 |
584 | div.literal-block-wrapper {
585 | padding: 1em 1em 0;
586 | }
587 |
588 | div.literal-block-wrapper div.highlight {
589 | margin: 0;
590 | }
591 |
592 | code.descname {
593 | background-color: transparent;
594 | font-weight: bold;
595 | font-size: 1.2em;
596 | }
597 |
598 | code.descclassname {
599 | background-color: transparent;
600 | }
601 |
602 | code.xref, a code {
603 | background-color: transparent;
604 | font-weight: bold;
605 | }
606 |
607 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
608 | background-color: transparent;
609 | }
610 |
611 | .viewcode-link {
612 | float: right;
613 | }
614 |
615 | .viewcode-back {
616 | float: right;
617 | font-family: sans-serif;
618 | }
619 |
620 | div.viewcode-block:target {
621 | margin: -1px -10px;
622 | padding: 0 10px;
623 | }
624 |
625 | /* -- math display ---------------------------------------------------------- */
626 |
627 | img.math {
628 | vertical-align: middle;
629 | }
630 |
631 | div.body div.math p {
632 | text-align: center;
633 | }
634 |
635 | span.eqno {
636 | float: right;
637 | }
638 |
639 | span.eqno a.headerlink {
640 | position: relative;
641 | left: 0px;
642 | z-index: 1;
643 | }
644 |
645 | div.math:hover a.headerlink {
646 | visibility: visible;
647 | }
648 |
649 | /* -- printout stylesheet --------------------------------------------------- */
650 |
651 | @media print {
652 | div.document,
653 | div.documentwrapper,
654 | div.bodywrapper {
655 | margin: 0 !important;
656 | width: 100%;
657 | }
658 |
659 | div.sphinxsidebar,
660 | div.related,
661 | div.footer,
662 | #top-link {
663 | display: none;
664 | }
665 | }
--------------------------------------------------------------------------------
/docs/_build/html/_static/alabaster.css:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | @import url("basic.css");
54 |
55 | /* -- page layout ----------------------------------------------------------- */
56 |
57 | body {
58 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
59 | font-size: 17px;
60 | background-color: #fff;
61 | color: #000;
62 | margin: 0;
63 | padding: 0;
64 | }
65 |
66 |
67 | div.document {
68 | width: 940px;
69 | margin: 30px auto 0 auto;
70 | }
71 |
72 | div.documentwrapper {
73 | float: left;
74 | width: 100%;
75 | }
76 |
77 | div.bodywrapper {
78 | margin: 0 0 0 220px;
79 | }
80 |
81 | div.sphinxsidebar {
82 | width: 220px;
83 | font-size: 14px;
84 | line-height: 1.5;
85 | }
86 |
87 | hr {
88 | border: 1px solid #B1B4B6;
89 | }
90 |
91 | div.body {
92 | background-color: #fff;
93 | color: #3E4349;
94 | padding: 0 30px 0 30px;
95 | }
96 |
97 | div.body > .section {
98 | text-align: left;
99 | }
100 |
101 | div.footer {
102 | width: 940px;
103 | margin: 20px auto 30px auto;
104 | font-size: 14px;
105 | color: #888;
106 | text-align: right;
107 | }
108 |
109 | div.footer a {
110 | color: #888;
111 | }
112 |
113 | p.caption {
114 | font-family: inherit;
115 | font-size: inherit;
116 | }
117 |
118 |
119 | div.relations {
120 | display: none;
121 | }
122 |
123 |
124 | div.sphinxsidebar a {
125 | color: #444;
126 | text-decoration: none;
127 | border-bottom: 1px dotted #999;
128 | }
129 |
130 | div.sphinxsidebar a:hover {
131 | border-bottom: 1px solid #999;
132 | }
133 |
134 | div.sphinxsidebarwrapper {
135 | padding: 18px 10px;
136 | }
137 |
138 | div.sphinxsidebarwrapper p.logo {
139 | padding: 0;
140 | margin: -10px 0 0 0px;
141 | text-align: center;
142 | }
143 |
144 | div.sphinxsidebarwrapper h1.logo {
145 | margin-top: -10px;
146 | text-align: center;
147 | margin-bottom: 5px;
148 | text-align: left;
149 | }
150 |
151 | div.sphinxsidebarwrapper h1.logo-name {
152 | margin-top: 0px;
153 | }
154 |
155 | div.sphinxsidebarwrapper p.blurb {
156 | margin-top: 0;
157 | font-style: normal;
158 | }
159 |
160 | div.sphinxsidebar h3,
161 | div.sphinxsidebar h4 {
162 | font-family: 'Garamond', 'Georgia', serif;
163 | color: #444;
164 | font-size: 24px;
165 | font-weight: normal;
166 | margin: 0 0 5px 0;
167 | padding: 0;
168 | }
169 |
170 | div.sphinxsidebar h4 {
171 | font-size: 20px;
172 | }
173 |
174 | div.sphinxsidebar h3 a {
175 | color: #444;
176 | }
177 |
178 | div.sphinxsidebar p.logo a,
179 | div.sphinxsidebar h3 a,
180 | div.sphinxsidebar p.logo a:hover,
181 | div.sphinxsidebar h3 a:hover {
182 | border: none;
183 | }
184 |
185 | div.sphinxsidebar p {
186 | color: #555;
187 | margin: 10px 0;
188 | }
189 |
190 | div.sphinxsidebar ul {
191 | margin: 10px 0;
192 | padding: 0;
193 | color: #000;
194 | }
195 |
196 | div.sphinxsidebar ul li.toctree-l1 > a {
197 | font-size: 120%;
198 | }
199 |
200 | div.sphinxsidebar ul li.toctree-l2 > a {
201 | font-size: 110%;
202 | }
203 |
204 | div.sphinxsidebar input {
205 | border: 1px solid #CCC;
206 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif;
207 | font-size: 1em;
208 | }
209 |
210 | div.sphinxsidebar hr {
211 | border: none;
212 | height: 1px;
213 | color: #AAA;
214 | background: #AAA;
215 |
216 | text-align: left;
217 | margin-left: 0;
218 | width: 50%;
219 | }
220 |
221 | /* -- body styles ----------------------------------------------------------- */
222 |
223 | a {
224 | color: #004B6B;
225 | text-decoration: underline;
226 | }
227 |
228 | a:hover {
229 | color: #6D4100;
230 | text-decoration: underline;
231 | }
232 |
233 | div.body h1,
234 | div.body h2,
235 | div.body h3,
236 | div.body h4,
237 | div.body h5,
238 | div.body h6 {
239 | font-family: 'Garamond', 'Georgia', serif;
240 | font-weight: normal;
241 | margin: 30px 0px 10px 0px;
242 | padding: 0;
243 | }
244 |
245 | div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; }
246 | div.body h2 { font-size: 180%; }
247 | div.body h3 { font-size: 150%; }
248 | div.body h4 { font-size: 130%; }
249 | div.body h5 { font-size: 100%; }
250 | div.body h6 { font-size: 100%; }
251 |
252 | a.headerlink {
253 | color: #DDD;
254 | padding: 0 4px;
255 | text-decoration: none;
256 | }
257 |
258 | a.headerlink:hover {
259 | color: #444;
260 | background: #EAEAEA;
261 | }
262 |
263 | div.body p, div.body dd, div.body li {
264 | line-height: 1.4em;
265 | }
266 |
267 | div.admonition {
268 | margin: 20px 0px;
269 | padding: 10px 30px;
270 | background-color: #EEE;
271 | border: 1px solid #CCC;
272 | }
273 |
274 | div.admonition tt.xref, div.admonition code.xref, div.admonition a tt {
275 | background-color: #FBFBFB;
276 | border-bottom: 1px solid #fafafa;
277 | }
278 |
279 | div.admonition p.admonition-title {
280 | font-family: 'Garamond', 'Georgia', serif;
281 | font-weight: normal;
282 | font-size: 24px;
283 | margin: 0 0 10px 0;
284 | padding: 0;
285 | line-height: 1;
286 | }
287 |
288 | div.admonition p.last {
289 | margin-bottom: 0;
290 | }
291 |
292 | div.highlight {
293 | background-color: #fff;
294 | }
295 |
296 | dt:target, .highlight {
297 | background: #FAF3E8;
298 | }
299 |
300 | div.warning {
301 | background-color: #FCC;
302 | border: 1px solid #FAA;
303 | }
304 |
305 | div.danger {
306 | background-color: #FCC;
307 | border: 1px solid #FAA;
308 | -moz-box-shadow: 2px 2px 4px #D52C2C;
309 | -webkit-box-shadow: 2px 2px 4px #D52C2C;
310 | box-shadow: 2px 2px 4px #D52C2C;
311 | }
312 |
313 | div.error {
314 | background-color: #FCC;
315 | border: 1px solid #FAA;
316 | -moz-box-shadow: 2px 2px 4px #D52C2C;
317 | -webkit-box-shadow: 2px 2px 4px #D52C2C;
318 | box-shadow: 2px 2px 4px #D52C2C;
319 | }
320 |
321 | div.caution {
322 | background-color: #FCC;
323 | border: 1px solid #FAA;
324 | }
325 |
326 | div.attention {
327 | background-color: #FCC;
328 | border: 1px solid #FAA;
329 | }
330 |
331 | div.important {
332 | background-color: #EEE;
333 | border: 1px solid #CCC;
334 | }
335 |
336 | div.note {
337 | background-color: #EEE;
338 | border: 1px solid #CCC;
339 | }
340 |
341 | div.tip {
342 | background-color: #EEE;
343 | border: 1px solid #CCC;
344 | }
345 |
346 | div.hint {
347 | background-color: #EEE;
348 | border: 1px solid #CCC;
349 | }
350 |
351 | div.seealso {
352 | background-color: #EEE;
353 | border: 1px solid #CCC;
354 | }
355 |
356 | div.topic {
357 | background-color: #EEE;
358 | }
359 |
360 | p.admonition-title {
361 | display: inline;
362 | }
363 |
364 | p.admonition-title:after {
365 | content: ":";
366 | }
367 |
368 | pre, tt, code {
369 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
370 | font-size: 0.9em;
371 | }
372 |
373 | .hll {
374 | background-color: #FFC;
375 | margin: 0 -12px;
376 | padding: 0 12px;
377 | display: block;
378 | }
379 |
380 | img.screenshot {
381 | }
382 |
383 | tt.descname, tt.descclassname, code.descname, code.descclassname {
384 | font-size: 0.95em;
385 | }
386 |
387 | tt.descname, code.descname {
388 | padding-right: 0.08em;
389 | }
390 |
391 | img.screenshot {
392 | -moz-box-shadow: 2px 2px 4px #EEE;
393 | -webkit-box-shadow: 2px 2px 4px #EEE;
394 | box-shadow: 2px 2px 4px #EEE;
395 | }
396 |
397 | table.docutils {
398 | border: 1px solid #888;
399 | -moz-box-shadow: 2px 2px 4px #EEE;
400 | -webkit-box-shadow: 2px 2px 4px #EEE;
401 | box-shadow: 2px 2px 4px #EEE;
402 | }
403 |
404 | table.docutils td, table.docutils th {
405 | border: 1px solid #888;
406 | padding: 0.25em 0.7em;
407 | }
408 |
409 | table.field-list, table.footnote {
410 | border: none;
411 | -moz-box-shadow: none;
412 | -webkit-box-shadow: none;
413 | box-shadow: none;
414 | }
415 |
416 | table.footnote {
417 | margin: 15px 0;
418 | width: 100%;
419 | border: 1px solid #EEE;
420 | background: #FDFDFD;
421 | font-size: 0.9em;
422 | }
423 |
424 | table.footnote + table.footnote {
425 | margin-top: -15px;
426 | border-top: none;
427 | }
428 |
429 | table.field-list th {
430 | padding: 0 0.8em 0 0;
431 | }
432 |
433 | table.field-list td {
434 | padding: 0;
435 | }
436 |
437 | table.field-list p {
438 | margin-bottom: 0.8em;
439 | }
440 |
441 | /* Cloned from
442 | * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68
443 | */
444 | .field-name {
445 | -moz-hyphens: manual;
446 | -ms-hyphens: manual;
447 | -webkit-hyphens: manual;
448 | hyphens: manual;
449 | }
450 |
451 | table.footnote td.label {
452 | width: .1px;
453 | padding: 0.3em 0 0.3em 0.5em;
454 | }
455 |
456 | table.footnote td {
457 | padding: 0.3em 0.5em;
458 | }
459 |
460 | dl {
461 | margin: 0;
462 | padding: 0;
463 | }
464 |
465 | dl dd {
466 | margin-left: 30px;
467 | }
468 |
469 | blockquote {
470 | margin: 0 0 0 30px;
471 | padding: 0;
472 | }
473 |
474 | ul, ol {
475 | /* Matches the 30px from the narrow-screen "li > ul" selector below */
476 | margin: 10px 0 10px 30px;
477 | padding: 0;
478 | }
479 |
480 | pre {
481 | background: #EEE;
482 | padding: 7px 30px;
483 | margin: 15px 0px;
484 | line-height: 1.3em;
485 | }
486 |
487 | div.viewcode-block:target {
488 | background: #ffd;
489 | }
490 |
491 | dl pre, blockquote pre, li pre {
492 | margin-left: 0;
493 | padding-left: 30px;
494 | }
495 |
496 | tt, code {
497 | background-color: #ecf0f3;
498 | color: #222;
499 | /* padding: 1px 2px; */
500 | }
501 |
502 | tt.xref, code.xref, a tt {
503 | background-color: #FBFBFB;
504 | border-bottom: 1px solid #fff;
505 | }
506 |
507 | a.reference {
508 | text-decoration: none;
509 | border-bottom: 1px dotted #004B6B;
510 | }
511 |
512 | /* Don't put an underline on images */
513 | a.image-reference, a.image-reference:hover {
514 | border-bottom: none;
515 | }
516 |
517 | a.reference:hover {
518 | border-bottom: 1px solid #6D4100;
519 | }
520 |
521 | a.footnote-reference {
522 | text-decoration: none;
523 | font-size: 0.7em;
524 | vertical-align: top;
525 | border-bottom: 1px dotted #004B6B;
526 | }
527 |
528 | a.footnote-reference:hover {
529 | border-bottom: 1px solid #6D4100;
530 | }
531 |
532 | a:hover tt, a:hover code {
533 | background: #EEE;
534 | }
535 |
536 |
537 | @media screen and (max-width: 870px) {
538 |
539 | div.sphinxsidebar {
540 | display: none;
541 | }
542 |
543 | div.document {
544 | width: 100%;
545 |
546 | }
547 |
548 | div.documentwrapper {
549 | margin-left: 0;
550 | margin-top: 0;
551 | margin-right: 0;
552 | margin-bottom: 0;
553 | }
554 |
555 | div.bodywrapper {
556 | margin-top: 0;
557 | margin-right: 0;
558 | margin-bottom: 0;
559 | margin-left: 0;
560 | }
561 |
562 | ul {
563 | margin-left: 0;
564 | }
565 |
566 | li > ul {
567 | /* Matches the 30px from the "ul, ol" selector above */
568 | margin-left: 30px;
569 | }
570 |
571 | .document {
572 | width: auto;
573 | }
574 |
575 | .footer {
576 | width: auto;
577 | }
578 |
579 | .bodywrapper {
580 | margin: 0;
581 | }
582 |
583 | .footer {
584 | width: auto;
585 | }
586 |
587 | .github {
588 | display: none;
589 | }
590 |
591 |
592 |
593 | }
594 |
595 |
596 |
597 | @media screen and (max-width: 875px) {
598 |
599 | body {
600 | margin: 0;
601 | padding: 20px 30px;
602 | }
603 |
604 | div.documentwrapper {
605 | float: none;
606 | background: #fff;
607 | }
608 |
609 | div.sphinxsidebar {
610 | display: block;
611 | float: none;
612 | width: 102.5%;
613 | margin: 50px -30px -20px -30px;
614 | padding: 10px 20px;
615 | background: #333;
616 | color: #FFF;
617 | }
618 |
619 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,
620 | div.sphinxsidebar h3 a {
621 | color: #fff;
622 | }
623 |
624 | div.sphinxsidebar a {
625 | color: #AAA;
626 | }
627 |
628 | div.sphinxsidebar p.logo {
629 | display: none;
630 | }
631 |
632 | div.document {
633 | width: 100%;
634 | margin: 0;
635 | }
636 |
637 | div.footer {
638 | display: none;
639 | }
640 |
641 | div.bodywrapper {
642 | margin: 0;
643 | }
644 |
645 | div.body {
646 | min-height: 0;
647 | padding: 0;
648 | }
649 |
650 | .rtd_doc_footer {
651 | display: none;
652 | }
653 |
654 | .document {
655 | width: auto;
656 | }
657 |
658 | .footer {
659 | width: auto;
660 | }
661 |
662 | .footer {
663 | width: auto;
664 | }
665 |
666 | .github {
667 | display: none;
668 | }
669 | }
670 |
671 |
672 | /* misc. */
673 |
674 | .revsys-inline {
675 | display: none!important;
676 | }
677 |
678 | /* Make nested-list/multi-paragraph items look better in Releases changelog
679 | * pages. Without this, docutils' magical list fuckery causes inconsistent
680 | * formatting between different release sub-lists.
681 | */
682 | div#changelog > div.section > ul > li > p:only-child {
683 | margin-bottom: 0;
684 | }
685 |
686 | /* Hide fugly table cell borders in ..bibliography:: directive output */
687 | table.docutils.citation, table.docutils.citation td, table.docutils.citation th {
688 | border: none;
689 | /* Below needed in some edge cases; if not applied, bottom shadows appear */
690 | -moz-box-shadow: none;
691 | -webkit-box-shadow: none;
692 | box-shadow: none;
693 | }
--------------------------------------------------------------------------------
/docs/_build/html/_static/searchtools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * searchtools.js_t
3 | * ~~~~~~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for the full-text search.
6 | *
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 |
13 | /* Non-minified version JS is _stemmer.js if file is provided */
14 | /**
15 | * Porter Stemmer
16 | */
17 | var Stemmer = function() {
18 |
19 | var step2list = {
20 | ational: 'ate',
21 | tional: 'tion',
22 | enci: 'ence',
23 | anci: 'ance',
24 | izer: 'ize',
25 | bli: 'ble',
26 | alli: 'al',
27 | entli: 'ent',
28 | eli: 'e',
29 | ousli: 'ous',
30 | ization: 'ize',
31 | ation: 'ate',
32 | ator: 'ate',
33 | alism: 'al',
34 | iveness: 'ive',
35 | fulness: 'ful',
36 | ousness: 'ous',
37 | aliti: 'al',
38 | iviti: 'ive',
39 | biliti: 'ble',
40 | logi: 'log'
41 | };
42 |
43 | var step3list = {
44 | icate: 'ic',
45 | ative: '',
46 | alize: 'al',
47 | iciti: 'ic',
48 | ical: 'ic',
49 | ful: '',
50 | ness: ''
51 | };
52 |
53 | var c = "[^aeiou]"; // consonant
54 | var v = "[aeiouy]"; // vowel
55 | var C = c + "[^aeiouy]*"; // consonant sequence
56 | var V = v + "[aeiou]*"; // vowel sequence
57 |
58 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
59 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
60 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
61 | var s_v = "^(" + C + ")?" + v; // vowel in stem
62 |
63 | this.stemWord = function (w) {
64 | var stem;
65 | var suffix;
66 | var firstch;
67 | var origword = w;
68 |
69 | if (w.length < 3)
70 | return w;
71 |
72 | var re;
73 | var re2;
74 | var re3;
75 | var re4;
76 |
77 | firstch = w.substr(0,1);
78 | if (firstch == "y")
79 | w = firstch.toUpperCase() + w.substr(1);
80 |
81 | // Step 1a
82 | re = /^(.+?)(ss|i)es$/;
83 | re2 = /^(.+?)([^s])s$/;
84 |
85 | if (re.test(w))
86 | w = w.replace(re,"$1$2");
87 | else if (re2.test(w))
88 | w = w.replace(re2,"$1$2");
89 |
90 | // Step 1b
91 | re = /^(.+?)eed$/;
92 | re2 = /^(.+?)(ed|ing)$/;
93 | if (re.test(w)) {
94 | var fp = re.exec(w);
95 | re = new RegExp(mgr0);
96 | if (re.test(fp[1])) {
97 | re = /.$/;
98 | w = w.replace(re,"");
99 | }
100 | }
101 | else if (re2.test(w)) {
102 | var fp = re2.exec(w);
103 | stem = fp[1];
104 | re2 = new RegExp(s_v);
105 | if (re2.test(stem)) {
106 | w = stem;
107 | re2 = /(at|bl|iz)$/;
108 | re3 = new RegExp("([^aeiouylsz])\\1$");
109 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
110 | if (re2.test(w))
111 | w = w + "e";
112 | else if (re3.test(w)) {
113 | re = /.$/;
114 | w = w.replace(re,"");
115 | }
116 | else if (re4.test(w))
117 | w = w + "e";
118 | }
119 | }
120 |
121 | // Step 1c
122 | re = /^(.+?)y$/;
123 | if (re.test(w)) {
124 | var fp = re.exec(w);
125 | stem = fp[1];
126 | re = new RegExp(s_v);
127 | if (re.test(stem))
128 | w = stem + "i";
129 | }
130 |
131 | // Step 2
132 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
133 | if (re.test(w)) {
134 | var fp = re.exec(w);
135 | stem = fp[1];
136 | suffix = fp[2];
137 | re = new RegExp(mgr0);
138 | if (re.test(stem))
139 | w = stem + step2list[suffix];
140 | }
141 |
142 | // Step 3
143 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
144 | if (re.test(w)) {
145 | var fp = re.exec(w);
146 | stem = fp[1];
147 | suffix = fp[2];
148 | re = new RegExp(mgr0);
149 | if (re.test(stem))
150 | w = stem + step3list[suffix];
151 | }
152 |
153 | // Step 4
154 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
155 | re2 = /^(.+?)(s|t)(ion)$/;
156 | if (re.test(w)) {
157 | var fp = re.exec(w);
158 | stem = fp[1];
159 | re = new RegExp(mgr1);
160 | if (re.test(stem))
161 | w = stem;
162 | }
163 | else if (re2.test(w)) {
164 | var fp = re2.exec(w);
165 | stem = fp[1] + fp[2];
166 | re2 = new RegExp(mgr1);
167 | if (re2.test(stem))
168 | w = stem;
169 | }
170 |
171 | // Step 5
172 | re = /^(.+?)e$/;
173 | if (re.test(w)) {
174 | var fp = re.exec(w);
175 | stem = fp[1];
176 | re = new RegExp(mgr1);
177 | re2 = new RegExp(meq1);
178 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
179 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
180 | w = stem;
181 | }
182 | re = /ll$/;
183 | re2 = new RegExp(mgr1);
184 | if (re.test(w) && re2.test(w)) {
185 | re = /.$/;
186 | w = w.replace(re,"");
187 | }
188 |
189 | // and turn initial Y back to y
190 | if (firstch == "y")
191 | w = firstch.toLowerCase() + w.substr(1);
192 | return w;
193 | }
194 | }
195 |
196 |
197 |
198 | /**
199 | * Simple result scoring code.
200 | */
201 | var Scorer = {
202 | // Implement the following function to further tweak the score for each result
203 | // The function takes a result array [filename, title, anchor, descr, score]
204 | // and returns the new score.
205 | /*
206 | score: function(result) {
207 | return result[4];
208 | },
209 | */
210 |
211 | // query matches the full name of an object
212 | objNameMatch: 11,
213 | // or matches in the last dotted part of the object name
214 | objPartialMatch: 6,
215 | // Additive scores depending on the priority of the object
216 | objPrio: {0: 15, // used to be importantResults
217 | 1: 5, // used to be objectResults
218 | 2: -5}, // used to be unimportantResults
219 | // Used when the priority is not in the mapping.
220 | objPrioDefault: 0,
221 |
222 | // query found in title
223 | title: 15,
224 | // query found in terms
225 | term: 5
226 | };
227 |
228 |
229 |
230 |
231 |
232 | var splitChars = (function() {
233 | var result = {};
234 | var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648,
235 | 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702,
236 | 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971,
237 | 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345,
238 | 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761,
239 | 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823,
240 | 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125,
241 | 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695,
242 | 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587,
243 | 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141];
244 | var i, j, start, end;
245 | for (i = 0; i < singles.length; i++) {
246 | result[singles[i]] = true;
247 | }
248 | var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709],
249 | [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161],
250 | [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568],
251 | [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807],
252 | [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047],
253 | [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383],
254 | [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450],
255 | [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547],
256 | [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673],
257 | [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820],
258 | [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946],
259 | [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023],
260 | [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173],
261 | [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332],
262 | [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481],
263 | [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718],
264 | [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791],
265 | [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095],
266 | [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205],
267 | [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687],
268 | [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968],
269 | [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869],
270 | [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102],
271 | [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271],
272 | [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592],
273 | [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822],
274 | [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167],
275 | [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959],
276 | [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143],
277 | [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318],
278 | [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483],
279 | [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101],
280 | [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567],
281 | [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292],
282 | [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444],
283 | [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783],
284 | [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311],
285 | [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511],
286 | [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774],
287 | [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071],
288 | [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263],
289 | [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519],
290 | [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647],
291 | [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967],
292 | [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295],
293 | [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274],
294 | [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007],
295 | [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381],
296 | [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]];
297 | for (i = 0; i < ranges.length; i++) {
298 | start = ranges[i][0];
299 | end = ranges[i][1];
300 | for (j = start; j <= end; j++) {
301 | result[j] = true;
302 | }
303 | }
304 | return result;
305 | })();
306 |
307 | function splitQuery(query) {
308 | var result = [];
309 | var start = -1;
310 | for (var i = 0; i < query.length; i++) {
311 | if (splitChars[query.charCodeAt(i)]) {
312 | if (start !== -1) {
313 | result.push(query.slice(start, i));
314 | start = -1;
315 | }
316 | } else if (start === -1) {
317 | start = i;
318 | }
319 | }
320 | if (start !== -1) {
321 | result.push(query.slice(start));
322 | }
323 | return result;
324 | }
325 |
326 |
327 |
328 |
329 | /**
330 | * Search Module
331 | */
332 | var Search = {
333 |
334 | _index : null,
335 | _queued_query : null,
336 | _pulse_status : -1,
337 |
338 | init : function() {
339 | var params = $.getQueryParameters();
340 | if (params.q) {
341 | var query = params.q[0];
342 | $('input[name="q"]')[0].value = query;
343 | this.performSearch(query);
344 | }
345 | },
346 |
347 | loadIndex : function(url) {
348 | $.ajax({type: "GET", url: url, data: null,
349 | dataType: "script", cache: true,
350 | complete: function(jqxhr, textstatus) {
351 | if (textstatus != "success") {
352 | document.getElementById("searchindexloader").src = url;
353 | }
354 | }});
355 | },
356 |
357 | setIndex : function(index) {
358 | var q;
359 | this._index = index;
360 | if ((q = this._queued_query) !== null) {
361 | this._queued_query = null;
362 | Search.query(q);
363 | }
364 | },
365 |
366 | hasIndex : function() {
367 | return this._index !== null;
368 | },
369 |
370 | deferQuery : function(query) {
371 | this._queued_query = query;
372 | },
373 |
374 | stopPulse : function() {
375 | this._pulse_status = 0;
376 | },
377 |
378 | startPulse : function() {
379 | if (this._pulse_status >= 0)
380 | return;
381 | function pulse() {
382 | var i;
383 | Search._pulse_status = (Search._pulse_status + 1) % 4;
384 | var dotString = '';
385 | for (i = 0; i < Search._pulse_status; i++)
386 | dotString += '.';
387 | Search.dots.text(dotString);
388 | if (Search._pulse_status > -1)
389 | window.setTimeout(pulse, 500);
390 | }
391 | pulse();
392 | },
393 |
394 | /**
395 | * perform a search for something (or wait until index is loaded)
396 | */
397 | performSearch : function(query) {
398 | // create the required interface elements
399 | this.out = $('#search-results');
400 | this.title = $('' + _('Searching') + ' ').appendTo(this.out);
401 | this.dots = $(' ').appendTo(this.title);
402 | this.status = $('
').appendTo(this.out);
403 | this.output = $('').appendTo(this.out);
404 |
405 | $('#search-progress').text(_('Preparing search...'));
406 | this.startPulse();
407 |
408 | // index already loaded, the browser was quick!
409 | if (this.hasIndex())
410 | this.query(query);
411 | else
412 | this.deferQuery(query);
413 | },
414 |
415 | /**
416 | * execute search (requires search index to be loaded)
417 | */
418 | query : function(query) {
419 | var i;
420 | var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
421 |
422 | // stem the searchterms and add them to the correct list
423 | var stemmer = new Stemmer();
424 | var searchterms = [];
425 | var excluded = [];
426 | var hlterms = [];
427 | var tmp = splitQuery(query);
428 | var objectterms = [];
429 | for (i = 0; i < tmp.length; i++) {
430 | if (tmp[i] !== "") {
431 | objectterms.push(tmp[i].toLowerCase());
432 | }
433 |
434 | if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
435 | tmp[i] === "") {
436 | // skip this "word"
437 | continue;
438 | }
439 | // stem the word
440 | var word = stemmer.stemWord(tmp[i].toLowerCase());
441 | // prevent stemmer from cutting word smaller than two chars
442 | if(word.length < 3 && tmp[i].length >= 3) {
443 | word = tmp[i];
444 | }
445 | var toAppend;
446 | // select the correct list
447 | if (word[0] == '-') {
448 | toAppend = excluded;
449 | word = word.substr(1);
450 | }
451 | else {
452 | toAppend = searchterms;
453 | hlterms.push(tmp[i].toLowerCase());
454 | }
455 | // only add if not already in the list
456 | if (!$u.contains(toAppend, word))
457 | toAppend.push(word);
458 | }
459 | var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
460 |
461 | // console.debug('SEARCH: searching for:');
462 | // console.info('required: ', searchterms);
463 | // console.info('excluded: ', excluded);
464 |
465 | // prepare search
466 | var terms = this._index.terms;
467 | var titleterms = this._index.titleterms;
468 |
469 | // array of [filename, title, anchor, descr, score]
470 | var results = [];
471 | $('#search-progress').empty();
472 |
473 | // lookup as object
474 | for (i = 0; i < objectterms.length; i++) {
475 | var others = [].concat(objectterms.slice(0, i),
476 | objectterms.slice(i+1, objectterms.length));
477 | results = results.concat(this.performObjectSearch(objectterms[i], others));
478 | }
479 |
480 | // lookup as search terms in fulltext
481 | results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
482 |
483 | // let the scorer override scores with a custom scoring function
484 | if (Scorer.score) {
485 | for (i = 0; i < results.length; i++)
486 | results[i][4] = Scorer.score(results[i]);
487 | }
488 |
489 | // now sort the results by score (in opposite order of appearance, since the
490 | // display function below uses pop() to retrieve items) and then
491 | // alphabetically
492 | results.sort(function(a, b) {
493 | var left = a[4];
494 | var right = b[4];
495 | if (left > right) {
496 | return 1;
497 | } else if (left < right) {
498 | return -1;
499 | } else {
500 | // same score: sort alphabetically
501 | left = a[1].toLowerCase();
502 | right = b[1].toLowerCase();
503 | return (left > right) ? -1 : ((left < right) ? 1 : 0);
504 | }
505 | });
506 |
507 | // for debugging
508 | //Search.lastresults = results.slice(); // a copy
509 | //console.info('search results:', Search.lastresults);
510 |
511 | // print the results
512 | var resultCount = results.length;
513 | function displayNextItem() {
514 | // results left, load the summary and display it
515 | if (results.length) {
516 | var item = results.pop();
517 | var listItem = $(' ');
518 | if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
519 | // dirhtml builder
520 | var dirname = item[0] + '/';
521 | if (dirname.match(/\/index\/$/)) {
522 | dirname = dirname.substring(0, dirname.length-6);
523 | } else if (dirname == 'index/') {
524 | dirname = '';
525 | }
526 | listItem.append($(' ').attr('href',
527 | DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
528 | highlightstring + item[2]).html(item[1]));
529 | } else {
530 | // normal html builders
531 | listItem.append($(' ').attr('href',
532 | item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
533 | highlightstring + item[2]).html(item[1]));
534 | }
535 | if (item[3]) {
536 | listItem.append($(' (' + item[3] + ') '));
537 | Search.output.append(listItem);
538 | listItem.slideDown(5, function() {
539 | displayNextItem();
540 | });
541 | } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
542 | var suffix = DOCUMENTATION_OPTIONS.SOURCELINK_SUFFIX;
543 | if (suffix === undefined) {
544 | suffix = '.txt';
545 | }
546 | $.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[5] + (item[5].slice(-suffix.length) === suffix ? '' : suffix),
547 | dataType: "text",
548 | complete: function(jqxhr, textstatus) {
549 | var data = jqxhr.responseText;
550 | if (data !== '' && data !== undefined) {
551 | listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
552 | }
553 | Search.output.append(listItem);
554 | listItem.slideDown(5, function() {
555 | displayNextItem();
556 | });
557 | }});
558 | } else {
559 | // no source available, just display title
560 | Search.output.append(listItem);
561 | listItem.slideDown(5, function() {
562 | displayNextItem();
563 | });
564 | }
565 | }
566 | // search finished, update title and status message
567 | else {
568 | Search.stopPulse();
569 | Search.title.text(_('Search Results'));
570 | if (!resultCount)
571 | Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
572 | else
573 | Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
574 | Search.status.fadeIn(500);
575 | }
576 | }
577 | displayNextItem();
578 | },
579 |
580 | /**
581 | * search for object names
582 | */
583 | performObjectSearch : function(object, otherterms) {
584 | var filenames = this._index.filenames;
585 | var docnames = this._index.docnames;
586 | var objects = this._index.objects;
587 | var objnames = this._index.objnames;
588 | var titles = this._index.titles;
589 |
590 | var i;
591 | var results = [];
592 |
593 | for (var prefix in objects) {
594 | for (var name in objects[prefix]) {
595 | var fullname = (prefix ? prefix + '.' : '') + name;
596 | if (fullname.toLowerCase().indexOf(object) > -1) {
597 | var score = 0;
598 | var parts = fullname.split('.');
599 | // check for different match types: exact matches of full name or
600 | // "last name" (i.e. last dotted part)
601 | if (fullname == object || parts[parts.length - 1] == object) {
602 | score += Scorer.objNameMatch;
603 | // matches in last name
604 | } else if (parts[parts.length - 1].indexOf(object) > -1) {
605 | score += Scorer.objPartialMatch;
606 | }
607 | var match = objects[prefix][name];
608 | var objname = objnames[match[1]][2];
609 | var title = titles[match[0]];
610 | // If more than one term searched for, we require other words to be
611 | // found in the name/title/description
612 | if (otherterms.length > 0) {
613 | var haystack = (prefix + ' ' + name + ' ' +
614 | objname + ' ' + title).toLowerCase();
615 | var allfound = true;
616 | for (i = 0; i < otherterms.length; i++) {
617 | if (haystack.indexOf(otherterms[i]) == -1) {
618 | allfound = false;
619 | break;
620 | }
621 | }
622 | if (!allfound) {
623 | continue;
624 | }
625 | }
626 | var descr = objname + _(', in ') + title;
627 |
628 | var anchor = match[3];
629 | if (anchor === '')
630 | anchor = fullname;
631 | else if (anchor == '-')
632 | anchor = objnames[match[1]][1] + '-' + fullname;
633 | // add custom score for some objects according to scorer
634 | if (Scorer.objPrio.hasOwnProperty(match[2])) {
635 | score += Scorer.objPrio[match[2]];
636 | } else {
637 | score += Scorer.objPrioDefault;
638 | }
639 | results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]);
640 | }
641 | }
642 | }
643 |
644 | return results;
645 | },
646 |
647 | /**
648 | * search for full-text terms in the index
649 | */
650 | performTermsSearch : function(searchterms, excluded, terms, titleterms) {
651 | var docnames = this._index.docnames;
652 | var filenames = this._index.filenames;
653 | var titles = this._index.titles;
654 |
655 | var i, j, file;
656 | var fileMap = {};
657 | var scoreMap = {};
658 | var results = [];
659 |
660 | // perform the search on the required terms
661 | for (i = 0; i < searchterms.length; i++) {
662 | var word = searchterms[i];
663 | var files = [];
664 | var _o = [
665 | {files: terms[word], score: Scorer.term},
666 | {files: titleterms[word], score: Scorer.title}
667 | ];
668 |
669 | // no match but word was a required one
670 | if ($u.every(_o, function(o){return o.files === undefined;})) {
671 | break;
672 | }
673 | // found search word in contents
674 | $u.each(_o, function(o) {
675 | var _files = o.files;
676 | if (_files === undefined)
677 | return
678 |
679 | if (_files.length === undefined)
680 | _files = [_files];
681 | files = files.concat(_files);
682 |
683 | // set score for the word in each file to Scorer.term
684 | for (j = 0; j < _files.length; j++) {
685 | file = _files[j];
686 | if (!(file in scoreMap))
687 | scoreMap[file] = {}
688 | scoreMap[file][word] = o.score;
689 | }
690 | });
691 |
692 | // create the mapping
693 | for (j = 0; j < files.length; j++) {
694 | file = files[j];
695 | if (file in fileMap)
696 | fileMap[file].push(word);
697 | else
698 | fileMap[file] = [word];
699 | }
700 | }
701 |
702 | // now check if the files don't contain excluded terms
703 | for (file in fileMap) {
704 | var valid = true;
705 |
706 | // check if all requirements are matched
707 | if (fileMap[file].length != searchterms.length)
708 | continue;
709 |
710 | // ensure that none of the excluded terms is in the search result
711 | for (i = 0; i < excluded.length; i++) {
712 | if (terms[excluded[i]] == file ||
713 | titleterms[excluded[i]] == file ||
714 | $u.contains(terms[excluded[i]] || [], file) ||
715 | $u.contains(titleterms[excluded[i]] || [], file)) {
716 | valid = false;
717 | break;
718 | }
719 | }
720 |
721 | // if we have still a valid result we can add it to the result list
722 | if (valid) {
723 | // select one (max) score for the file.
724 | // for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
725 | var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
726 | results.push([docnames[file], titles[file], '', null, score, filenames[file]]);
727 | }
728 | }
729 | return results;
730 | },
731 |
732 | /**
733 | * helper function to return a node containing the
734 | * search summary for a given text. keywords is a list
735 | * of stemmed words, hlwords is the list of normal, unstemmed
736 | * words. the first one is used to find the occurrence, the
737 | * latter for highlighting it.
738 | */
739 | makeSearchSummary : function(text, keywords, hlwords) {
740 | var textLower = text.toLowerCase();
741 | var start = 0;
742 | $.each(keywords, function() {
743 | var i = textLower.indexOf(this.toLowerCase());
744 | if (i > -1)
745 | start = i;
746 | });
747 | start = Math.max(start - 120, 0);
748 | var excerpt = ((start > 0) ? '...' : '') +
749 | $.trim(text.substr(start, 240)) +
750 | ((start + 240 - text.length) ? '...' : '');
751 | var rv = $('
').text(excerpt);
752 | $.each(hlwords, function() {
753 | rv = rv.highlightText(this, 'highlighted');
754 | });
755 | return rv;
756 | }
757 | };
758 |
759 | $(document).ready(function() {
760 | Search.init();
761 | });
--------------------------------------------------------------------------------
/docs/_build/html/_static/websupport.js:
--------------------------------------------------------------------------------
1 | /*
2 | * websupport.js
3 | * ~~~~~~~~~~~~~
4 | *
5 | * sphinx.websupport utilities for all documentation.
6 | *
7 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | (function($) {
13 | $.fn.autogrow = function() {
14 | return this.each(function() {
15 | var textarea = this;
16 |
17 | $.fn.autogrow.resize(textarea);
18 |
19 | $(textarea)
20 | .focus(function() {
21 | textarea.interval = setInterval(function() {
22 | $.fn.autogrow.resize(textarea);
23 | }, 500);
24 | })
25 | .blur(function() {
26 | clearInterval(textarea.interval);
27 | });
28 | });
29 | };
30 |
31 | $.fn.autogrow.resize = function(textarea) {
32 | var lineHeight = parseInt($(textarea).css('line-height'), 10);
33 | var lines = textarea.value.split('\n');
34 | var columns = textarea.cols;
35 | var lineCount = 0;
36 | $.each(lines, function() {
37 | lineCount += Math.ceil(this.length / columns) || 1;
38 | });
39 | var height = lineHeight * (lineCount + 1);
40 | $(textarea).css('height', height);
41 | };
42 | })(jQuery);
43 |
44 | (function($) {
45 | var comp, by;
46 |
47 | function init() {
48 | initEvents();
49 | initComparator();
50 | }
51 |
52 | function initEvents() {
53 | $(document).on("click", 'a.comment-close', function(event) {
54 | event.preventDefault();
55 | hide($(this).attr('id').substring(2));
56 | });
57 | $(document).on("click", 'a.vote', function(event) {
58 | event.preventDefault();
59 | handleVote($(this));
60 | });
61 | $(document).on("click", 'a.reply', function(event) {
62 | event.preventDefault();
63 | openReply($(this).attr('id').substring(2));
64 | });
65 | $(document).on("click", 'a.close-reply', function(event) {
66 | event.preventDefault();
67 | closeReply($(this).attr('id').substring(2));
68 | });
69 | $(document).on("click", 'a.sort-option', function(event) {
70 | event.preventDefault();
71 | handleReSort($(this));
72 | });
73 | $(document).on("click", 'a.show-proposal', function(event) {
74 | event.preventDefault();
75 | showProposal($(this).attr('id').substring(2));
76 | });
77 | $(document).on("click", 'a.hide-proposal', function(event) {
78 | event.preventDefault();
79 | hideProposal($(this).attr('id').substring(2));
80 | });
81 | $(document).on("click", 'a.show-propose-change', function(event) {
82 | event.preventDefault();
83 | showProposeChange($(this).attr('id').substring(2));
84 | });
85 | $(document).on("click", 'a.hide-propose-change', function(event) {
86 | event.preventDefault();
87 | hideProposeChange($(this).attr('id').substring(2));
88 | });
89 | $(document).on("click", 'a.accept-comment', function(event) {
90 | event.preventDefault();
91 | acceptComment($(this).attr('id').substring(2));
92 | });
93 | $(document).on("click", 'a.delete-comment', function(event) {
94 | event.preventDefault();
95 | deleteComment($(this).attr('id').substring(2));
96 | });
97 | $(document).on("click", 'a.comment-markup', function(event) {
98 | event.preventDefault();
99 | toggleCommentMarkupBox($(this).attr('id').substring(2));
100 | });
101 | }
102 |
103 | /**
104 | * Set comp, which is a comparator function used for sorting and
105 | * inserting comments into the list.
106 | */
107 | function setComparator() {
108 | // If the first three letters are "asc", sort in ascending order
109 | // and remove the prefix.
110 | if (by.substring(0,3) == 'asc') {
111 | var i = by.substring(3);
112 | comp = function(a, b) { return a[i] - b[i]; };
113 | } else {
114 | // Otherwise sort in descending order.
115 | comp = function(a, b) { return b[by] - a[by]; };
116 | }
117 |
118 | // Reset link styles and format the selected sort option.
119 | $('a.sel').attr('href', '#').removeClass('sel');
120 | $('a.by' + by).removeAttr('href').addClass('sel');
121 | }
122 |
123 | /**
124 | * Create a comp function. If the user has preferences stored in
125 | * the sortBy cookie, use those, otherwise use the default.
126 | */
127 | function initComparator() {
128 | by = 'rating'; // Default to sort by rating.
129 | // If the sortBy cookie is set, use that instead.
130 | if (document.cookie.length > 0) {
131 | var start = document.cookie.indexOf('sortBy=');
132 | if (start != -1) {
133 | start = start + 7;
134 | var end = document.cookie.indexOf(";", start);
135 | if (end == -1) {
136 | end = document.cookie.length;
137 | by = unescape(document.cookie.substring(start, end));
138 | }
139 | }
140 | }
141 | setComparator();
142 | }
143 |
144 | /**
145 | * Show a comment div.
146 | */
147 | function show(id) {
148 | $('#ao' + id).hide();
149 | $('#ah' + id).show();
150 | var context = $.extend({id: id}, opts);
151 | var popup = $(renderTemplate(popupTemplate, context)).hide();
152 | popup.find('textarea[name="proposal"]').hide();
153 | popup.find('a.by' + by).addClass('sel');
154 | var form = popup.find('#cf' + id);
155 | form.submit(function(event) {
156 | event.preventDefault();
157 | addComment(form);
158 | });
159 | $('#s' + id).after(popup);
160 | popup.slideDown('fast', function() {
161 | getComments(id);
162 | });
163 | }
164 |
165 | /**
166 | * Hide a comment div.
167 | */
168 | function hide(id) {
169 | $('#ah' + id).hide();
170 | $('#ao' + id).show();
171 | var div = $('#sc' + id);
172 | div.slideUp('fast', function() {
173 | div.remove();
174 | });
175 | }
176 |
177 | /**
178 | * Perform an ajax request to get comments for a node
179 | * and insert the comments into the comments tree.
180 | */
181 | function getComments(id) {
182 | $.ajax({
183 | type: 'GET',
184 | url: opts.getCommentsURL,
185 | data: {node: id},
186 | success: function(data, textStatus, request) {
187 | var ul = $('#cl' + id);
188 | var speed = 100;
189 | $('#cf' + id)
190 | .find('textarea[name="proposal"]')
191 | .data('source', data.source);
192 |
193 | if (data.comments.length === 0) {
194 | ul.html('No comments yet. ');
195 | ul.data('empty', true);
196 | } else {
197 | // If there are comments, sort them and put them in the list.
198 | var comments = sortComments(data.comments);
199 | speed = data.comments.length * 100;
200 | appendComments(comments, ul);
201 | ul.data('empty', false);
202 | }
203 | $('#cn' + id).slideUp(speed + 200);
204 | ul.slideDown(speed);
205 | },
206 | error: function(request, textStatus, error) {
207 | showError('Oops, there was a problem retrieving the comments.');
208 | },
209 | dataType: 'json'
210 | });
211 | }
212 |
213 | /**
214 | * Add a comment via ajax and insert the comment into the comment tree.
215 | */
216 | function addComment(form) {
217 | var node_id = form.find('input[name="node"]').val();
218 | var parent_id = form.find('input[name="parent"]').val();
219 | var text = form.find('textarea[name="comment"]').val();
220 | var proposal = form.find('textarea[name="proposal"]').val();
221 |
222 | if (text == '') {
223 | showError('Please enter a comment.');
224 | return;
225 | }
226 |
227 | // Disable the form that is being submitted.
228 | form.find('textarea,input').attr('disabled', 'disabled');
229 |
230 | // Send the comment to the server.
231 | $.ajax({
232 | type: "POST",
233 | url: opts.addCommentURL,
234 | dataType: 'json',
235 | data: {
236 | node: node_id,
237 | parent: parent_id,
238 | text: text,
239 | proposal: proposal
240 | },
241 | success: function(data, textStatus, error) {
242 | // Reset the form.
243 | if (node_id) {
244 | hideProposeChange(node_id);
245 | }
246 | form.find('textarea')
247 | .val('')
248 | .add(form.find('input'))
249 | .removeAttr('disabled');
250 | var ul = $('#cl' + (node_id || parent_id));
251 | if (ul.data('empty')) {
252 | $(ul).empty();
253 | ul.data('empty', false);
254 | }
255 | insertComment(data.comment);
256 | var ao = $('#ao' + node_id);
257 | ao.find('img').attr({'src': opts.commentBrightImage});
258 | if (node_id) {
259 | // if this was a "root" comment, remove the commenting box
260 | // (the user can get it back by reopening the comment popup)
261 | $('#ca' + node_id).slideUp();
262 | }
263 | },
264 | error: function(request, textStatus, error) {
265 | form.find('textarea,input').removeAttr('disabled');
266 | showError('Oops, there was a problem adding the comment.');
267 | }
268 | });
269 | }
270 |
271 | /**
272 | * Recursively append comments to the main comment list and children
273 | * lists, creating the comment tree.
274 | */
275 | function appendComments(comments, ul) {
276 | $.each(comments, function() {
277 | var div = createCommentDiv(this);
278 | ul.append($(document.createElement('li')).html(div));
279 | appendComments(this.children, div.find('ul.comment-children'));
280 | // To avoid stagnating data, don't store the comments children in data.
281 | this.children = null;
282 | div.data('comment', this);
283 | });
284 | }
285 |
286 | /**
287 | * After adding a new comment, it must be inserted in the correct
288 | * location in the comment tree.
289 | */
290 | function insertComment(comment) {
291 | var div = createCommentDiv(comment);
292 |
293 | // To avoid stagnating data, don't store the comments children in data.
294 | comment.children = null;
295 | div.data('comment', comment);
296 |
297 | var ul = $('#cl' + (comment.node || comment.parent));
298 | var siblings = getChildren(ul);
299 |
300 | var li = $(document.createElement('li'));
301 | li.hide();
302 |
303 | // Determine where in the parents children list to insert this comment.
304 | for(var i=0; i < siblings.length; i++) {
305 | if (comp(comment, siblings[i]) <= 0) {
306 | $('#cd' + siblings[i].id)
307 | .parent()
308 | .before(li.html(div));
309 | li.slideDown('fast');
310 | return;
311 | }
312 | }
313 |
314 | // If we get here, this comment rates lower than all the others,
315 | // or it is the only comment in the list.
316 | ul.append(li.html(div));
317 | li.slideDown('fast');
318 | }
319 |
320 | function acceptComment(id) {
321 | $.ajax({
322 | type: 'POST',
323 | url: opts.acceptCommentURL,
324 | data: {id: id},
325 | success: function(data, textStatus, request) {
326 | $('#cm' + id).fadeOut('fast');
327 | $('#cd' + id).removeClass('moderate');
328 | },
329 | error: function(request, textStatus, error) {
330 | showError('Oops, there was a problem accepting the comment.');
331 | }
332 | });
333 | }
334 |
335 | function deleteComment(id) {
336 | $.ajax({
337 | type: 'POST',
338 | url: opts.deleteCommentURL,
339 | data: {id: id},
340 | success: function(data, textStatus, request) {
341 | var div = $('#cd' + id);
342 | if (data == 'delete') {
343 | // Moderator mode: remove the comment and all children immediately
344 | div.slideUp('fast', function() {
345 | div.remove();
346 | });
347 | return;
348 | }
349 | // User mode: only mark the comment as deleted
350 | div
351 | .find('span.user-id:first')
352 | .text('[deleted]').end()
353 | .find('div.comment-text:first')
354 | .text('[deleted]').end()
355 | .find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id +
356 | ', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id)
357 | .remove();
358 | var comment = div.data('comment');
359 | comment.username = '[deleted]';
360 | comment.text = '[deleted]';
361 | div.data('comment', comment);
362 | },
363 | error: function(request, textStatus, error) {
364 | showError('Oops, there was a problem deleting the comment.');
365 | }
366 | });
367 | }
368 |
369 | function showProposal(id) {
370 | $('#sp' + id).hide();
371 | $('#hp' + id).show();
372 | $('#pr' + id).slideDown('fast');
373 | }
374 |
375 | function hideProposal(id) {
376 | $('#hp' + id).hide();
377 | $('#sp' + id).show();
378 | $('#pr' + id).slideUp('fast');
379 | }
380 |
381 | function showProposeChange(id) {
382 | $('#pc' + id).hide();
383 | $('#hc' + id).show();
384 | var textarea = $('#pt' + id);
385 | textarea.val(textarea.data('source'));
386 | $.fn.autogrow.resize(textarea[0]);
387 | textarea.slideDown('fast');
388 | }
389 |
390 | function hideProposeChange(id) {
391 | $('#hc' + id).hide();
392 | $('#pc' + id).show();
393 | var textarea = $('#pt' + id);
394 | textarea.val('').removeAttr('disabled');
395 | textarea.slideUp('fast');
396 | }
397 |
398 | function toggleCommentMarkupBox(id) {
399 | $('#mb' + id).toggle();
400 | }
401 |
402 | /** Handle when the user clicks on a sort by link. */
403 | function handleReSort(link) {
404 | var classes = link.attr('class').split(/\s+/);
405 | for (var i=0; iThank you! Your comment will show up '
558 | + 'once it is has been approved by a moderator.');
559 | }
560 | // Prettify the comment rating.
561 | comment.pretty_rating = comment.rating + ' point' +
562 | (comment.rating == 1 ? '' : 's');
563 | // Make a class (for displaying not yet moderated comments differently)
564 | comment.css_class = comment.displayed ? '' : ' moderate';
565 | // Create a div for this comment.
566 | var context = $.extend({}, opts, comment);
567 | var div = $(renderTemplate(commentTemplate, context));
568 |
569 | // If the user has voted on this comment, highlight the correct arrow.
570 | if (comment.vote) {
571 | var direction = (comment.vote == 1) ? 'u' : 'd';
572 | div.find('#' + direction + 'v' + comment.id).hide();
573 | div.find('#' + direction + 'u' + comment.id).show();
574 | }
575 |
576 | if (opts.moderator || comment.text != '[deleted]') {
577 | div.find('a.reply').show();
578 | if (comment.proposal_diff)
579 | div.find('#sp' + comment.id).show();
580 | if (opts.moderator && !comment.displayed)
581 | div.find('#cm' + comment.id).show();
582 | if (opts.moderator || (opts.username == comment.username))
583 | div.find('#dc' + comment.id).show();
584 | }
585 | return div;
586 | }
587 |
588 | /**
589 | * A simple template renderer. Placeholders such as <%id%> are replaced
590 | * by context['id'] with items being escaped. Placeholders such as <#id#>
591 | * are not escaped.
592 | */
593 | function renderTemplate(template, context) {
594 | var esc = $(document.createElement('div'));
595 |
596 | function handle(ph, escape) {
597 | var cur = context;
598 | $.each(ph.split('.'), function() {
599 | cur = cur[this];
600 | });
601 | return escape ? esc.text(cur || "").html() : cur;
602 | }
603 |
604 | return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
605 | return handle(arguments[2], arguments[1] == '%' ? true : false);
606 | });
607 | }
608 |
609 | /** Flash an error message briefly. */
610 | function showError(message) {
611 | $(document.createElement('div')).attr({'class': 'popup-error'})
612 | .append($(document.createElement('div'))
613 | .attr({'class': 'error-message'}).text(message))
614 | .appendTo('body')
615 | .fadeIn("slow")
616 | .delay(2000)
617 | .fadeOut("slow");
618 | }
619 |
620 | /** Add a link the user uses to open the comments popup. */
621 | $.fn.comment = function() {
622 | return this.each(function() {
623 | var id = $(this).attr('id').substring(1);
624 | var count = COMMENT_METADATA[id];
625 | var title = count + ' comment' + (count == 1 ? '' : 's');
626 | var image = count > 0 ? opts.commentBrightImage : opts.commentImage;
627 | var addcls = count == 0 ? ' nocomment' : '';
628 | $(this)
629 | .append(
630 | $(document.createElement('a')).attr({
631 | href: '#',
632 | 'class': 'sphinx-comment-open' + addcls,
633 | id: 'ao' + id
634 | })
635 | .append($(document.createElement('img')).attr({
636 | src: image,
637 | alt: 'comment',
638 | title: title
639 | }))
640 | .click(function(event) {
641 | event.preventDefault();
642 | show($(this).attr('id').substring(2));
643 | })
644 | )
645 | .append(
646 | $(document.createElement('a')).attr({
647 | href: '#',
648 | 'class': 'sphinx-comment-close hidden',
649 | id: 'ah' + id
650 | })
651 | .append($(document.createElement('img')).attr({
652 | src: opts.closeCommentImage,
653 | alt: 'close',
654 | title: 'close'
655 | }))
656 | .click(function(event) {
657 | event.preventDefault();
658 | hide($(this).attr('id').substring(2));
659 | })
660 | );
661 | });
662 | };
663 |
664 | var opts = {
665 | processVoteURL: '/_process_vote',
666 | addCommentURL: '/_add_comment',
667 | getCommentsURL: '/_get_comments',
668 | acceptCommentURL: '/_accept_comment',
669 | deleteCommentURL: '/_delete_comment',
670 | commentImage: '/static/_static/comment.png',
671 | closeCommentImage: '/static/_static/comment-close.png',
672 | loadingImage: '/static/_static/ajax-loader.gif',
673 | commentBrightImage: '/static/_static/comment-bright.png',
674 | upArrow: '/static/_static/up.png',
675 | downArrow: '/static/_static/down.png',
676 | upArrowPressed: '/static/_static/up-pressed.png',
677 | downArrowPressed: '/static/_static/down-pressed.png',
678 | voting: false,
679 | moderator: false
680 | };
681 |
682 | if (typeof COMMENT_OPTIONS != "undefined") {
683 | opts = jQuery.extend(opts, COMMENT_OPTIONS);
684 | }
685 |
686 | var popupTemplate = '\
687 | ';
723 |
724 | var commentTemplate = '\
725 | \
768 | ';
769 |
770 | var replyTemplate = '\
771 | \
772 | \
773 | \
780 |
\
781 | ';
782 |
783 | $(document).ready(function() {
784 | init();
785 | });
786 | })(jQuery);
787 |
788 | $(document).ready(function() {
789 | // add comment anchors for all paragraphs that are commentable
790 | $('.sphinx-has-comment').comment();
791 |
792 | // highlight search words in search results
793 | $("div.context").each(function() {
794 | var params = $.getQueryParameters();
795 | var terms = (params.q) ? params.q[0].split(/\s+/) : [];
796 | var result = $(this);
797 | $.each(terms, function() {
798 | result.highlightText(this.toLowerCase(), 'highlighted');
799 | });
800 | });
801 |
802 | // directly open comment window if requested
803 | var anchor = document.location.hash;
804 | if (anchor.substring(0, 9) == '#comment-') {
805 | $('#ao' + anchor.substring(9)).click();
806 | document.location.hash = '#s' + anchor.substring(9);
807 | }
808 | });
809 |
--------------------------------------------------------------------------------
\ 689 | Sort by:\ 690 | best rated\ 691 | newest\ 692 | oldest\ 693 |
\ 694 |\ 698 |
Add a comment\ 700 | (markup):
\ 701 |``code``, \ 704 | code blocks:::and an indented block after blank line