Description Usage Arguments Details Value Examples
This function reads Tastywork's confirmation files, which are in PDF format, extracts transactions from each file and merges them together into a single data frame.
1 | read_confirmations(files, add.expired = FALSE, check.integrity = FALSE)
|
files |
a vector of path names to the files. |
add.expired |
logical that controls whether bogus transactions for expired options should be added. |
check.integrity |
logical that controls whether to check transactions integrity. |
Tastyworks generates a confirmation only if there was any trading activity druring the day. That makes it difficult to detect any missing confirmations. And there are known cases when confirmations were missing.
Specifying check.integrity = TRUE helps to identify if there are potentially any missing transactions. It checks whether the quantity of traded stocks/options in the closing transaction is greater than the quantity in the corresponding opening transaction. This is the symptom of the missing confirmations.
The output is a data frame, where each record represents one transaction. The data frame has the following variables:
Date, when the transaction was executed
Reason for the transaction:
UNSOLICITED - the transaction was initiated by a customer
ASSIGNED - stock assignment due to exercised short option
EXERCISED - stock assignment due to long option expiring in the money
EXPIRED - option expired out of the money
SPLIT - stock split
Action that created the transaction:
BUY - purchase of stock or option
SELL - sell of stock or option
REMOVE - option was removed because it has expired
Position indicates whether it is an OPEN or a CLOSE transaction
Ticker symbol of the instrument
Instrument type - either STOCK or OPTION
A positive integer indicating the quantity of the traded stock/option
Option type - either CALL or PUT or NA for the stock
Optin strike or NA for the stock
Expiration date of the option or NA for the stock
Price in USD of one unit of the trading instrument
Principal is the quntity multiplied by the price, i.e. transaction amount in USD excluding commission and fees
Commission in USD paid to Tastyworks
Transaction fees in USD
Additional fees in USD
Transaction amount in USD including commission and fees
CUSIP numbers that identify the transaction's financial security
Tag number uniquely identifies the transaction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## Not run:
## Read a single confimation file:
transactions <- read_confirmations("2017-08-30-1NE23456-confirmation.pdf")
## End(Not run)
## Not run:
## Read several confirmation files:
files <- c("2017-08-30-1NE23456-confirmation.pdf",
"2017-08-30-1NE23456-confirmation.pdf")
transactions <- read_confirmations(files)
## End(Not run)
## Not run:
## Read all confimation files in a "confirmations":
# A template for confirmation file name (YYYY-MM-DD-xxxxxxxx-confirmation.pdf)
confirmation_pattern <-
START %R% YMD %R% "-" %R%
repeated(ALNUM, 8) %R% "-confirmation" %R%
DOT %R% "pdf" %R% END
# Get a list of confirmation files
files <- list.files(path = path.expand("confirmations"),
pattern = confirmation_pattern,
full.names = TRUE)
# Read the files
transactions <- read_confirmations(files)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.