alphapoint 0.1.4.3 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/alphapoint.rb +1 -1
- data/lib/alphapoint/get_quotes.rb +4 -8
- data/lib/alphapoint/version.rb +1 -1
- data/lib/alphapoint/web_socket.rb +11 -10
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6579d4e9ff2805e5330841242cfcce929b19fcf9
|
4
|
+
data.tar.gz: 04ed97aa5a795c0ae0a1461f2421ce0c0298f7f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55b1a7ebd547467b22dc014e027f08c1bb656771f6a800c8282d2f73fd892d2bbb08ecacb4fdf43624f27a44284c26183e8094d4de1bbef609486d4c8aefc64c
|
7
|
+
data.tar.gz: 6a4637c9f3c66acf927f9ebd3c4dbbe8346ed8d75f5ca319d2b64e1c2ad08660f791587e29edf58ca681be3378d1296a63f94b09217d23a99e1b62e3a132c1e4
|
data/lib/alphapoint.rb
CHANGED
@@ -12,16 +12,12 @@ module Alphapoint
|
|
12
12
|
|
13
13
|
def execute(payload, &block)
|
14
14
|
@ws.get_instruments(payload) do |res|
|
15
|
-
|
16
15
|
res.each do |inst|
|
17
16
|
payloadSub = payload.merge({ InstrumentId: inst['InstrumentId'] })
|
18
17
|
@ws.subscribe_level1(payloadSub) do |ticker|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
@data << ticker.merge(inst)
|
23
|
-
@count += 1
|
24
|
-
end
|
18
|
+
@data << ticker.merge(inst)
|
19
|
+
@count += 1
|
20
|
+
block.call(@data) if res.size == @count
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|
@@ -29,4 +25,4 @@ module Alphapoint
|
|
29
25
|
|
30
26
|
end
|
31
27
|
|
32
|
-
end
|
28
|
+
end
|
data/lib/alphapoint/version.rb
CHANGED
@@ -3,14 +3,15 @@ require 'json'
|
|
3
3
|
module Alphapoint
|
4
4
|
|
5
5
|
class WebSocket
|
6
|
-
|
6
|
+
|
7
7
|
attr_accessor :address
|
8
8
|
|
9
9
|
def initialize(address = nil, &block)
|
10
|
-
if Alphapoint.configuration.nil? ||
|
10
|
+
if (Alphapoint.configuration.nil? ||
|
11
11
|
Alphapoint.configuration.address.nil? ||
|
12
|
-
|
13
|
-
|
12
|
+
Alphapoint.configuration.address.empty?) &&
|
13
|
+
address.nil?
|
14
|
+
raise AlphapointError, "Pass or configure an address to conect on WebSocket"
|
14
15
|
end
|
15
16
|
|
16
17
|
@ws = nil
|
@@ -27,7 +28,7 @@ module Alphapoint
|
|
27
28
|
"GetOrderFee"
|
28
29
|
]
|
29
30
|
@response = {}
|
30
|
-
|
31
|
+
|
31
32
|
@unsub_actions = []
|
32
33
|
|
33
34
|
alpha_self = self
|
@@ -55,7 +56,7 @@ module Alphapoint
|
|
55
56
|
|
56
57
|
trap(:INT) { EM.stop }
|
57
58
|
trap(:TERM){ EM.stop }
|
58
|
-
|
59
|
+
|
59
60
|
while not EM.reactor_running?; end
|
60
61
|
while not EM.defers_finished?; end
|
61
62
|
end
|
@@ -87,7 +88,7 @@ module Alphapoint
|
|
87
88
|
|
88
89
|
def get_quotes(payload = { OMSId: 1 }, &block)
|
89
90
|
wait_handshake
|
90
|
-
|
91
|
+
|
91
92
|
quotes = Alphapoint::GetQuotes.new(self)
|
92
93
|
|
93
94
|
quotes.execute(payload) do |res|
|
@@ -97,7 +98,7 @@ module Alphapoint
|
|
97
98
|
|
98
99
|
def method_missing(m, *args, &block)
|
99
100
|
wait_handshake
|
100
|
-
|
101
|
+
|
101
102
|
function_name = m.to_s.camelcase
|
102
103
|
respond_action = @avaliable_functions.select{ |func| func == function_name }
|
103
104
|
if respond_action.size > 0
|
@@ -113,11 +114,11 @@ module Alphapoint
|
|
113
114
|
raise "Method #{m} not implemented yet"
|
114
115
|
end
|
115
116
|
end
|
116
|
-
|
117
|
+
|
117
118
|
private
|
118
119
|
def wait_handshake
|
119
120
|
sleep(0.5)
|
120
121
|
end
|
121
122
|
end # End Class
|
122
123
|
|
123
|
-
end # End Module
|
124
|
+
end # End Module
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alphapoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabiano Martins
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-08-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -134,6 +134,20 @@ dependencies:
|
|
134
134
|
- - ">="
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: 0.12.2
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: byebug
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 11.0.1
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 11.0.1
|
137
151
|
- !ruby/object:Gem::Dependency
|
138
152
|
name: guard-rspec
|
139
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
207
|
version: '0'
|
194
208
|
requirements: []
|
195
209
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.2.2
|
197
211
|
signing_key:
|
198
212
|
specification_version: 4
|
199
213
|
summary: Alphapoint websocket DSL
|