bet 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -9
- data/lib/bet.rb +1 -0
- data/lib/bet/calc.rb +2 -2
- data/lib/bet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 253843bce1b84ca7f1dd411f69604bb009a044ff
|
4
|
+
data.tar.gz: f1c14ea51af572cd7d2ecc17ebed818dba27c0c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e1decc9d39a829bb2c5be349c133985e6c117ee52ba846118666f90be2ea431c35574973c3a5c4c6993be842d284f32a5dfb834b680d8e87a396516cdc20b18
|
7
|
+
data.tar.gz: f3fec497e66ba3612ea3206da252dda005ac1333cd5af5b18798487fe9d3cfe21f31de0656fd1f0c38d367d9d1e3d7d5a28570469dcdc5c7480beee1619cb64e
|
data/README.md
CHANGED
@@ -28,13 +28,13 @@ Bet::Calc.block # 9 selections (502 bets)
|
|
28
28
|
Bet::Calc.full_cover(prices, min_size: 2)
|
29
29
|
|
30
30
|
# types of complete full cover (inc. singles)
|
31
|
-
Bet::Calc.patent # 3 selections (
|
32
|
-
Bet::Calc.lucky15 # 4 selections (
|
33
|
-
Bet::Calc.lucky31 # 5 selections (
|
34
|
-
Bet::Calc.lucky63 # 6 selections (
|
35
|
-
Bet::Calc.super_heinz_with_singles # 7 selections (
|
36
|
-
Bet::Calc.goliath_with_singles # 8 selections (
|
37
|
-
Bet::Calc.block_with_singles # 9 selections (
|
31
|
+
Bet::Calc.patent # 3 selections (7 bets)
|
32
|
+
Bet::Calc.lucky15 # 4 selections (15 bets)
|
33
|
+
Bet::Calc.lucky31 # 5 selections (31 bets)
|
34
|
+
Bet::Calc.lucky63 # 6 selections (63 bets)
|
35
|
+
Bet::Calc.super_heinz_with_singles # 7 selections (127 bets)
|
36
|
+
Bet::Calc.goliath_with_singles # 8 selections (235 bets)
|
37
|
+
Bet::Calc.block_with_singles # 9 selections (511 bets)
|
38
38
|
Bet::Calc.full_cover(prices, min_size: 1) # 1 is default, option can be omitted
|
39
39
|
```
|
40
40
|
|
@@ -45,6 +45,11 @@ Some examples for the good folks of github and beyond:
|
|
45
45
|
# of price and win/price/loss representation, here's array format:
|
46
46
|
Bet::Calc.single(1.2) # or .single([1.2])
|
47
47
|
# => {:returns=>1.2, :profit=>0.19999999999999996, :outlay=>1}
|
48
|
+
# you'll notice the float imprecision, if you want accurate floating
|
49
|
+
# point calculations use BigDecimal:
|
50
|
+
require 'bigdecimal'
|
51
|
+
Bet::Calc.single(BigDecimal.new('1.2'))[:returns].to_f
|
52
|
+
# => 1.2
|
48
53
|
|
49
54
|
Bet::Calc.double([1.2, 5.3])
|
50
55
|
# => {:returns=>6.359999999999999, :profit=>5.359999999999999, :outlay=>1}
|
@@ -53,6 +58,7 @@ Bet::Calc.double([1.2, 5.3])
|
|
53
58
|
# the symbolic format for the win/place/loss result
|
54
59
|
{ -1 => :loss, 0 => :place, 1 => :win }
|
55
60
|
|
61
|
+
# format is price => result
|
56
62
|
Bet::Calc.yankee({ 2.3 => :win, 1.2 => :place, 4.5 => :loss, 11.0 => :win })
|
57
63
|
# => {:returns=>25.299999999999997, :profit=>14.299999999999997, :outlay=>11}
|
58
64
|
|
@@ -64,11 +70,10 @@ Bet::Calc.yankee({ 2.3 => :win, 1.2 => :place, 4.5 => :loss, 11.0 => :win }, sta
|
|
64
70
|
|
65
71
|
## Todo
|
66
72
|
|
67
|
-
1. Use big decimal instead of float 'cus float imprecision innit
|
68
73
|
1. Implement each way bets properly
|
69
74
|
2. Add dutching and shit like that
|
70
75
|
3. Maybe implement support for other price formats (fractional & 'murican)
|
71
|
-
|
76
|
+
4. Write tests
|
72
77
|
|
73
78
|
## Contributing
|
74
79
|
|
data/lib/bet.rb
CHANGED
data/lib/bet/calc.rb
CHANGED
@@ -14,8 +14,8 @@ module Bet
|
|
14
14
|
|
15
15
|
attr_accessor :returns, :profit, :outlay
|
16
16
|
|
17
|
-
def initialize(bet_type,
|
18
|
-
@returns, @profit, @outlay = send(bet_type,
|
17
|
+
def initialize(bet_type, *args)
|
18
|
+
@returns, @profit, @outlay = self.class.send(bet_type, *args).values
|
19
19
|
end
|
20
20
|
|
21
21
|
class << self
|
data/lib/bet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|