fakereturns
A toy R package to generate fake but realistic data for various analytic purposes.
Very Alpha, not ready for use.
Overview
The idea is to
- Start with a a set of tickers, a begin, and end date that defines a period of time.
- Get a number of random dates from this period of time, and
- Assign the tickers to these dates.
- Retrieve historical stock ticker information for (ticker, date) tuples
- Arbitrarily assign BOUGHT or SOLD status
Now we have a dataset to analyze.
Examples
library(fakereturns)
d <- fake.some.portfolio.data(
start.date= '2015-01-01',
end.date=Sys.Date(),
n = 40,
tickers = c("AAPL", "NFLX", "GOOG"),
pct.bought = 0.5,
purchase.ceiling = 5000
)
Installation
if (!require("devtools")) {
install.packages("devtools")
}
devtools::install_github("aaelony/fakereturns", dependencies = TRUE, build_vignettes = FALSE)
TODO
- offer ways (e.g. FIFO, LIFO) to match BOUGHT with SOLD
- compute IRR
- freq distribution of weekdays
Changelog
Version 0.0.5
Breaking changes, now returns one data.table
.
- compute shares sold with dates occuring after the purchase
Version 0.0.4
adding weekday to generated dates