openpredictionmarkets / socialpredict

Easy to Deploy Prediction Market Platform
https://github.com/openpredictionmarkets/socialpredict
MIT License
54 stars 10 forks source link

Update tests for probabilities and change how the economics config is loaded and passed. #284

Closed ajlacey closed 3 weeks ago

ajlacey commented 1 month ago

First, my apologies for the size of this PR, I can split it up if that's better for reviewing.

What this PR does: updates the setup file to have MustLoadEconomicsConfig instead of LoadEconomicsConfig. This function is then used across handler init()'s and in the handler functions (more updates are needed here, but I think that should be for a future effort). The must function will either load the config or log a fatal error and close the application. This is was already being done across handlers, but now it is consolidated with the actual loading of the config.

Adds the ability to calculate a market probability at a point in time based on the starting conditions and the current yes/no tally. Adds corresponding tests for calculating market probabilities

Moves tests for wpam market probabilities to the wpam package and adds the dependency injection needed to test this function.

pwdel commented 3 weeks ago

@ajlacey Tried to merge from main, there are conflicts. I didn't want to reverse anything that you have done.

ajlacey commented 3 weeks ago

I think I messed up the merge. I have no idea why frontend changes are being show in the PR, so I'm just going to start over at this point...