Skip to content

FIX: yf change to labels and using close price #564

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

Merged
merged 2 commits into from
Jan 16, 2025
Merged
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
2 changes: 1 addition & 1 deletion lectures/commod_price.md
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ The figure below shows the price of cotton in USD since the start of 2016.
```{code-cell} ipython3
:tags: [hide-input, hide-output]

s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Adj Close']
s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Close']
```

```{code-cell} ipython3
4 changes: 2 additions & 2 deletions lectures/heavy_tails.md
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ mystnb:
caption: Daily Amazon returns
name: dailyreturns-amzn
---
s = data['Adj Close']
s = data['Close']
r = s.pct_change()

fig, ax = plt.subplots()
@@ -229,7 +229,7 @@ mystnb:
caption: Daily Bitcoin returns
name: dailyreturns-btc
---
s = data['Adj Close']
s = data['Close']
r = s.pct_change()

fig, ax = plt.subplots()
24 changes: 12 additions & 12 deletions lectures/prob_dist.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ jupytext:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.1
jupytext_version: 1.16.6
kernelspec:
display_name: Python 3 (ipykernel)
language: python
@@ -434,7 +434,7 @@ for μ, σ in zip(μ_vals, σ_vals):
u = scipy.stats.norm(μ, σ)
ax.plot(x_grid, u.pdf(x_grid),
alpha=0.5, lw=2,
label=f'$\mu={μ}, \sigma={σ}$')
label=rf'$\mu={μ}, \sigma={σ}$')
ax.set_xlabel('x')
ax.set_ylabel('PDF')
plt.legend()
@@ -449,7 +449,7 @@ for μ, σ in zip(μ_vals, σ_vals):
u = scipy.stats.norm(μ, σ)
ax.plot(x_grid, u.cdf(x_grid),
alpha=0.5, lw=2,
label=f'$\mu={μ}, \sigma={σ}$')
label=rf'$\mu={μ}, \sigma={σ}$')
ax.set_ylim(0, 1)
ax.set_xlabel('x')
ax.set_ylabel('CDF')
@@ -510,7 +510,7 @@ for σ in σ_vals:
u = scipy.stats.norm(μ, σ)
ax.plot(x_grid, u.cdf(x_grid),
alpha=0.5, lw=2,
label=f'$\mu={μ}, \sigma={σ}$')
label=rf'$\mu={μ}, \sigma={σ}$')
ax.set_ylim(0, 1)
ax.set_xlim(0, 3)
ax.set_xlabel('x')
@@ -554,7 +554,7 @@ for λ in λ_vals:
u = scipy.stats.expon(scale=1/λ)
ax.plot(x_grid, u.pdf(x_grid),
alpha=0.5, lw=2,
label=f'$\lambda={λ}$')
label=rf'$\lambda={λ}$')
ax.set_xlabel('x')
ax.set_ylabel('PDF')
plt.legend()
@@ -567,7 +567,7 @@ for λ in λ_vals:
u = scipy.stats.expon(scale=1/λ)
ax.plot(x_grid, u.cdf(x_grid),
alpha=0.5, lw=2,
label=f'$\lambda={λ}$')
label=rf'$\lambda={λ}$')
ax.set_ylim(0, 1)
ax.set_xlabel('x')
ax.set_ylabel('CDF')
@@ -615,7 +615,7 @@ for α, β in zip(α_vals, β_vals):
u = scipy.stats.beta(α, β)
ax.plot(x_grid, u.pdf(x_grid),
alpha=0.5, lw=2,
label=fr'$\alpha={α}, \beta={β}$')
label=rf'$\alpha={α}, \beta={β}$')
ax.set_xlabel('x')
ax.set_ylabel('PDF')
plt.legend()
@@ -628,7 +628,7 @@ for α, β in zip(α_vals, β_vals):
u = scipy.stats.beta(α, β)
ax.plot(x_grid, u.cdf(x_grid),
alpha=0.5, lw=2,
label=fr'$\alpha={α}, \beta={β}$')
label=rf'$\alpha={α}, \beta={β}$')
ax.set_ylim(0, 1)
ax.set_xlabel('x')
ax.set_ylabel('CDF')
@@ -675,7 +675,7 @@ for α, β in zip(α_vals, β_vals):
u = scipy.stats.gamma(α, scale=1/β)
ax.plot(x_grid, u.pdf(x_grid),
alpha=0.5, lw=2,
label=fr'$\alpha={α}, \beta={β}$')
label=rf'$\alpha={α}, \beta={β}$')
ax.set_xlabel('x')
ax.set_ylabel('PDF')
plt.legend()
@@ -688,7 +688,7 @@ for α, β in zip(α_vals, β_vals):
u = scipy.stats.gamma(α, scale=1/β)
ax.plot(x_grid, u.cdf(x_grid),
alpha=0.5, lw=2,
label=fr'$\alpha={α}, \beta={β}$')
label=rf'$\alpha={α}, \beta={β}$')
ax.set_ylim(0, 1)
ax.set_xlabel('x')
ax.set_ylabel('CDF')
@@ -799,7 +799,7 @@ So we will have one observation for each month.
:tags: [hide-output]

df = yf.download('AMZN', '2000-1-1', '2024-1-1', interval='1mo')
prices = df['Adj Close']
prices = df['Close']
x_amazon = prices.pct_change()[1:] * 100
x_amazon.head()
```
@@ -876,7 +876,7 @@ For example, let's compare the monthly returns on Amazon shares with the monthly
:tags: [hide-output]

df = yf.download('COST', '2000-1-1', '2024-1-1', interval='1mo')
prices = df['Adj Close']
prices = df['Close']
x_costco = prices.pct_change()[1:] * 100
```