-
Notifications
You must be signed in to change notification settings - Fork 5
/
example_test.go
38 lines (28 loc) · 888 Bytes
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package bfutils_test
import (
"fmt"
"github.com/gustavooferreira/bfutils"
)
// This example, computes the ticks difference between two odds.
func Example_a() {
randomOdd := 4.051
index1, odd1, err := bfutils.OddShift(bfutils.RoundType_Floor, randomOdd, 10)
if err != nil {
panic(err)
}
fmt.Printf("Odd1: %.2f - position in the ladder: %d\n", odd1, index1+1)
index2, odd2, err := bfutils.OddShift(bfutils.RoundType_Floor, randomOdd, -10)
if err != nil {
panic(err)
}
fmt.Printf("Odd2: %.2f - position in the ladder: %d\n", odd2, index2+1)
ticksDiff, err := bfutils.OddsTicksDiff(bfutils.RoundType_Floor, odd1, odd2)
if err != nil {
panic(err)
}
fmt.Printf("Ticks difference between both odds: %d\n", ticksDiff)
// Output:
// Odd1: 5.00 - position in the ladder: 180
// Odd2: 3.50 - position in the ladder: 160
// Ticks difference between both odds: 20
}