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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6f9b353c88cb9743b57d00e3b61b8d87aae036b
4
- data.tar.gz: 276ace1ddd1a161bec48f166e4eb25683435ccdb
3
+ metadata.gz: 253843bce1b84ca7f1dd411f69604bb009a044ff
4
+ data.tar.gz: f1c14ea51af572cd7d2ecc17ebed818dba27c0c0
5
5
  SHA512:
6
- metadata.gz: 711402bf09efb34329022e16e73c03e4632ef4e7ac375ad4c5f8f12cfad94b36e4865548da5524cc1a8f5f260aa50c304b97777e8cc21d8556d989f052229272
7
- data.tar.gz: 9e94aa7d0b8e551dc44443ef9d59a8911f0314789200e03397e28d9650a50cd5452d0c28487bf26c6e1255a3aa34571a6c6cb9d185acf73076a8f7a9ead7af47
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 (4 bets)
32
- Bet::Calc.lucky15 # 4 selections (11 bets)
33
- Bet::Calc.lucky31 # 5 selections (26 bets)
34
- Bet::Calc.lucky63 # 6 selections (57 bets)
35
- Bet::Calc.super_heinz_with_singles # 7 selections (120 bets)
36
- Bet::Calc.goliath_with_singles # 8 selections (247 bets)
37
- Bet::Calc.block_with_singles # 9 selections (502 bets)
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
- 3. Write tests
76
+ 4. Write tests
72
77
 
73
78
  ## Contributing
74
79
 
data/lib/bet.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "bet/version"
2
2
  require "bet/calc"
3
+ require "bet/staking"
3
4
 
4
5
  module Bet
5
6
  end
@@ -14,8 +14,8 @@ module Bet
14
14
 
15
15
  attr_accessor :returns, :profit, :outlay
16
16
 
17
- def initialize(bet_type, opts)
18
- @returns, @profit, @outlay = send(bet_type, opts).values
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
@@ -1,3 +1,3 @@
1
1
  module Bet
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
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.3
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-05-31 00:00:00.000000000 Z
11
+ date: 2015-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler