R Under development (unstable) (2024-03-11 r86098 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(DatastreamR) > > # Login using Configuration > ds = DataClient$new("Config.ini") INFO [2024-03-13 10:17:36] DSConnect.R DSConnect$getToken :Getting Token and Token Expiry INFO [2024-03-13 10:17:36] DSConnect.R DSConnect$getJsonResponse Web response received > > # GET DATA in Dataframe and plot the values > > # Dataframe is returned > df = tryCatch ({ + ds$getDataframe(tickers = "VOD,BARC", + fields= list("PH","PL"), + start ='2022-01-12', end = '2022-07-13') + }, + error = function(e) + { + stop (message(e)) + + } + ) INFO [2024-03-13 10:17:36] Datastream.R DataClient$getDataframe Getting Data INFO [2024-03-13 10:17:36] Datastream.R DataClient$getData Getting Data INFO [2024-03-13 10:17:36] DSConnect.R DSConnect$getJsonResponse Web response received > # print dataframe > print(df) Dates VOD|PH|£ BARC|PH|£ VOD|PL|£ BARC|PL|£ 1 2022-01-12 117.62 212.20 116.21 209.00 2 2022-01-13 117.78 217.20 116.01 211.30 3 2022-01-14 118.94 219.60 116.30 213.48 4 2022-01-17 120.00 219.10 118.44 214.15 5 2022-01-18 123.60 215.60 118.40 209.80 6 2022-01-19 122.10 213.34 120.33 206.35 7 2022-01-20 121.89 207.80 119.74 202.95 8 2022-01-21 119.00 203.45 117.18 198.06 9 2022-01-24 125.24 198.48 119.14 189.16 10 2022-01-25 125.94 197.42 122.96 192.18 11 2022-01-26 127.20 205.26 124.22 198.76 12 2022-01-27 128.46 207.80 122.76 200.40 13 2022-01-28 129.08 205.95 125.10 195.06 14 2022-01-31 133.36 199.46 129.94 195.60 15 2022-02-01 129.77 201.15 126.92 198.50 16 2022-02-02 132.68 206.12 129.24 201.00 17 2022-02-03 134.26 209.45 129.92 200.90 18 2022-02-04 135.92 207.70 134.22 197.54 19 2022-02-07 138.14 205.20 134.30 200.80 20 2022-02-08 139.66 207.40 136.26 204.35 21 2022-02-09 139.98 209.00 137.38 203.80 22 2022-02-10 141.60 209.17 136.98 205.80 23 2022-02-11 139.52 207.05 136.98 201.75 24 2022-02-14 137.76 199.91 135.10 193.68 25 2022-02-15 139.32 199.90 136.04 192.58 26 2022-02-16 139.92 199.30 138.06 194.34 27 2022-02-17 139.86 195.96 136.44 190.94 28 2022-02-18 139.12 193.14 137.42 189.66 29 2022-02-21 138.00 195.14 135.21 190.04 30 2022-02-22 136.74 192.08 130.10 185.10 31 2022-02-23 137.28 202.35 135.50 191.74 32 2022-02-24 133.62 191.07 129.72 178.24 33 2022-02-25 134.05 190.28 129.14 179.75 34 2022-02-28 133.17 183.88 129.90 179.02 35 2022-03-01 134.10 185.18 128.70 173.04 36 2022-03-02 130.54 178.56 126.74 170.10 37 2022-03-03 129.38 174.91 127.60 168.28 38 2022-03-04 127.54 168.16 121.98 156.78 39 2022-03-07 122.74 155.12 115.88 142.04 40 2022-03-08 119.52 157.94 115.70 147.31 41 2022-03-09 122.18 161.89 115.80 155.72 42 2022-03-10 120.94 164.41 117.44 156.50 43 2022-03-11 120.30 165.64 117.82 157.66 44 2022-03-14 121.94 170.80 119.20 163.22 45 2022-03-15 122.28 170.24 119.62 165.31 46 2022-03-16 124.90 175.61 122.86 170.18 47 2022-03-17 125.96 178.02 122.62 169.90 48 2022-03-18 128.12 172.80 126.30 169.54 49 2022-03-21 129.04 172.18 127.10 168.50 50 2022-03-22 128.50 173.52 126.76 169.84 51 2022-03-23 127.14 174.20 124.12 170.00 52 2022-03-24 125.94 171.08 123.96 167.49 53 2022-03-25 125.59 168.87 123.38 166.32 54 2022-03-28 127.34 166.64 125.30 159.77 55 2022-03-29 127.52 157.40 125.41 150.70 56 2022-03-30 129.42 154.70 126.62 151.40 57 2022-03-31 126.94 152.66 124.84 147.48 58 2022-04-01 126.98 151.76 124.52 146.44 59 2022-04-04 127.56 150.04 124.84 142.56 60 2022-04-05 125.48 148.40 123.24 145.42 61 2022-04-06 127.98 148.16 124.36 141.53 62 2022-04-07 128.94 145.17 126.74 140.06 63 2022-04-08 129.64 144.96 127.48 142.53 64 2022-04-11 131.78 147.27 129.14 144.26 65 2022-04-12 130.84 146.16 129.20 142.40 66 2022-04-13 132.12 144.26 129.88 141.82 67 2022-04-14 132.30 146.28 130.70 142.66 68 2022-04-15 NaN NaN NaN NaN 69 2022-04-18 NaN NaN NaN NaN 70 2022-04-19 131.90 147.08 130.16 144.23 71 2022-04-20 130.48 150.06 127.46 145.80 72 2022-04-21 130.08 150.97 127.74 147.96 73 2022-04-22 129.32 150.32 127.29 146.30 74 2022-04-25 128.30 146.70 125.66 143.14 75 2022-04-26 129.00 148.12 127.60 142.76 76 2022-04-27 126.86 145.26 124.90 140.96 77 2022-04-28 127.04 148.32 125.74 142.34 78 2022-04-29 126.62 149.46 121.00 147.32 79 2022-05-02 NaN NaN NaN NaN 80 2022-05-03 123.88 152.58 119.52 148.86 81 2022-05-04 124.48 153.53 122.14 150.06 82 2022-05-05 124.74 154.44 122.54 149.52 83 2022-05-06 123.14 150.48 119.92 147.28 84 2022-05-09 120.46 148.48 118.68 145.78 85 2022-05-10 120.04 149.26 118.20 143.64 86 2022-05-11 119.86 148.26 117.04 143.72 87 2022-05-12 119.48 147.20 117.78 142.20 88 2022-05-13 118.44 150.54 116.28 147.00 89 2022-05-16 122.83 152.98 119.52 148.94 90 2022-05-17 121.08 157.08 115.02 152.18 91 2022-05-18 120.56 157.22 117.82 154.32 92 2022-05-19 118.78 155.68 116.20 151.20 93 2022-05-20 121.94 157.08 118.06 152.72 94 2022-05-23 126.94 157.74 122.34 153.41 95 2022-05-24 129.24 164.35 125.94 157.21 96 2022-05-25 132.10 164.78 130.18 162.02 97 2022-05-26 132.04 168.76 129.82 163.32 98 2022-05-27 131.68 171.08 129.72 166.43 99 2022-05-30 130.24 173.34 128.42 170.12 100 2022-05-31 131.58 171.62 128.96 168.92 101 2022-06-01 127.68 172.10 125.96 167.48 102 2022-06-02 NaN NaN NaN NaN 103 2022-06-03 NaN NaN NaN NaN 104 2022-06-06 126.28 172.70 124.22 168.08 105 2022-06-07 126.18 170.88 125.10 167.62 106 2022-06-08 126.02 169.66 123.72 167.38 107 2022-06-09 126.52 169.64 124.08 165.42 108 2022-06-10 126.06 165.76 124.51 159.48 109 2022-06-13 127.75 159.22 124.22 155.16 110 2022-06-14 126.82 159.34 125.44 154.26 111 2022-06-15 127.02 163.41 125.64 157.16 112 2022-06-16 126.06 160.30 124.78 153.46 113 2022-06-17 127.24 159.02 125.42 153.76 114 2022-06-20 127.92 161.25 125.92 156.02 115 2022-06-21 128.24 162.54 126.94 158.66 116 2022-06-22 127.24 162.81 124.48 157.66 117 2022-06-23 127.38 160.42 126.18 154.04 118 2022-06-24 126.93 159.60 125.58 152.96 119 2022-06-27 127.52 161.28 126.42 157.34 120 2022-06-28 129.14 162.64 127.38 159.50 121 2022-06-29 126.64 159.58 124.10 156.76 122 2022-06-30 126.92 154.92 125.60 150.12 123 2022-07-01 127.76 156.72 126.32 151.64 124 2022-07-04 130.48 157.04 128.26 153.92 125 2022-07-05 128.92 157.04 126.70 147.18 126 2022-07-06 129.74 150.62 126.70 145.98 127 2022-07-07 128.62 152.50 126.94 149.00 128 2022-07-08 129.02 153.32 126.82 149.16 129 2022-07-11 129.08 152.40 127.38 149.52 130 2022-07-12 129.56 152.22 127.90 146.94 131 2022-07-13 129.22 151.80 127.84 148.02 > > # Plotting of all the values > # plotting VOD|PH|£ > > plot(x = df[[1]], y = df[[2]], type = 'o', xlab = "Dates", + ylab = "Values", col = "blue", ylim = c(100, 250)) > # (provide the highest y-axis limit in ylim parameter to plot all > # the data) > > # add second data series to the same chart using points() and lines() > # plotting BARC|PH|£ > points(x = df[[1]], y = df[[3]], col="red", pch="+") > lines(x = df[[1]], y = df[[3]], type = 'o', col="red",lty=2) > > # #add third data series to the same chart using points() and lines() > # plotting VOD|PL|£ > points(x = df[[1]], y = df[[4]], col="dark blue",pch="o") > lines(x = df[[1]], df[[4]], col="dark blue", lty=3) > > # add third data series to the same chart using points() and lines() > # plotting BARC|PL|£ > points(x = df[[1]], y = df[[5]], col="dark red",pch="+") > lines(x = df[[1]], df[[5]], col="dark red", lty=4) > > > > > > > > > > > > > > > > > > > > > > > proc.time() user system elapsed 0.96 0.20 1.26