aboutsummaryrefslogtreecommitdiff
path: root/internal/prediction/market.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/prediction/market.go')
-rw-r--r--internal/prediction/market.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/prediction/market.go b/internal/prediction/market.go
index af74ff9..8fbe8a6 100644
--- a/internal/prediction/market.go
+++ b/internal/prediction/market.go
@@ -138,8 +138,9 @@ func (m Market) Settlement(token string) (float64, bool) {
return p, err == nil
}
-// House quotes are whole credits PER SHARE, not fractional prices rounded only
-// after multiplication. A 42.1-credit quote costs 43 and sells for 42 per share.
+// BuyPrice returns the house buy quote. House quotes are whole credits PER
+// SHARE, not fractional prices rounded only after multiplication. A
+// 42.1-credit quote costs 43 and sells for 42 per share.
func BuyPrice(p float64) int { return int(math.Ceil(math.Nextafter(p*FaceValue, 0))) }
func SellPrice(p float64) int { return int(math.Floor(math.Nextafter(p*FaceValue, math.Inf(1)))) }
func BuyCost(p float64, q int) int { return BuyPrice(p) * q }