Giter Site home page Giter Site logo

Comments (6)

davidkleman avatar davidkleman commented on August 23, 2024

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.

braverock avatar braverock commented on August 23, 2024

@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.

davidkleman avatar davidkleman commented on August 23, 2024

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.

braverock avatar braverock commented on August 23, 2024

@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.

davidkleman avatar davidkleman commented on August 23, 2024

Neat, very neat - thank you. Backflips are dangerous.

from blotter.

jaymon0703 avatar jaymon0703 commented on August 23, 2024

from blotter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.