ladder - fix size_from_row null ref
This commit is contained in:
1 parent
d6a310c5b5
commit
e7348cb2bb
1 file changed
+7
-3
@@ -153,8 +153,10 @@ namespace mbts.spark {
|
||||
internal double price_for_point(Point point) =>
|
||||
_price_for_row(_row_for_point(point));
|
||||
|
||||
static ushort? _size_from_row(int row, double[] price_list, NativePriceSize[] depth, ContractSpecificationImmutable spec) =>
|
||||
row <= price_list.Length ? _size_from_price(price_list[row], depth, spec) : null;
|
||||
static ushort? _size_from_row(int row, double[] price_list, NativePriceSize[] depth, ContractSpecificationImmutable spec) {
|
||||
if (price_list == null) return null;
|
||||
else return row <= price_list.Length ? _size_from_price(price_list[row], depth, spec) : null;
|
||||
}
|
||||
|
||||
static ushort? _size_from_price(double price, NativePriceSize[] depth, ContractSpecificationImmutable spec) =>
|
||||
depth.FirstOrDefault(nps => spec.tick_equals(price, nps.price), nps => new ushort?(nps.size));
|
||||
@@ -164,7 +166,9 @@ namespace mbts.spark {
|
||||
var click_offset = point.Y / _settings.row_height;
|
||||
return (int)(row_offset + click_offset);
|
||||
}
|
||||
double _price_for_row(int row) => _price_list == null ? double.NaN : _price_list[row];
|
||||
|
||||
double _price_for_row(int row) =>
|
||||
_price_list == null ? double.NaN : _price_list[row];
|
||||
|
||||
ushort? _bid_size_from_row(int row) =>
|
||||
_size_from_row(row, _price_list, _bids, _vm.security.ContractSpec);
|
||||
|
||||
Reference in new issue
Block a user