intrinio-realtime 3.1.2 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/intrinio-realtime.rb +9 -5
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 230f6b829df617dbc89057d3b413e8e72ab9f1ce54cbfd40962beba8649b7fc8
4
- data.tar.gz: f4f9ddf1279d94b2533ff37badd573c99323db4ad03b513251a3c688ab196bee
3
+ metadata.gz: df8c1b4a01075b66f59dd7f6fda2daa1f7b3cc1eb395f9016206d6cffe13d8bc
4
+ data.tar.gz: e1d255b939ed7fa3a27f7eea2cc35fccfaec8b82cb0265d9cab326017685525f
5
5
  SHA512:
6
- metadata.gz: b07b66332b3e1ed14c506db140e7d3bd87d239c9e8868663a53442b76ec34178ee57add42bc13549e085cfbfad2cdf86927aa00f92b619a532feda517fdebb49
7
- data.tar.gz: e1696ccdc4a6e4c037c84dd7f9e0ac5def100d974cdf286dad45a098a6cdf0007eed911237ae698b975f37941eddffb2e59947d0bab698ac2fddd78fd230671d
6
+ metadata.gz: fdc6916b86b3823144c2f9d1b1d4905d9c9af4022e229b0a9ece88a9b639fb5ac3bdb8ae44ebce9cec5aed8ab01e6932cd9ed683e2149724ec9b43893b86f02f
7
+ data.tar.gz: cfda64741414b456b33244dbcdfe67ad0ee9e604984dbee9f6c1f13bb08d0373714b7d94ef592e17db978092e10c40247a8dae9064f2745475c3f5a9b3aa5832
@@ -251,9 +251,13 @@ module Intrinio
251
251
  data.map { |i| [sprintf('%02x',i)].pack('H2') }.join.unpack('V').first
252
252
  end
253
253
 
254
+ def parse_float32(data)
255
+ data.map { |i| [sprintf('%02x',i)].pack('H2') }.join.unpack('e').first
256
+ end
257
+
254
258
  def parse_trade(data, start_index, symbol_length)
255
259
  symbol = data[start_index + 2, symbol_length].map!{|c| c.chr}.join
256
- price = parse_int32(data[start_index + 2 + symbol_length, 4]).to_f / 10000.0
260
+ price = parse_float32(data[start_index + 2 + symbol_length, 4])
257
261
  size = parse_uint32(data[start_index + 6 + symbol_length, 4])
258
262
  timestamp = parse_uint64(data[start_index + 10 + symbol_length, 8])
259
263
  total_volume = parse_uint32(data[start_index + 18 + symbol_length, 4])
@@ -263,7 +267,7 @@ module Intrinio
263
267
  def parse_quote(data, start_index, symbol_length, msg_type)
264
268
  type = case when msg_type == 1 then ASK when msg_type == 2 then BID end
265
269
  symbol = data[start_index + 2, symbol_length].map!{|c| c.chr}.join
266
- price = parse_int32(data[start_index + 2 + symbol_length, 4]).to_f / 10000.0
270
+ price = parse_float32(data[start_index + 2 + symbol_length, 4])
267
271
  size = parse_uint32(data[start_index + 6 + symbol_length, 4])
268
272
  timestamp = parse_uint64(data[start_index + 10 + symbol_length, 8])
269
273
  return Quote.new(type, symbol, price, size, timestamp)
@@ -326,7 +330,7 @@ module Intrinio
326
330
  http.use_ssl = true if (auth_url.include?("https"))
327
331
  http.start
328
332
  request = Net::HTTP::Get.new(uri.request_uri)
329
- request.add_field("Client-Information", "IntrinioRealtimeRubySDKv3.1")
333
+ request.add_field("Client-Information", "IntrinioRealtimeRubySDKv4.0")
330
334
 
331
335
  unless @api_key
332
336
  request.basic_auth(@username, @password)
@@ -366,8 +370,8 @@ module Intrinio
366
370
 
367
371
  def socket_url
368
372
  case @provider
369
- when REALTIME then URI.escape("wss://realtime-mx.intrinio.com/socket/websocket?vsn=1.0.0&token=#{@token}")
370
- when MANUAL then URI.escape("ws://" + @ip_address + "/socket/websocket?vsn=1.0.0&token=#{@token}")
373
+ when REALTIME then "wss://realtime-mx.intrinio.com/socket/websocket?vsn=1.0.0&token=#{@token}"
374
+ when MANUAL then "ws://" + @ip_address + "/socket/websocket?vsn=1.0.0&token=#{@token}"
371
375
  end
372
376
  end
373
377
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intrinio-realtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Intrinio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: 1.4.0
69
69
  description: Intrinio Ruby SDK for Real-Time Stock Prices
70
70
  email:
71
- - ssnyder@intrinio.com
71
+ - admin@intrinio.com
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.2.15
96
+ rubygems_version: 3.1.6
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Intrinio provides real-time stock prices from its Multi-Exchange feed, via