Skip to content

Commit

Permalink
Increased test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Koutanov committed Jan 19, 2024
1 parent daea2af commit ee65d0c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion App/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Overround;

double[] fairPrices = [1 / 0.1, 1 / 0.2, 1 / 0.3, 1 / 0.4];
double[] fairPrices = [1 / 0.01, 1 / 0.29, 1 / 0.3, 1 / 0.4];
double fairBooksum = Booksum.FromPrices(fairPrices);
Console.WriteLine("fair prices: [{0}]", string.Join(", ", fairPrices));
Console.WriteLine("fair booksum: {0}", fairBooksum);
Expand Down
2 changes: 1 addition & 1 deletion Overround/OddsRatio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class OddsRatio : IOverroundMethod
private const double ErrorThreshold = 1e-6;
private const int MaxIterations = 100;

static double[] ComputeOdds(double[] fairPrices, double g)
private static double[] ComputeOdds(double[] fairPrices, double g)
{
double[] odds = new double[fairPrices.Length];
for (int i = 0; i < fairPrices.Length; i++)
Expand Down
4 changes: 2 additions & 2 deletions Overround/Power.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public class Power : IOverroundMethod
private const double ErrorThreshold = 1e-6;
private const int MaxIterations = 100;

static double GetInitEstimate(double overround, int numOutcomes)
private static double GetInitEstimate(double overround, int numOutcomes)
{
return 1 + Math.Log(1 / overround) / Math.Log(numOutcomes);
}

static double[] ComputeOdds(double[] fairPrices, double k)
private static double[] ComputeOdds(double[] fairPrices, double k)
{
double[] odds = new double[fairPrices.Length];
for (int i = 0; i < fairPrices.Length; i++)
Expand Down
4 changes: 2 additions & 2 deletions Overround/Solver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public static Solution Solve(double initEstimate, double initStep, double errorT
double lastError = lossFunc(initEstimate);
if (lastError < errorThreshold)
{
return new Solution(initEstimate, errorThreshold, 1);
return new Solution(initEstimate, lastError, 1);
}

double lastEstimate = initEstimate;
double step = initStep;
int iteration = 1;
int iteration = 2;
while (true)
{
double estimate = lastEstimate + step;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
===
[![Build Status](https://img.shields.io/github/actions/workflow/status/kindredgroup/overround-methods/dotnet.yml?branch=master&style=flat-square&logo=github)](https://github.com/kindredgroup/overround-methods/actions/workflows/dotnet.yml)

A collection of overround application methods: Multiplicative, Additive, Power and Odds-Ratio.
A collection of overround application methods: _Multiplicative_, _Additive_, _Power_ and _Odds-Ratio_.

# Examples
```csharp
Expand Down

0 comments on commit ee65d0c

Please sign in to comment.