I am using blotter to hold and do the accounting of some transactions, but I would need to save and load them on a daily basis.
I haven´t been able to save my transactions, I believe that that happens because they are in a different enviroment created by blotter (.blotter) - from what I´ve been able to pick up by googling my questions.
I have set up an example of a transaction:
require(quantstrat)
currency("USD")
stock(primary_id = "SB1", currency = "USD", multiplier=1120, tick_size = 0.01)
initPortf(name="testport", symbols="SB1", initDate = "2017-11-01")
initAcct(name="testacct", portfolio="testport", initDate = "2017-11-01", initEq = 100000)
ls_instruments()
addTxn(Portfolio="testport", Symbol="SB1", TxnDate="2017-11-22", TxnPrice=15.00, TxnQty = 2 , verbose=TRUE)
getPos(Portfolio="testport", Symbol="SB1", "2017-11-22", Columns=c("Pos.Qty"))
Then I try to save it (which didn´t work) and was thinking about loading it like in the code below:
save("testport", file="C:/Users/augus/Dropbox/Trading/R/Trading/Dados/test.RData", envir=.blotter)
load(file="C:/Users/augus/Dropbox/Trading/R/Trading/Dados/test.RData", verbose=TRUE)
I am pretty knew to R and stackoverflow, so please let me know if I am missing any information in my question, and thanks a lot for the help.
All the best,
Augusto