SPARK-1776 / SPARK-1785 LadderRender - skip volumes with nan prices

This commit is contained in:
John Colvin committed 2018-10-14 18:07:05 -05:00
1 parent d662a60f6a
commit ee25d3ed9a
1 file changed
+6 -4
@@ -232,13 +232,15 @@ namespace mbts.spark {
return;
int curr_index = origin_index;
double curr_price = prices[origin_index];
foreach (var pd in data) {
foreach (var (price, value) in data) {
if (double.IsNaN(price))
continue;
// prices are in descending order, so get diff from curr_price - price
int tick_diff = spec.tickdiff(curr_price, pd.price) ?? 0;
int tick_diff = spec.tickdiff(curr_price, price) ?? 0;
curr_index += tick_diff;
curr_price = pd.price;
curr_price = price;
if (curr_index >= 0 && curr_index < prices.Length) {
render_cell(dc, curr_index, pd.value);
render_cell(dc, curr_index, value);
} else break;
}
}