Need this RUBY code converted into a VB.NET program:
I can provide the username/password.
Deliverables are the VB.NET source code so I can maintain/modify the code and an executable that I can test.
require "uri"
require "http"
require "eventmachine"
require "websocket-client-simple"
# Request auth token
api_username = "API_USERNAME"
api_password = "API_PASSWORD"
auth_url = "[login to view URL]"
token = HTTP.basic_auth(:user => api_username, :pass => api_password)
.get(auth_url)
.body
[login to view URL] do
# Connect to Intrinio's WebSocket
socket_url = [login to view URL]("wss://[login to view URL]{token}")
ws = WebSocket::Client::[login to view URL](socket_url)
# Connect to a channel to listen for prices
[login to view URL] :open do
message = {
topic: "iex:securities:AAPL",
event: "phx_join",
payload: {},
ref: "1"
}
[login to view URL](message.to_json)
end
# Parse prices from incoming messages
[login to view URL] :message do |msg|
message = [login to view URL]([login to view URL])
if message["event"] == "quote"
quote = message["payload"]
puts "== QUOTE ==== "
puts "TYPE: #{quote["type"]}"
puts "TICKER: #{quote["ticker"]}"
puts "PRICE: #{quote["price"]}"
puts "SIZE: #{quote["size"]}"
puts "============= "
else
puts msg
end
end
[login to view URL] :close do |e|
puts e
exit 1
end
[login to view URL] :error do |e|
puts e
end
end