The effect of Fed rate hikes on Indian indicators
# Load the packages:
using TSFrames
using MarketData
using Dates
using DataFrames
using EventStudies
using CairoMakieFirst, get data about stock prices from MarketData.jl:
NIFTY index (India)
nifty = TSFrame(MarketData.yahoo("^NSEI"))
select!(nifty.coredata, :Index, :AdjClose => :NIFTY);3838×1 TSFrame with Dates.Date Index
Index NIFTY
Date Float64?
──────────────────────
2007-09-17 4494.65
2007-09-18 4546.2
2007-09-19 4732.35
2007-09-20 4747.55
2007-09-21 4837.55
2007-09-24 4932.2
2007-09-25 4938.85
2007-09-26 4940.5
⋮ ⋮
2023-03-21 17107.5
2023-03-22 17151.9
2023-03-23 17076.9
2023-03-24 16945.1
2023-03-27 16985.7
2023-03-28 16951.7
2023-03-29 17080.7
3823 rows omittedUSD/INR exchange rate
usd_inr = TSFrame(MarketData.yahoo("USDINR=X"))
select!(usd_inr.coredata, :Index, :AdjClose => :USDINR);5045×1 TSFrame with Dates.Date Index
Index USDINR
Date Float64?
──────────────────────
2003-12-01 45.71
2003-12-02 45.629
2003-12-03 45.55
2003-12-04 45.548
2003-12-05 45.449
2003-12-08 45.47
2003-12-09 45.431
2003-12-10 45.371
⋮ ⋮
2023-03-23 82.5258
2023-03-24 82.2653
2023-03-27 82.3388
2023-03-28 82.2149
2023-03-29 82.1643
2023-03-30 82.2554
2023-03-31 82.09
5030 rows omittedUS Fed funds rate
fed_rate = TSFrame(MarketData.fred("FEDFUNDS"))
fed_rate_2007 = TSFrame(fed_rate.coredata[searchsortedfirst(index(fed_rate), Date(2007, 1, 1)):end, :])
fed_rate_diffs = diff(fed_rate_2007)
dropmissing!(fed_rate_diffs.coredata)
fed_rate_dates = filter(:VALUE => >(0), fed_rate_diffs.coredata)83×2 DataFrame
| Row | Index | VALUE |
|---|---|---|
| Date | Float64 | |
| 1 | 2007-02-01 | 0.01 |
| 2 | 2007-07-01 | 0.01 |
| 3 | 2008-06-01 | 0.02 |
| 4 | 2008-07-01 | 0.01 |
| 5 | 2009-02-01 | 0.07 |
| 6 | 2009-05-01 | 0.03 |
| 7 | 2009-06-01 | 0.03 |
| 8 | 2010-02-01 | 0.02 |
| 9 | 2010-03-01 | 0.03 |
| 10 | 2010-04-01 | 0.04 |
| 11 | 2010-08-01 | 0.01 |
| 12 | 2011-08-01 | 0.03 |
| 13 | 2011-11-01 | 0.01 |
| 14 | 2012-01-01 | 0.01 |
| 15 | 2012-02-01 | 0.02 |
| 16 | 2012-03-01 | 0.03 |
| 17 | 2012-04-01 | 0.01 |
| 18 | 2012-05-01 | 0.02 |
| 19 | 2012-09-01 | 0.01 |
| 20 | 2012-10-01 | 0.02 |
| 21 | 2013-02-01 | 0.01 |
| 22 | 2013-04-01 | 0.01 |
| 23 | 2013-10-01 | 0.01 |
| 24 | 2013-12-01 | 0.01 |
| 25 | 2014-03-01 | 0.01 |
| 26 | 2014-04-01 | 0.01 |
| 27 | 2014-06-01 | 0.01 |
| 28 | 2014-12-01 | 0.03 |
| 29 | 2015-04-01 | 0.01 |
| 30 | 2015-06-01 | 0.01 |
| 31 | 2015-08-01 | 0.01 |
| 32 | 2015-12-01 | 0.12 |
| 33 | 2016-01-01 | 0.1 |
| 34 | 2016-02-01 | 0.04 |
| 35 | 2016-04-01 | 0.01 |
| 36 | 2016-06-01 | 0.01 |
| 37 | 2016-07-01 | 0.01 |
| 38 | 2016-08-01 | 0.01 |
| 39 | 2016-11-01 | 0.01 |
| 40 | 2016-12-01 | 0.13 |
| 41 | 2017-01-01 | 0.11 |
| 42 | 2017-02-01 | 0.01 |
| 43 | 2017-03-01 | 0.13 |
| 44 | 2017-04-01 | 0.11 |
| 45 | 2017-05-01 | 0.01 |
| 46 | 2017-06-01 | 0.13 |
| 47 | 2017-07-01 | 0.11 |
| 48 | 2017-08-01 | 0.01 |
| 49 | 2017-11-01 | 0.01 |
| 50 | 2017-12-01 | 0.14 |
| 51 | 2018-01-01 | 0.11 |
| 52 | 2018-02-01 | 0.01 |
| 53 | 2018-03-01 | 0.09 |
| 54 | 2018-04-01 | 0.18 |
| 55 | 2018-05-01 | 0.01 |
| 56 | 2018-06-01 | 0.12 |
| 57 | 2018-07-01 | 0.09 |
| 58 | 2018-09-01 | 0.04 |
| 59 | 2018-10-01 | 0.24 |
| 60 | 2018-11-01 | 0.01 |
| 61 | 2018-12-01 | 0.07 |
| 62 | 2019-01-01 | 0.13 |
| 63 | 2019-03-01 | 0.01 |
| 64 | 2019-04-01 | 0.01 |
| 65 | 2019-07-01 | 0.02 |
| 66 | 2020-02-01 | 0.03 |
| 67 | 2020-06-01 | 0.03 |
| 68 | 2020-07-01 | 0.01 |
| 69 | 2020-08-01 | 0.01 |
| 70 | 2021-06-01 | 0.02 |
| 71 | 2021-07-01 | 0.02 |
| 72 | 2022-03-01 | 0.12 |
| 73 | 2022-04-01 | 0.13 |
| 74 | 2022-05-01 | 0.44 |
| 75 | 2022-06-01 | 0.44 |
| 76 | 2022-07-01 | 0.47 |
| 77 | 2022-08-01 | 0.65 |
| 78 | 2022-09-01 | 0.23 |
| 79 | 2022-10-01 | 0.52 |
| 80 | 2022-11-01 | 0.7 |
| 81 | 2022-12-01 | 0.32 |
| 82 | 2023-01-01 | 0.23 |
| 83 | 2023-02-01 | 0.24 |
Then, we perform the event studies!
NIFTY
eventtime_returns_ts, event_status = EventStudies.eventstudy(
levels_to_returns(nifty),
(:NIFTY,) .=> fed_rate_dates.Index,
-6:7
)
eventtime_cumulative_ts = remap_cumsum(eventtime_returns_ts)
t0, lower, upper = inference(BootstrapInference(), eventtime_cumulative_ts)
eventtime_cumulative_ts14×1 TSFrame with Int64 Index
Index NIFTY
Int64 Float64?
────────────────────
-6 0.0
-5 -0.00137981
-4 -1.25855
-3 -2.87903
-2 -2.62601
-1 -2.55124
0 -2.81117
1 -2.84467
2 -1.47059
3 -1.97286
4 -2.21577
5 -1.37179
6 -1.25016
7 -1.45687plot the result
f, a, p = scatterlines(index(eventtime_cumulative_ts), t0; label = "Mean over all events")
p2 = band!(a, index(eventtime_cumulative_ts), lower, upper; label = "95% CI")
translate!(p, 0, 0, 1) # bring the scatterlines to the front
leg = axislegend(a; position = :rt)
a.title = "NIFTY index performance after a Fed rate hike"
a.subtitle = rich(rich("t=0", font = to_font("Fira Mono")), " indicates the time of rate hike")
a.titlealign = :left
a.xlabel = "Event time (days)"
a.ylabel = "NIFTY returns (%)"
a.xticks = WilkinsonTicks(8; k_min = 5, k_max = 10)
fsave("nifty.pdf", f; ptperunit = 1)
USD/INR
eventtime_returns_ts, event_status = EventStudies.eventstudy(levels_to_returns(usd_inr), (:USDINR,) .=> fed_rate_dates.Index, -6:7)
eventtime_cumulative_ts = remap_cumsum(eventtime_returns_ts)
t0, lower, upper = inference(BootstrapInference(), eventtime_cumulative_ts)
eventtime_cumulative_ts14×1 TSFrame with Int64 Index
Index USDINR
Int64 Float64?
───────────────────
-6 0.0
-5 0.139676
-4 0.0180403
-3 -0.0526597
-2 0.0245454
-1 0.112719
0 0.343513
1 0.272427
2 0.682306
3 0.901577
4 1.54286
5 1.52703
6 1.4274
7 1.27449plot the result
f, a, p = scatterlines(index(eventtime_cumulative_ts), t0; label = "Mean over all events")
p2 = band!(a, index(eventtime_cumulative_ts), lower, upper; label = "95% CI")
translate!(p, 0, 0, 1) # bring the scatterlines to the front
leg = axislegend(a; position = :rt)
a.title = "USD-INR performance after a Fed rate hike"
a.subtitle = rich(rich("t=0", font = to_font("Fira Mono")), " indicates the time of rate hike")
a.titlealign = :left
a.xlabel = "Event time (days)"
a.ylabel = "USD-INR returns (%)"
a.xticks = WilkinsonTicks(8; k_min = 5, k_max = 10)
fsave("usdinr2.pdf", f; ptper_unit = 1)
This page was generated using Literate.jl.