Skip to content

Commit

Permalink
Merge cd80738 into f176217
Browse files Browse the repository at this point in the history
  • Loading branch information
bashtage committed Jan 27, 2020
2 parents f176217 + cd80738 commit 2b5bae9
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 266 deletions.
3 changes: 3 additions & 0 deletions .codacy.yml
@@ -0,0 +1,3 @@
exclude_paths:
- 'versioneer.py'
- 'arch/_version.py'
4 changes: 2 additions & 2 deletions ci/performance.py
Expand Up @@ -6,11 +6,11 @@

from arch.tests.univariate.test_recursions import TestRecursions

if __name__ == '__main__':
if __name__ == "__main__":
try:
import numba # noqa: F401
except ImportError:
print('numba not available -- skipping performance tests')
print("numba not available -- skipping performance tests")
sys.exit(0)

t = TestRecursions()
Expand Down
60 changes: 29 additions & 31 deletions doc/source/conf.py
Expand Up @@ -71,7 +71,7 @@
"sphinx.ext.napoleon",
"IPython.sphinxext.ipython_console_highlighting",
"IPython.sphinxext.ipython_directive",
"nbsphinx"
"nbsphinx",
]

try:
Expand Down Expand Up @@ -133,24 +133,24 @@

# sphinx_material theme options (see theme.conf for more information)
html_theme_options = {
'base_url': 'http://bashtage.github.io/arch/',
'repo_url': 'https://github.com/bashtage/arch/',
'repo_name': 'ARCH',
"base_url": "http://bashtage.github.io/arch/",
"repo_url": "https://github.com/bashtage/arch/",
"repo_name": "ARCH",
# Set the name of the project to appear in the sidebar
"nav_title": project + u" " + version,
'globaltoc_depth': 2,
'globaltoc_collapse': True,
'globaltoc_includehidden': True,
'theme_color': '#2196f3',
'color_primary': 'blue ',
'color_accent': 'indigo',
'html_minify': True,
'css_minify': True,
'master_doc': False
"nav_title": project + " " + version,
"globaltoc_depth": 2,
"globaltoc_collapse": True,
"globaltoc_includehidden": True,
"theme_color": "#2196f3",
"color_primary": "blue ",
"color_accent": "indigo",
"html_minify": True,
"css_minify": True,
"master_doc": False,
}

html_favicon = 'images/favicon.ico'
html_logo = 'images/bw-logo.svg'
html_favicon = "images/favicon.ico"
html_logo = "images/bw-logo.svg"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
Expand All @@ -174,8 +174,7 @@
# html_sidebars = {}
if not on_rtd:
html_sidebars = {
"**": ["logo-text.html", "globaltoc.html", "searchbox.html",
"localtoc.html"]
"**": ["logo-text.html", "globaltoc.html", "searchbox.html", "localtoc.html"]
}

# If false, no module index is generated.
Expand All @@ -192,15 +191,12 @@
# The paper size ("letterpaper" or "a4paper").
#
# "papersize": "letterpaper",

# The font size ("10pt", "11pt" or "12pt").
#
# "pointsize": "10pt",

# Additional stuff for the LaTeX preamble.
#
# "preamble": '',

# Latex figure (float) alignment
#
# "figure_align": "htbp",
Expand All @@ -210,28 +206,30 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "arch.tex", "arch Documentation",
"Kevin Sheppard", "manual"),
(master_doc, "arch.tex", "arch Documentation", "Kevin Sheppard", "manual"),
]

# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, "arch", "arch Documentation",
[author], 1)
]
man_pages = [(master_doc, "arch", "arch Documentation", [author], 1)]

# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, "arch", "arch Documentation",
author, "arch", "ARCH models in Python",
"Finance/Econometrics"),
(
master_doc,
"arch",
"arch Documentation",
author,
"arch",
"ARCH models in Python",
"Finance/Econometrics",
),
]

# -- Options for Epub output -------------------------------------------------
Expand Down Expand Up @@ -274,4 +272,4 @@
napoleon_use_admonition_for_references = True

autosummary_generate = True
autoclass_content = 'class'
autoclass_content = "class"
46 changes: 22 additions & 24 deletions doc/source/images/favicon.py
Expand Up @@ -6,68 +6,66 @@
import pandas_datareader as pdr
import seaborn as sns

colors = sns.color_palette('muted')
colors = sns.color_palette("muted")

NBINS = 7

plt.rcParams['figure.figsize'] = (10, 10)
plt.rcParams["figure.figsize"] = (10, 10)

start = datetime.datetime(1980, 1, 1)
end = datetime.datetime(2020, 1, 1)
data = pdr.get_data_yahoo('^GSPC', start, end)
price = data['Adj Close']
rets = 100 * price.resample('M').last().pct_change()
data = pdr.get_data_yahoo("^GSPC", start, end)
price = data["Adj Close"]
rets = 100 * price.resample("M").last().pct_change()

l, u = rets.quantile([.01, .99])
l, u = rets.quantile([0.01, 0.99])
bins = np.linspace(l, u, NBINS)
fig = plt.figure(frameon=False)
fig.set_size_inches(8, 8)
ax = fig.add_subplot('111')
ax = fig.add_subplot("111")
rwidth = np.diff(bins).mean() * 0.22
_, _, patches = ax.hist(rets, bins=bins, rwidth=rwidth,
align='mid') # '#2196f3')
_, _, patches = ax.hist(rets, bins=bins, rwidth=rwidth, align="mid") # '#2196f3')
for i, patch in enumerate(patches):
patch.set_facecolor(colors[i])
ax.set_xticks([])
ax.set_yticks([])
ax.set_ylabel('')
ax.set_ylabel("")
sns.despine(left=True, bottom=True)
fig.tight_layout(pad=1.0)

fig.savefig('favicon.svg', transparent=True, bbox_inches=0)
fig.savefig('favicon.png', transparent=True)
fig.savefig("favicon.svg", transparent=True, bbox_inches=0)
fig.savefig("favicon.png", transparent=True)

fig = plt.figure(frameon=False)
fig.set_size_inches(8, 8)
ax = fig.add_subplot('111')
ax = fig.add_subplot("111")
rwidth = np.diff(bins).mean() * 0.22
ax.hist(rets, bins=bins, rwidth=rwidth, align='mid', color='#ffffff')
ax.hist(rets, bins=bins, rwidth=rwidth, align="mid", color="#ffffff")
ax.set_xticks([])
ax.set_yticks([])
ax.set_ylabel('')
ax.set_ylabel("")
sns.despine(left=True, bottom=True)
fig.tight_layout(pad=1.0)

fig.savefig('logo.svg', transparent=True, bbox_inches=0)
fig.savefig("logo.svg", transparent=True, bbox_inches=0)


prop = matplotlib.font_manager.FontProperties('Roboto')
prop = matplotlib.font_manager.FontProperties("Roboto")
prop.set_size(216)
fig = plt.figure(frameon=False, figsize=(12, 4))
ax = fig.add_subplot('111')
ax = fig.add_subplot("111")
rwidth = np.diff(bins).mean() * 0.22
_, _, patches = ax.hist(rets, bins=bins, rwidth=rwidth,
align='mid')
_, _, patches = ax.hist(rets, bins=bins, rwidth=rwidth, align="mid")
for i, patch in enumerate(patches):
patch.set_facecolor(colors[i])
ax.set_xticks([])
ax.set_yticks([])
text = ax.text(11, 0, 'arch')
text = ax.text(11, 0, "arch")
text.set_fontproperties(prop)
text.set_fontsize(216)
text.set_color('#757575')
text.set_color("#757575")
ax.set_ylim(0, 180)
sns.despine(left=True, bottom=True)
fig.tight_layout(pad=1.0)
fig.savefig('color-logo.png', transparent=True)
fig.savefig('color-logo.svg', transparent=True)
fig.savefig("color-logo.png", transparent=True)
fig.savefig("color-logo.svg", transparent=True)
34 changes: 17 additions & 17 deletions doc/source/images/hero.py
Expand Up @@ -8,18 +8,18 @@
from arch import arch_model
import arch.data.sp500

warnings.simplefilter('ignore')
sns.set_style('whitegrid')
sns.mpl.rcParams['figure.figsize'] = (12, 3)
warnings.simplefilter("ignore")
sns.set_style("whitegrid")
sns.mpl.rcParams["figure.figsize"] = (12, 3)

data = arch.data.sp500.load()
market = data['Adj Close']
market = data["Adj Close"]
returns = 100 * market.pct_change().dropna()

am = arch_model(returns)
res = am.fit(update_freq=5)

prop = matplotlib.font_manager.FontProperties('Roboto')
prop = matplotlib.font_manager.FontProperties("Roboto")


def _set_tight_x(axis, index):
Expand All @@ -32,9 +32,9 @@ def _set_tight_x(axis, index):
fig = figure()
ax = fig.add_subplot(1, 1, 1)
vol = res.conditional_volatility
title = 'S&P 500 Annualized Conditional Volatility'
scales = {'D': 252, 'W': 52, 'M': 12}
vol = vol * np.sqrt(scales['D'])
title = "S&P 500 Annualized Conditional Volatility"
scales = {"D": 252, "W": 52, "M": 12}
vol = vol * np.sqrt(scales["D"])

ax.plot(res._index.values, vol)
_set_tight_x(ax, res._index)
Expand All @@ -43,13 +43,13 @@ def _set_tight_x(axis, index):
title = ax.get_children()[7]
title.set_fontproperties(prop)
title.set_fontsize(26)
title.set_fontweight('ultralight')
title.set_fontstretch('ultra-condensed')
title.set_color('#757575')
ax.xaxis.label.set_color('#757575')
ax.yaxis.label.set_color('#757575')
ax.tick_params(axis='x', colors='#757575')
ax.tick_params(axis='y', colors='#757575')
title.set_fontweight("ultralight")
title.set_fontstretch("ultra-condensed")
title.set_color("#757575")
ax.xaxis.label.set_color("#757575")
ax.yaxis.label.set_color("#757575")
ax.tick_params(axis="x", colors="#757575")
ax.tick_params(axis="y", colors="#757575")
fig.tight_layout(pad=1.0)
fig.savefig('hero.svg', transparent=True)
fig.savefig('hero.png', transparent=True)
fig.savefig("hero.svg", transparent=True)
fig.savefig("hero.png", transparent=True)

0 comments on commit 2b5bae9

Please sign in to comment.