Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: fix tears dates #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# virutalenv
.venv

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
32 changes: 28 additions & 4 deletions pyfolio/tears.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,13 @@ def create_simple_tear_sheet(
plotting.plot_txn_time_hist(transactions, ax=ax_txn_timings)

for ax in fig.axes:
plt.setp(ax.get_xticklabels(), visible=True)
ax.tick_params(
axis="x",
which="major",
bottom=True,
top=False,
labelbottom=True,
)


@plotting.customize
Expand Down Expand Up @@ -642,7 +648,13 @@ def create_returns_tear_sheet(
raise ValueError("bootstrap requires passing of benchmark_rets.")

for ax in fig.axes:
plt.setp(ax.get_xticklabels(), visible=True)
ax.tick_params(
axis="x",
which="major",
bottom=True,
top=False,
labelbottom=True,
)

if return_fig:
return fig
Expand Down Expand Up @@ -746,7 +758,13 @@ def create_position_tear_sheet(
)

for ax in fig.axes:
plt.setp(ax.get_xticklabels(), visible=True)
ax.tick_params(
axis="x",
which="major",
bottom=True,
top=False,
labelbottom=True,
)

if return_fig:
return fig
Expand Down Expand Up @@ -841,7 +859,13 @@ def create_txn_tear_sheet(
ax=ax_slippage_sensitivity,
)
for ax in fig.axes:
plt.setp(ax.get_xticklabels(), visible=True)
ax.tick_params(
axis="x",
which="major",
bottom=True,
top=False,
labelbottom=True,
)

if return_fig:
return fig
Expand Down
11 changes: 5 additions & 6 deletions pyfolio/tests/test_nbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
Each cell is submitted to the kernel, and checked for errors.
"""

import os
import glob
from pathlib import Path
from runipy.notebook_runner import NotebookRunner

from pyfolio.utils import pyfolio_root
from pyfolio.ipycompat import read as read_notebook

EXAMPLES_PATH = Path(__file__).resolve().parent.parent / "examples"


def test_nbs():
path = os.path.join(pyfolio_root(), "examples", "*.ipynb")
for ipynb in glob.glob(path):
for ipynb in EXAMPLES_PATH.glob("*.ipynb"):
print(ipynb)
with open(ipynb) as f:
nb = read_notebook(f, "json")
nb_runner = NotebookRunner(nb)
Expand Down