I'm going to hide the loooong table you posted.
Its not in a format that a user can directly insert into a program, and its more than the question requires to be answered/demonstrated.
df <-
structure(list(date = structure(c(
17318, 17319, 17322, 17323,
17324, 17325, 17326, 17329, 17330, 17331, 17332, 17333, 17336,
17337, 17338, 17339, 17340, 17345, 17346, 17347, 17350, 17352,
17353, 17354, 17357, 17358, 17359, 17360, 17361, 17364, 17365,
17366, 17367, 17368, 17371, 17372, 17373, 17374, 17375, 17378,
17379, 17380, 17381, 17382, 17385, 17386, 17387, 17388, 17389,
17392, 17394, 17396, 17399, 17400, 17401, 17402, 17407, 17408,
17409, 17410, 17414, 17415, 17416, 17417, 17420, 17421, 17422,
17423, 17424, 17427, 17428, 17429, 17430, 17431, 17434, 17435,
17436, 17437, 17438, 17442, 17443, 17444, 17445, 17449, 17450,
17451, 17452, 17455, 17456, 17457, 17462, 17463, 17464, 17465,
17466, 17469, 17470, 17471, 17472, 17473, 17476, 17477, 17478,
17479, 17480, 17483, 17484, 17485, 17486, 17487, 17490, 17491,
17492, 17494, 17497, 17498, 17499, 17500, 17504, 17505, 17506,
17507, 17508, 17511, 17512, 17513, 17514, 17515, 17518, 17519,
17520, 17521, 17522, 17527, 17528
), class = "Date"), profit_1m = c(
0.281,
0.085, 0.275, 0.296, 0.287, 0.275, 0.112, 0.275, 0.288, 0.268,
0.284, 0.089, 0.284, 0.302, 0.284, 0.288, 0.064, 0.294, 0.288,
0.288, 0.171, 0.291, 0.296, 0.138, 0.321, 0.317, 0.316, 0.295,
0.095, 0.323, 0.307, 0.314, 0.316, 0.115, 0.311, 0.301, 0.294,
0.284, 0.086, 0.31, 0.305, 0.305, 0.3, 0.092, 0.329, 0.321, 0.325,
0.329, 0.123, 0.162, 0.142, 0.095, 0.311, 0.307, 0.3, 0.07, 0.31,
0.29, 0.277, 0.081, 0.339, 0.291, 0.28, 0.091, 0.294, 0.325,
0.311, 0.267, 0.095, 0.314, 0.285, 0.282, 0.283, 0.089, 0.301,
0.312, 0.301, 0.28, 0.069, 0.304, 0.312, 0.289, 0.066, 0.336,
0.311, 0.297, 0.091, 0.273, 0.294, 0.05, 0.312, 0.312, 0.302,
0.298, 0.088, 0.319, 0.303, 0.309, 0.304, 0.089, 0.274, 0.314,
0.3, 0.29, 0.093, 0.277, 0.301, 0.295, 0.277, 0.089, 0.282, 0.293,
0.135, 0.108, 0.306, 0.256, 0.27, 0.063, 0.306, 0.283, 0.267,
0.254, 0.081, 0.287, 0.254, 0.28, 0.255, 0.09, 0.259, 0.286,
0.261, 0.26, 0.062, 0.268, 0.285
), libor_1m = c(
0.784, 0.811,
0.83, 0.834, 0.847, 0.854, 0.858, 0.881, 0.891, 0.928, 0.943,
0.978, 0.976, 0.977, 0.977, 0.984, 0.982, 0.983, 0.982, 0.982,
0.983, 0.983, 0.986, 0.989, 0.99, 0.988, 0.99, 0.994, 0.994,
0.993, 0.991, 0.988, 0.991, 0.991, 0.992, 0.993, 0.995, 0.993,
0.992, 0.993, 0.994, 0.994, 0.989, 0.989, 0.992, 1.001, 0.999,
1.004, 1.01, 1.017, 1.029, 1.024, 1.033, 1.044, 1.045, 1.051,
1.06, 1.076, 1.086, 1.084, 1.089, 1.096, 1.117, 1.127, 1.139,
1.159, 1.172, 1.209, 1.212, 1.214, 1.216, 1.216, 1.216, 1.22,
1.226, 1.227, 1.224, 1.227, 1.223, 1.224, 1.226, 1.224, 1.224,
1.224, 1.226, 1.226, 1.228, 1.228, 1.229, 1.227, 1.232, 1.233,
1.233, 1.233, 1.234, 1.232, 1.232, 1.232, 1.231, 1.231, 1.229,
1.229, 1.231, 1.229, 1.229, 1.227, 1.228, 1.228, 1.235, 1.236,
1.236, 1.234, 1.234, 1.239, 1.237, 1.232, 1.231, 1.232, 1.231,
1.232, 1.235, 1.236, 1.236, 1.237, 1.234, 1.234, 1.237, 1.236,
1.237, 1.236, 1.237, 1.238, 1.237, 1.234, 1.235
), mibor_1m = c(
5.22,
4.85, 5.21, 5.21, 5.57, 5.4, 5.22, 5.66, 5.58, 5.62, 5.49, 5.51,
5.68, 6.06, 5.88, 5.5, 5.41, 5.22, 5.07, 4.8, 4.99, 5.45, 5.35,
5.54, 5.4, 5.4, 5.67, 5.19, 5.22, 5.58, 5.39, 5.2, 5.2, 5.21,
5.69, 5.62, 5.61, 5.42, 5.14, 5.05, 5.04, 5.23, 5.21, 5.21, 5.23,
5.61, 5.43, 5.25, 5.22, 5.17, 5.58, 5.37, 5.18, 4.93, 4.92, 5.01,
4.83, 4.75, 4.75, 4.66, 5.03, 4.84, 4.66, 4.76, 4.76, 5.03, 4.85,
4.76, 4.83, 4.85, 5.03, 4.83, 4.74, 4.74, 4.84, 4.75, 4.73, 5.19,
4.73, 4.82, 4.82, 5.02, 5.02, 4.84, 5.03, 4.84, 5.13, 4.94, 4.85,
4.84, 5.22, 5.03, 4.85, 4.66, 4.68, 4.68, 5.24, 5.06, 4.87, 4.71,
4.71, 5.08, 4.9, 4.71, 4.69, 4.96, 4.5, 4.67, 4.68, 4.97, 4.87,
4.68, 4.68, 4.22, 4.5, 4.31, 4.31, 4.22, 4.59, 4.39, 4.22, 4.23,
4.32, 4.69, 4.5, 4.31, 4.87, 4.78, 4.58, 4.47, 4.37, 4.43, 4.44,
4.78, 4.84
)), row.names = c(NA, -135L), class = c(
"tbl_df", "tbl",
"data.frame"
))
library(plotly)
library(lubridate)
plot_1m <- plot_ly(
data = df,
x = ~date, y = ~profit_1m, type = "scatter", mode = "lines",
line = list(color = "hsl(0, 100%, 50%)", width = 2),
name = "profit"
) %>%
add_trace(
y = ~libor_1m,
line = list(color = "hsl(90, 100%, 50%)"),
name = "libor"
) %>%
add_trace(
y = ~mibor_1m,
line = list(color = "hsl(180, 100%, 50%)"),
name = "libor"
)
plot_1m <- plot_1m %>% layout(
title = "Arbitrage profit with 1 Month forward USD/INR rate ",
xaxis = list(title = "Year"), yaxis = list(title = "Profit (%)")
)
plot_1m