Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'socket'
- $my_socket = '/tmp/proxy-client'
- class ProxyClass
- private_class_method :new
- @@proxy_con = nil
- def ProxyClass.create
- @@proxy_con = UNIXSocket.open($my_socket) unless @@proxy_con
- @@proxy_con
- end
- end
- connection_object = ProxyClass.create
- on_high_quotes = Array.new(5,Array.new(3))
- i = 0
- on_high_symbols = ['CTS','IBM','INFY','ABBI','DELL']
- on_high_symbols.each do |x|
- sym = '310<'+x+'>'
- connection_object.send(sym,0)
- qvalue = connection_object.recvfrom(124)[0]
- qvalue = qvalue.gsub(/[<>]/,'|')
- on_high_quotes[i][0] = qvalue.split('|')[2]
- on_high_quotes[i][1] = qvalue.split('|')[12]
- prev_val = qvalue.split('|')[11].to_f
- on_high_quotes[i][2] = ((on_high_quotes[i][0].to_f- prev_val)*100)/on_high_quotes[i][0].to_f
- puts on_high_quotes[i][0]
- i = i + 1
- end
- puts on_high_quotes[0][0]
Add Comment
Please, Sign In to add comment