gekko 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1b7c4b20f6c578aec5aad59b627a88e872e2574
4
- data.tar.gz: 71129f7815fba7b9117ea3cad2e096f1f10f2da3
3
+ metadata.gz: 8cf2cb80bfc23dcc6c05dac3a409d44574dcd59f
4
+ data.tar.gz: 3eb2736847e4a221a1814323bea545345d1e0b2b
5
5
  SHA512:
6
- metadata.gz: f2f58be1cfe7cd1e0855783def9d495aa973a487512902ab86227f1990b0353bd11793a6494b53af99638c55558f072ce5652b5d65185c917966d1298c83cf35
7
- data.tar.gz: bdfdaca149bc21b996bd51d5758870dde8b915f822697985872f1aa18720f0758983fbef5510b07fb8618a32bb18caf6217881254420979b5a17d292411e950d
6
+ metadata.gz: c26c1cd1af9ee8d5b0486858eb4cab36e69d126012587498301cb7401ae6509ff5bde5ab8cace6ad5d21fa4356ec0d8602aca8b4afb7fe739d59fb119aa5eb51
7
+ data.tar.gz: 80ad3f351edf88c9f12c429c5eb265f3d4e549ac4a029b34c050332b17679a1719d90b0de698c3503801308238b3ac93554a163c574a68cf3b622c02c570278f
@@ -38,6 +38,19 @@ module Gekko
38
38
  cmp
39
39
  end
40
40
 
41
+ #
42
+ # Initializes a +Gekko::LimitOrder+ subclass from a +Hash+ instance
43
+ #
44
+ # @param hsh [Hash] The order data
45
+ # @return [Gekko::LimitOrder] A limit order
46
+ #
47
+ def self.from_hash(hsh)
48
+ order = LimitOrder.new(hsh[:side], UUID.parse(hsh[:id]), hsh[:size], hsh[:price], hsh[:expiration])
49
+ order.remaining = hsh[:remaining]
50
+ order.created_at = hsh[:created_at] if hsh[:created_at]
51
+ order
52
+ end
53
+
41
54
  end
42
55
  end
43
56
 
@@ -39,6 +39,18 @@ module Gekko
39
39
  (bid? && remaining_quote_margin.zero?)
40
40
  end
41
41
 
42
+ #
43
+ # Initializes a +Gekko::MarketOrder+ subclass from a +Hash+ instance
44
+ #
45
+ # @param hsh [Hash] The order data
46
+ # @return [Gekko::MarketOrder] A market order
47
+ #
48
+ def self.from_hash(hsh)
49
+ order = MarketOrder.new(hsh[:side], UUID.parse(hsh[:id]), hsh[:size], hsh[:quote_margin], hsh[:expiration])
50
+ order.created_at = hsh[:created_at] if hsh[:created_at]
51
+ order
52
+ end
53
+
42
54
  end
43
55
  end
44
56
 
@@ -132,14 +132,7 @@ module Gekko
132
132
  # @return [Gekko::Order] A trade order
133
133
  #
134
134
  def self.from_hash(hsh)
135
- order = if hsh[:price]
136
- LimitOrder.new(hsh[:side], UUID.parse(hsh[:id]), hsh[:size], hsh[:price], hsh[:expiration])
137
- else
138
- MarketOrder.new(hsh[:side], UUID.parse(hsh[:id]), hsh[:size], hsh[:quote_margin], hsh[:expiration])
139
- end
140
-
141
- order.created_at = hsh[:created_at] if hsh[:created_at]
142
- order
135
+ (hsh[:price] ? LimitOrder : MarketOrder).from_hash(hsh)
143
136
  end
144
137
 
145
138
  end
@@ -1,6 +1,6 @@
1
1
  module Gekko
2
2
 
3
3
  # The Gekko version string
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.1'
5
5
 
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gekko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David FRANCOIS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uuidtools