some doubt about the the value of noDuplicatedFixing in "ql/index.hpp"

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

some doubt about the the value of noDuplicatedFixing in "ql/index.hpp"

rage-2
hi guys, I have some doubt in the index class when determining the value of noDueplicateFixing.  pls help me figure out. thanks!

"ql/index.hpp"
this is the part that determining weather there is a duplicated value in the history:

while (dBegin != dEnd) {
                validFixing = isValidFixingDate(*dBegin);
                Real currentValue = h[*dBegin];
                missingFixing= forceOverwrite || close(currentValue,nullValue);
                if (validFixing) {
                    if (missingFixing)
                        h[*(dBegin++)] = *(vBegin++);
                    else if (close(currentValue,*(vBegin))) {
                        ++dBegin;
                        ++vBegin;
                    } else {
                        noDuplicatedFixing = false;
                        duplicatedDate = *(dBegin++);
                        duplicatedValue = *(vBegin++);
                    }
                } else {
                    noInvalidFixing = false;
                    invalidDate = *(dBegin++);
                    invalidValue = *(vBegin++);
                }
            }

------>I think this snippet has some problem
    else if (close(currentValue,*(vBegin))) {
++dBegin;
++vBegin;
    } else {
noDuplicatedFixing = false;
duplicatedDate = *(dBegin++);
duplicatedValue = *(vBegin++);
    }

----->I think it should look like this:
    else if (close(currentValue,*(vBegin))) {
noDuplicatedFixing = false;
duplicatedDate = *(dBegin++);
duplicatedValue = *(vBegin++);
    }


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: some doubt about the the value of noDuplicatedFixing in "ql/index.hpp"

Ferdinando M. Ametrano-3
if one is trying to add again an existing fixing (i.e. same date and
_same_ value) it is just silently ignored.

The noDuplicatedFixing alert is set to false only if trying to add a
different value for an existing fixing.

The noDuplicatedFixing variable should actually be called
noConflictingFixing instead

ciao -- Nando

On Tue, Nov 13, 2012 at 12:16 PM, rage <[hidden email]> wrote:

> hi guys, I have some doubt in the index class when determining the value of
> noDueplicateFixing.  pls help me figure out. thanks!
>
> "ql/index.hpp"
> this is the part that determining weather there is a duplicated value in the
> history:
>
> while (dBegin != dEnd) {
>                 validFixing = isValidFixingDate(*dBegin);
>                 Real currentValue = h[*dBegin];
>                 missingFixing= forceOverwrite ||
> close(currentValue,nullValue);
>                 if (validFixing) {
>                     if (missingFixing)
>                         h[*(dBegin++)] = *(vBegin++);
>                     else if (close(currentValue,*(vBegin))) {
>                         ++dBegin;
>                         ++vBegin;
>                     } else {
>                         noDuplicatedFixing = false;
>                         duplicatedDate = *(dBegin++);
>                         duplicatedValue = *(vBegin++);
>                     }
>                 } else {
>                     noInvalidFixing = false;
>                     invalidDate = *(dBegin++);
>                     invalidValue = *(vBegin++);
>                 }
>             }
>
> ------>I think this snippet has some problem
>     else if (close(currentValue,*(vBegin))) {
> ++dBegin;
> ++vBegin;
>     } else {
> noDuplicatedFixing = false;
> duplicatedDate = *(dBegin++);
> duplicatedValue = *(vBegin++);
>     }
>
> ----->I think it should look like this:
>     else if (close(currentValue,*(vBegin))) {
> noDuplicatedFixing = false;
> duplicatedDate = *(dBegin++);
> duplicatedValue = *(vBegin++);
>     }
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users