cotcube-dataproxy 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/VERSION +1 -1
- data/lib/cotcube-dataproxy/3rd_clients.rb +2 -2
- data/lib/cotcube-dataproxy/client_response.rb +3 -3
- data/lib/cotcube-dataproxy/commserver.rb +6 -0
- data/lib/cotcube-dataproxy/subscribers.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82334ed8c2a2bdb18dd9a0338d24867bfb6477b648d10fd51439fcfa7503c298
|
4
|
+
data.tar.gz: 8104e6d40180b2738507abadd1422288cfd2e60220e7d10c5dbf78ede6f0387a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8b14427fb654780a1653348d31e9ecc3e65fe5f9d04b5508f625a77a42c7c633165a059705175b4199633887e3bb3cd8f38c2f090c698399117e32606d1692b
|
7
|
+
data.tar.gz: 0d77a939e81396c754c39a5e3d74d9bcad075c0875b20ca006f0a50388efe1e850a157830d82d9161d17270134493d34ac2f3e1250ac9a5ba0b7838fdcad5693
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.1.2 (November 28, 2021)
|
2
|
+
- subscribers/historical: returning improved values hash
|
3
|
+
- added validator for contract to sub historical
|
4
|
+
- client_response: improvied log output
|
5
|
+
- 3rd-clients: removed auto-delete (due to working GC)
|
6
|
+
|
1
7
|
## 0.1.1 (November 13, 2021)
|
2
8
|
- added handy test_script in bin/test_client.rb
|
3
9
|
- added httparty to Gem requirements
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -47,8 +47,8 @@ module Cotcube
|
|
47
47
|
obj[:commands] = obj[:connection].create_channel
|
48
48
|
obj[:channel] = obj[:connection].create_channel
|
49
49
|
obj[:request_queue] = obj[:commands].queue('', exclusive: true, auto_delete: true)
|
50
|
-
obj[:request_exch] = obj[:commands].direct('dataproxy_commands'
|
51
|
-
obj[:replies_exch] = obj[:commands].direct('dataproxy_replies'
|
50
|
+
obj[:request_exch] = obj[:commands].direct('dataproxy_commands')
|
51
|
+
obj[:replies_exch] = obj[:commands].direct('dataproxy_replies')
|
52
52
|
%w[ dataproxy_commands ].each do |key|
|
53
53
|
obj[:request_queue].bind(obj[:request_exch], routing_key: key )
|
54
54
|
end
|
@@ -27,11 +27,11 @@ module Cotcube
|
|
27
27
|
response = { error: 1, msg: "Processing failed for '#{msg.inspect}' after '#{request}'." }
|
28
28
|
end
|
29
29
|
if response[:error] == 1
|
30
|
-
log "CLIENT #{
|
30
|
+
log "CLIENT #{__id__} FAILIURE: #{response.inspect}.".colorize(:light_red)
|
31
31
|
elsif response[:result].is_a?(Array)
|
32
|
-
log "CLIENT #{
|
32
|
+
log "CLIENT #{__id__} SUCCESS: sent #{response[:result].size} datasets."
|
33
33
|
else
|
34
|
-
log "CLIENT #{
|
34
|
+
log "CLIENT #{__id__} SUCCESS: #{response.to_s[..220].scan(/.{1,120}/).join(' '*30 + "\n")}"
|
35
35
|
end
|
36
36
|
mq[exchange].publish(
|
37
37
|
response.to_json,
|
@@ -75,6 +75,10 @@ module Cotcube
|
|
75
75
|
# the IB message 'HistoricalData' in message subscribers section
|
76
76
|
#
|
77
77
|
when Cotcube::Helpers.sub(minimum: 3) {'historical'}
|
78
|
+
unless request[:contract].is_a? String and request[:contract].size == 5
|
79
|
+
client_fail(request) { "IB needs complete contract information to request data, e.g. ESZ21 instead of ES, got '#{request[:contract]}' in '#{request}'." }
|
80
|
+
next
|
81
|
+
end
|
78
82
|
con_id = request[:con_id] || Cotcube::Helpers.get_ib_contract(request[:contract])[:con_id] rescue nil
|
79
83
|
if con_id.nil? or request[:contract].nil?
|
80
84
|
client_fail(request) { "Cannot get :con_id for contract:'#{request[:contract]}' in '#{request}'." }
|
@@ -85,6 +89,8 @@ module Cotcube
|
|
85
89
|
ib_contract = IB::Contract.new(con_id: con_id, exchange: sym[:exchange])
|
86
90
|
req = {
|
87
91
|
request_id: request[:__id__].to_i(16),
|
92
|
+
symbol: sym[:symbol],
|
93
|
+
sym: sym,
|
88
94
|
contract: ib_contract,
|
89
95
|
end_date_time: before,
|
90
96
|
what_to_show: (request[:based_on] || :trades),
|
@@ -39,7 +39,15 @@ module Cotcube
|
|
39
39
|
case msg
|
40
40
|
|
41
41
|
when IB::Messages::Incoming::HistoricalData
|
42
|
-
client_success(requests[__id__]) {
|
42
|
+
client_success(requests[__id__]) {
|
43
|
+
{
|
44
|
+
symbol: requests[__id__][:contract][..1],
|
45
|
+
contract: requests[__id__][:contract],
|
46
|
+
base: msg.results.map{|z|
|
47
|
+
z.attributes.tap{|z1| z1.delete(:created_at) }
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
43
51
|
req_mon.synchronize { requests.delete(__id__) }
|
44
52
|
|
45
53
|
when IB::Messages::Incoming::Alert # Alert
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cotcube-dataproxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin L. Tischendorf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|