Skip to content

Instantly share code, notes, and snippets.

@iangow
Created October 4, 2022 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iangow/092d54d3b19d5d0d6bd4ddc406d8cee4 to your computer and use it in GitHub Desktop.
Save iangow/092d54d3b19d5d0d6bd4ddc406d8cee4 to your computer and use it in GitHub Desktop.
Stock prices for Wirecard
library(quantmod)
#> Loading required package: xts
#> Loading required package: zoo
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
#> Loading required package: TTR
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo

# Data Range
sdate <- as.Date("2015-11-30")
edate <- as.Date("2021-12-31")

wc_stock <- getSymbols('WRCDF', from = sdate, to = edate, auto.assign = FALSE)
head(wc_stock)
#>            WRCDF.Open WRCDF.High WRCDF.Low WRCDF.Close WRCDF.Volume
#> 2015-11-30      46.50      46.50     46.50       46.50            0
#> 2015-12-01      49.12      49.99     48.65       49.99          424
#> 2015-12-02      49.99      49.99     49.99       49.99            0
#> 2015-12-03      49.93      49.93     49.72       49.72          435
#> 2015-12-04      49.72      49.72     49.72       49.72            0
#> 2015-12-07      49.60      49.61     49.55       49.55        10437
#>            WRCDF.Adjusted
#> 2015-11-30       46.13684
#> 2015-12-01       49.59958
#> 2015-12-02       49.59958
#> 2015-12-03       49.33169
#> 2015-12-04       49.33169
#> 2015-12-07       49.16301
max_price <- which(wc_stock$WRCDF.Close == max(wc_stock$WRCDF.Close))

wc_stock[max_price, ]
#>            WRCDF.Open WRCDF.High WRCDF.Low WRCDF.Close WRCDF.Volume
#> 2018-08-28     227.94     227.94     226.2    227.7199          872
#>            WRCDF.Adjusted
#> 2018-08-28       227.4517

Created on 2022-10-04 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment