refactor: Rename RoundFractionalUnits to snake_case
This commit is contained in:
1 parent
0c4010baab
commit
a7803877e9
3 files changed
+9
-9
No files matched your search
@@ -108,7 +108,7 @@ namespace bts.utils {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static int RoundFractionalUnits(double value, double fractional_unit) =>
|
||||
public static int round_fractional_units(double value, double fractional_unit) =>
|
||||
(int)Math.Round(value / fractional_unit);
|
||||
|
||||
public static double round_down_abs(double value, double margin = epsilon) {
|
||||
|
||||
@@ -160,13 +160,13 @@ namespace mbts {
|
||||
if (x < ltie) {
|
||||
double low_unit_frac = regional_tick.low_tick.tick_unit_frac();
|
||||
if (y < ltie) {
|
||||
return (RoundFractionalUnits(raw_diff, low_unit_frac), 0);
|
||||
return (round_fractional_units(raw_diff, low_unit_frac), 0);
|
||||
} else {
|
||||
double high_unit_frac = regional_tick.high_tick.tick_unit_frac();
|
||||
double low_diff = ltie - x;
|
||||
double high_diff = raw_diff - low_diff;
|
||||
int n_low = RoundFractionalUnits(low_diff, low_unit_frac);
|
||||
int n_high = RoundFractionalUnits(high_diff, high_unit_frac);
|
||||
int n_low = round_fractional_units(low_diff, low_unit_frac);
|
||||
int n_high = round_fractional_units(high_diff, high_unit_frac);
|
||||
return (n_low, n_high);
|
||||
}
|
||||
} else {
|
||||
@@ -175,11 +175,11 @@ namespace mbts {
|
||||
double low_unit_frac = regional_tick.low_tick.tick_unit_frac();
|
||||
double high_diff = x - ltie;
|
||||
double low_diff = raw_diff - high_diff;
|
||||
int n_low = RoundFractionalUnits(low_diff, low_unit_frac);
|
||||
int n_high = RoundFractionalUnits(high_diff, high_unit_frac);
|
||||
int n_low = round_fractional_units(low_diff, low_unit_frac);
|
||||
int n_high = round_fractional_units(high_diff, high_unit_frac);
|
||||
return (n_low, n_high);
|
||||
} else {
|
||||
return (0, RoundFractionalUnits(raw_diff, high_unit_frac));
|
||||
return (0, round_fractional_units(raw_diff, high_unit_frac));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,10 +171,10 @@ namespace mbts.spark {
|
||||
}
|
||||
|
||||
public static bool tick_equals(this ContractSpecificationImmutable contract, double x, double y) =>
|
||||
MathUtils.RoundFractionalUnits(x, contract.LowTick) == MathUtils.RoundFractionalUnits(y, contract.LowTick);
|
||||
MathUtils.round_fractional_units(x, contract.LowTick) == MathUtils.round_fractional_units(y, contract.LowTick);
|
||||
|
||||
public static IEqualityComparer<double> tick_equality_comparer(this ContractSpecificationImmutable contract) =>
|
||||
EqualityComparer.Create((double a, double b) => tick_equals(contract, a, b), x => MathUtils.RoundFractionalUnits(x, contract.LowTick));
|
||||
EqualityComparer.Create((double a, double b) => tick_equals(contract, a, b), x => MathUtils.round_fractional_units(x, contract.LowTick));
|
||||
|
||||
public static int compare_tick_fallback_to_double(this ContractSpecificationImmutable contract, double x, double y) =>
|
||||
tick_equals(contract, x, y) ? 0 : x.CompareTo(y);
|
||||
|
||||
Reference in new issue
Block a user