Description Usage Arguments Details Value Author(s) See Also Examples
To add a transaction to the series of transactions for an instrument.
1 |
txn |
the xts time series with transactions for this instrument. |
date |
the transaction date as ISO 8106, e.g., '2008-09-01'. |
size |
the size of the transaction. Positive values indicate a 'buy'; negative values indicate a 'sell'. |
price |
market clearing price at which the transaction was done. |
fees |
fees for the transaction, e.g. commissions. Fees are indicated as negative values. |
The addTrans
function will only add the transaction to the series of transactions.
No PnL calculations are done.
Returns the series of transactions with the new transaction.
Mark Breman
1 2 3 4 5 | ## first transaction for this instrument: on 2009-01-02 buy 36@23.05 and pay a commission of 1.0
txn = addTrans(NULL, date='2009-01-02', size=36, price=23.05, fees=-1.0)
## sell them on 2009-01-04 for 23.09, and pay a commission of 1.0
txn = addTrans(txn, date='2009-01-04', size=-36, price=23.09, fees=-1.0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.