Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.updatePosPL cannot handle multiple transactions on the same day across currencies #74

Open
dionchu opened this issue Aug 12, 2018 · 0 comments

Comments

@dionchu
Copy link

dionchu commented Aug 12, 2018

From .updatePosPL function inside the updatePortf function

  1. Where there are two transactions on the same day, TmpPeriods will have two rows with duplicate dates.
  2. Line 214 (below) will make CcyMult consistent with Tmp Periods, e.g. two rows with duplicate date
  3. Line 215 (below) indexes into CcyMult using TmpPeriods, which has duplicate dates, and duplicates ONCE MORE so that there are now four entries with the same date in CcyMult rather than just the two in TmpPeriods, the number of rows no longer match

Line 176 TmpPeriods <- Portfolio$symbols[[Symbol]]$posPL[dateRange]
Line 213 CcyMult <- FXrate[dateRange]
Line 214 CcyMult <- na.locf(merge(CcyMult, index(TmpPeriods)))
Line 215 CcyMult <- CcyMult[index(TmpPeriods)]

This leads to an error in line 209

Line 233 TmpPeriods[, "Ccy.Mult"] <- CcyMult

Where the number of rows do not match

What is the best fix? Do we just get rid of line 188? Seems redundant to Line 187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant