Hi all;
In Python the History() data has a call to drop entries with a NAN in them. In C# this does not seem to exist so I need to look at each individual TradeBar object.
However TradeBad.Open is decimal, not nullable decimal. So what value does it return if it doesn't actually have that data? -1?
Same question for the rest of oHLCV?
thanks - dave
Fred Painchaud
Hi Dave,
I skimmed over code so it's not 100% sure here but I've seen things like this:
return History(requests.Where(x => x != null)).Get<T>().Memoize();
My little finger tells me that when there is no data, the bar is simply removed. So you can have gaps. Maybe those gaps can be filled with previous values depending on the “fill param”.
Fred
David Thielen
Hi Fred;
I looked at the code too and I didn't see any way to set that the data was null/NaN. So I agree with you that that's what it looks like.
But I'm hoping someone who knows for sure can verify this (or tell us we're wrong). My worry is if I'm wrong on this, I could have code that makes an incorrect trading decision because it believes an invalid number.
thanks - dave
Fred Painchaud
Hi David,
In the meantime, if you are anxious about it, you can make sure that the price you're trading is not ≤ 0.0 and not NaN. It cannot be null by the type system. Outside of those boundaries, chances that it is wrong are very very small - it would then only be an invalid data point in terms of data feeds. Which, if you also fear those, would need additional code to detect across the board anyway…
Fred
David Thielen
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!