parse_historical_csv | R Documentation |
Helper function to parse a 'csv' file obtained from the
'PredictIt' website, containing historical 'OHLCV' (Open, High, Low, Close,
Volume) data, into an object of class xts
.
parse_historical_csv(csv_path, filename = NA)
csv_path |
Path to a 'csv' file containing historical 'OHLCV' data for a specific contract. Expected format is the same schema as the 'csv' file downloaded from the 'PredictIt' website. |
filename |
Optional name to give the 'csv' file when the filepath is derived from a temporary directory. |
A named list containing the following elements:
An S3 object of class xts
. Time series
containing the 'close' price data for the contract provided.
A character
representing the contract
name, derived from the input file name. If a filename
argument is
provided, the contract name will be assigned to that value.
filename <- "What_will_be_the_balance_of_power_in_Congress_after_the_2020_election.csv" csv_path <- system.file("extdata", filename, package = "rpredictit") parse_historical_csv(csv_path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.