Comments (6)
Having some issues related to this. Are multiple transactions on the same Date supposed to work? In that case I'd like to repor the behaviour below. I tried converting manually to Posix but same behaviour. Apparently multiple transactions in one instrument goes through on one date (2007-08-08) but not the next day.
[1] "2007-07-20 02:00:00 FIRE -100 @ 23.4"
[1] "2007-07-23 02:00:00 WESC -50 @ 80"
[1] "2007-07-30 02:00:00 FIRE -25 @ 22.6"
[1] "2007-07-31 02:00:00 WESC -100 @ 80"
[1] "2007-08-08 02:00:00 CONS 100 @ 55.25"
[1] "2007-08-08 02:00:00 CONS 300 @ 55.25"
[1] "2007-08-08 02:00:00 SAND 200 @ 137.75"
[1] "2007-08-09 02:00:00 CONS -300 @ 54"
[1] "2007-08-09 02:00:00 CONS -300 @ 54"
Error in addTxn(myPortfolio.str, row$Ticker1st, TxnDate = row$PosixDate, :
Transactions must be added in order. TxnDate (2007-08-09 02:00:00) is before last transaction in portfolio (2007-08-09 02:00:00) for CONS
from blotter.
@davidkleman I'm not sure your issue is related to this (closed) bug.
In any event, if you have multiple transactions on the same Date, presumably you know the time the transaction occurred? Why not put in the transactions as it/they actually happened rather than throwing away the time information?
from blotter.
Yes, me neither. New to open source, am I supposed to write about this in some other way or place?
Unfortunately my broker only delivers the date of the transactions. As my use case is to analyze my manual trades which I haven't logged exact times for I don't know those.
In case someone encounters a similar situtation: Separating the transactions in time using row_number allows them to be added. E.g. stock_trans <- stock_trans %>% group_by(Ticker1st, PosixDate) %>% mutate(AdjDate = PosixDate + seconds(row_number())) %>% ungroup() %>% arrange(Ticker1st, AdjDate)
from blotter.
@davidkleman , see
?make.index.unique
for a much easier way to create a unique index without converting out of the xts
time series and doing all the backflips you are doing.
In your example, assuming stock_trans
is your time series of transactions, it would be simply
make.index.unique(stock_trans)
from blotter.
Neat, very neat - thank you. Backflips are dangerous.
from blotter.
from blotter.
Related Issues (20)
- Implement c++ solutions for sampling in txnsim() HOT 10
- apply.paramset broken as of blotter v 0.14.6 HOT 1
- currency breaks updatePortf HOT 6
- Error installing blotter and quanstrat in debian buster with r version 3.6.1 (in anaconda) HOT 4
- build fails on Windows - cannot find -lR HOT 6
- Error installing quanstrat R version 4.0.2 HOT 8
- R blotter package: perTradeStats error - Trading on the Last Date HOT 10
- Refactor perTradeStats and error handle scenario where timespan is length 1 (buy and sell txn on same timestamp) HOT 1
- Issue with `perTradeStats` HOT 8
- Parallelize txnsim()
- tradeStats() doesn't honor Dates
- Error in updatePortf() when using multiple currencies HOT 2
- Problem installing it in R 4.2.0 GUI 1.78 High Sierra build (8075) HOT 2
- AddAcctTxn vs. AddTxn (Additions and Withdrawals) HOT 2
- Problem installing on R 4.3.0. on Windows 11 HOT 1
- addTxn having format issues? "Transactions must be added in order" error HOT 5
- Coding style guidelines (discussion topic)
- Extend chart.ME to plot multiple portfolio symbols
- Add multivariate support for mcsim() HOT 1
- add support for mdenv to updatePortf
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blotter.