Skip to content

Commit ea4253a

Browse files
authored
FIX: yf change to labels and using close price (#564)
* FIX: yf change to labels and using close price * migrate Adj Close to Close
1 parent 6a8f932 commit ea4253a

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lectures/commod_price.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The figure below shows the price of cotton in USD since the start of 2016.
6060
```{code-cell} ipython3
6161
:tags: [hide-input, hide-output]
6262
63-
s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Adj Close']
63+
s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Close']
6464
```
6565

6666
```{code-cell} ipython3

lectures/heavy_tails.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ mystnb:
197197
caption: Daily Amazon returns
198198
name: dailyreturns-amzn
199199
---
200-
s = data['Adj Close']
200+
s = data['Close']
201201
r = s.pct_change()
202202
203203
fig, ax = plt.subplots()
@@ -229,7 +229,7 @@ mystnb:
229229
caption: Daily Bitcoin returns
230230
name: dailyreturns-btc
231231
---
232-
s = data['Adj Close']
232+
s = data['Close']
233233
r = s.pct_change()
234234
235235
fig, ax = plt.subplots()

lectures/prob_dist.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jupytext:
44
extension: .md
55
format_name: myst
66
format_version: 0.13
7-
jupytext_version: 1.16.1
7+
jupytext_version: 1.16.6
88
kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
@@ -434,7 +434,7 @@ for μ, σ in zip(μ_vals, σ_vals):
434434
u = scipy.stats.norm(μ, σ)
435435
ax.plot(x_grid, u.pdf(x_grid),
436436
alpha=0.5, lw=2,
437-
label=f'$\mu={μ}, \sigma={σ}$')
437+
label=rf'$\mu={μ}, \sigma={σ}$')
438438
ax.set_xlabel('x')
439439
ax.set_ylabel('PDF')
440440
plt.legend()
@@ -449,7 +449,7 @@ for μ, σ in zip(μ_vals, σ_vals):
449449
u = scipy.stats.norm(μ, σ)
450450
ax.plot(x_grid, u.cdf(x_grid),
451451
alpha=0.5, lw=2,
452-
label=f'$\mu={μ}, \sigma={σ}$')
452+
label=rf'$\mu={μ}, \sigma={σ}$')
453453
ax.set_ylim(0, 1)
454454
ax.set_xlabel('x')
455455
ax.set_ylabel('CDF')
@@ -510,7 +510,7 @@ for σ in σ_vals:
510510
u = scipy.stats.norm(μ, σ)
511511
ax.plot(x_grid, u.cdf(x_grid),
512512
alpha=0.5, lw=2,
513-
label=f'$\mu={μ}, \sigma={σ}$')
513+
label=rf'$\mu={μ}, \sigma={σ}$')
514514
ax.set_ylim(0, 1)
515515
ax.set_xlim(0, 3)
516516
ax.set_xlabel('x')
@@ -554,7 +554,7 @@ for λ in λ_vals:
554554
u = scipy.stats.expon(scale=1/λ)
555555
ax.plot(x_grid, u.pdf(x_grid),
556556
alpha=0.5, lw=2,
557-
label=f'$\lambda={λ}$')
557+
label=rf'$\lambda={λ}$')
558558
ax.set_xlabel('x')
559559
ax.set_ylabel('PDF')
560560
plt.legend()
@@ -567,7 +567,7 @@ for λ in λ_vals:
567567
u = scipy.stats.expon(scale=1/λ)
568568
ax.plot(x_grid, u.cdf(x_grid),
569569
alpha=0.5, lw=2,
570-
label=f'$\lambda={λ}$')
570+
label=rf'$\lambda={λ}$')
571571
ax.set_ylim(0, 1)
572572
ax.set_xlabel('x')
573573
ax.set_ylabel('CDF')
@@ -615,7 +615,7 @@ for α, β in zip(α_vals, β_vals):
615615
u = scipy.stats.beta(α, β)
616616
ax.plot(x_grid, u.pdf(x_grid),
617617
alpha=0.5, lw=2,
618-
label=fr'$\alpha={α}, \beta={β}$')
618+
label=rf'$\alpha={α}, \beta={β}$')
619619
ax.set_xlabel('x')
620620
ax.set_ylabel('PDF')
621621
plt.legend()
@@ -628,7 +628,7 @@ for α, β in zip(α_vals, β_vals):
628628
u = scipy.stats.beta(α, β)
629629
ax.plot(x_grid, u.cdf(x_grid),
630630
alpha=0.5, lw=2,
631-
label=fr'$\alpha={α}, \beta={β}$')
631+
label=rf'$\alpha={α}, \beta={β}$')
632632
ax.set_ylim(0, 1)
633633
ax.set_xlabel('x')
634634
ax.set_ylabel('CDF')
@@ -675,7 +675,7 @@ for α, β in zip(α_vals, β_vals):
675675
u = scipy.stats.gamma(α, scale=1/β)
676676
ax.plot(x_grid, u.pdf(x_grid),
677677
alpha=0.5, lw=2,
678-
label=fr'$\alpha={α}, \beta={β}$')
678+
label=rf'$\alpha={α}, \beta={β}$')
679679
ax.set_xlabel('x')
680680
ax.set_ylabel('PDF')
681681
plt.legend()
@@ -688,7 +688,7 @@ for α, β in zip(α_vals, β_vals):
688688
u = scipy.stats.gamma(α, scale=1/β)
689689
ax.plot(x_grid, u.cdf(x_grid),
690690
alpha=0.5, lw=2,
691-
label=fr'$\alpha={α}, \beta={β}$')
691+
label=rf'$\alpha={α}, \beta={β}$')
692692
ax.set_ylim(0, 1)
693693
ax.set_xlabel('x')
694694
ax.set_ylabel('CDF')
@@ -799,7 +799,7 @@ So we will have one observation for each month.
799799
:tags: [hide-output]
800800
801801
df = yf.download('AMZN', '2000-1-1', '2024-1-1', interval='1mo')
802-
prices = df['Adj Close']
802+
prices = df['Close']
803803
x_amazon = prices.pct_change()[1:] * 100
804804
x_amazon.head()
805805
```
@@ -876,7 +876,7 @@ For example, let's compare the monthly returns on Amazon shares with the monthly
876876
:tags: [hide-output]
877877
878878
df = yf.download('COST', '2000-1-1', '2024-1-1', interval='1mo')
879-
prices = df['Adj Close']
879+
prices = df['Close']
880880
x_costco = prices.pct_change()[1:] * 100
881881
```
882882

0 commit comments

Comments
 (0)