atlasats 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/atlasats.rb +17 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGNjMTYyNzhiZDA0YmJlYWYxNDZjMDc0OWZiNmM1YTlkNmMwMTkxMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTNhNDJkZjA2M2ZkNzM1Yzk3NjRlZjQ1ODAxYzliNDViMjgzOGMzOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjljZjZmYWE2OGZhYzU4ZTY1MWY5NWExMzhlMTUzMTFiZmMzMzEyODIyY2My
|
10
|
+
MDNmODg4M2I4MmVmZTM4ZGIwNWQ2N2ZlZDc1YmQ3YmFjYzA1ZmFkMzRhNmEx
|
11
|
+
YWQ4ZTA5MmY4YTE3OGZiYjNiZTQ0OWYzNGUxNzFiN2FiOTllM2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWQ4MTRiMzYwZTdhMjZjN2JlMDBhNDJmYTBmZGI1NzY1ZDI1NzQzODYwMjhm
|
14
|
+
MTRhNGQwY2NiZjRmZjliMjE4NzEzNzk2YjYyMzI5OGRjMTUyMDExMzJhMjNh
|
15
|
+
N2Q3OWM0ODRhYzdjMTU3ZjNmZWE2YmVkMGU1YTliNzRjZDIzMDE=
|
data/lib/atlasats.rb
CHANGED
@@ -77,25 +77,32 @@ class AtlasClient
|
|
77
77
|
end
|
78
78
|
|
79
79
|
# market data
|
80
|
-
def
|
80
|
+
def subscribe_trades(&block)
|
81
81
|
Thread.new do
|
82
82
|
EM.run {
|
83
83
|
client = Faye::Client.new("#{@baseuri}:4000/api")
|
84
|
-
client.subscribe("/
|
85
|
-
|
84
|
+
client.subscribe("/trades") do |msg|
|
85
|
+
begin
|
86
|
+
pmsg = JSON.parse(msg)
|
87
|
+
block.call(msg)
|
88
|
+
rescue Exception
|
89
|
+
block.call({ :error => "Unable to parse message", :raw => msg })
|
90
|
+
end
|
86
91
|
end
|
87
92
|
}
|
88
93
|
end
|
89
94
|
end
|
90
|
-
|
91
|
-
def subscribe_trades(&block)
|
95
|
+
|
96
|
+
def subscribe_trades(item, currency, &block)
|
92
97
|
Thread.new do
|
93
98
|
EM.run {
|
94
99
|
client = Faye::Client.new("#{@baseuri}:4000/api")
|
95
100
|
client.subscribe("/trades") do |msg|
|
96
101
|
begin
|
97
102
|
pmsg = JSON.parse(msg)
|
98
|
-
|
103
|
+
if pmsg["symbol"] == item and pmsg["currency"] == currency
|
104
|
+
block.call(msg)
|
105
|
+
end
|
99
106
|
rescue Exception
|
100
107
|
block.call({ :error => "Unable to parse message", :raw => msg })
|
101
108
|
end
|
@@ -108,11 +115,13 @@ class AtlasClient
|
|
108
115
|
Thread.new do
|
109
116
|
EM.run {
|
110
117
|
client = Faye::Client.new("#{@baseuri}:4000/api")
|
111
|
-
client.subscribe("/market
|
118
|
+
client.subscribe("/market") do |msg|
|
112
119
|
pmsg = nil
|
113
120
|
begin
|
114
121
|
pmsg = JSON.parse(msg)
|
115
|
-
|
122
|
+
if pmsg["symbol"] == item and pmsg["currency"] == currency
|
123
|
+
block.call(pmsg)
|
124
|
+
end
|
116
125
|
rescue Exception
|
117
126
|
block.call({ :error => "Unable to parse message", :raw => msg })
|
118
127
|
end
|