Issue in isValid() function
This happened when I was trying to send a limit order in live market where isValid() returned false for DEFAULTDOUBLE as defined in the project.
For reproducing the issue checkout https://github.com/kushsharma2910/tmp-cppkiteconnect-bug-check/tree/nullValsComp.
It seems that use of comparison operator == returns false value. Instead using std::isnan() function of the cmath library gives the correct output.
Could you please take a look? Maybe I am missing something here.
I am using c++11 on ubuntu 20.
Hey. thank you for reporting this. I'll take a look and update here.
Unfortunately, IIRC, std::isnan() gives compilation errors on Windows. I'll have to find some other way.
#44 should work as long as the compiler doesn't optimize the comparison. I realize this is fragile but right now, it seems to be the best way to move forward without dropping Windows support or doing a big (and breaking) change.
Just to understand, according to the usage, we want to return true if default value was passed. for eg.
if (!isValid(price)) { bodyParams.emplace_back("price", std::to_string(price)); }
but now, I think, the condition would flip. I am missing something?
You seem to be correct. I'll check this.
This will be fixed in v2.
isValid is phased out in v2.