The effect of Fed rate hikes on Indian indicators

# Load the packages:
using TSFrames
using MarketData
using Dates
using DataFrames
using EventStudies
using CairoMakie

First, 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 omitted

USD/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 omitted

US 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
RowIndexVALUE
DateFloat64
12007-02-010.01
22007-07-010.01
32008-06-010.02
42008-07-010.01
52009-02-010.07
62009-05-010.03
72009-06-010.03
82010-02-010.02
92010-03-010.03
102010-04-010.04
112010-08-010.01
122011-08-010.03
132011-11-010.01
142012-01-010.01
152012-02-010.02
162012-03-010.03
172012-04-010.01
182012-05-010.02
192012-09-010.01
202012-10-010.02
212013-02-010.01
222013-04-010.01
232013-10-010.01
242013-12-010.01
252014-03-010.01
262014-04-010.01
272014-06-010.01
282014-12-010.03
292015-04-010.01
302015-06-010.01
312015-08-010.01
322015-12-010.12
332016-01-010.1
342016-02-010.04
352016-04-010.01
362016-06-010.01
372016-07-010.01
382016-08-010.01
392016-11-010.01
402016-12-010.13
412017-01-010.11
422017-02-010.01
432017-03-010.13
442017-04-010.11
452017-05-010.01
462017-06-010.13
472017-07-010.11
482017-08-010.01
492017-11-010.01
502017-12-010.14
512018-01-010.11
522018-02-010.01
532018-03-010.09
542018-04-010.18
552018-05-010.01
562018-06-010.12
572018-07-010.09
582018-09-010.04
592018-10-010.24
602018-11-010.01
612018-12-010.07
622019-01-010.13
632019-03-010.01
642019-04-010.01
652019-07-010.02
662020-02-010.03
672020-06-010.03
682020-07-010.01
692020-08-010.01
702021-06-010.02
712021-07-010.02
722022-03-010.12
732022-04-010.13
742022-05-010.44
752022-06-010.44
762022-07-010.47
772022-08-010.65
782022-09-010.23
792022-10-010.52
802022-11-010.7
812022-12-010.32
822023-01-010.23
832023-02-010.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_ts
14×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.45687

plot 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)
f

save("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_ts
14×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.27449

plot 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)
f

save("usdinr2.pdf", f; ptper_unit = 1)


This page was generated using Literate.jl.