Saturday, May 1, 2010

Subtle/obvious bug.

There was a bug where some assets got skipped on update. Discovered this when I had a mass of shorts.

Here was the problem

there was a loop
for(i=0;i<[portfolio count];i++)
{
update portfolio[i]
}

The problem is that something updated could disappear, but the counter i would not adjust to deal with the situation. Usually this was resolved by updates in the other portfolio(s) but under just the right conditions an asset could be skipped by both portfolios, and expire before it was exercised.

For the mass of shorts that opportunity arose, precisely in the case of 4 shorts expiring on the same day. Perhaps it occurred everytime with the 4th asset being skipped and the catching up later

No comments:

Post a Comment