Prev | Current Page 251 | Next

David Berube

"Practical Reporting with Ruby and Rails"


CHAPTER 9 n INVESTMENT TRACKING WITH FIDELITY 180
You can install the necessary gems as follows:
gem install -y yahoofinance fxruby xml-simple
Listing 9-2 shows the code for the graphical XML ticker.
Listing 9-2. Scrolling Chart Prices with FXRuby (xml_ticker.rb)
require 'net/http'
require 'yahoofinance'
require 'fox16'
require 'xmlsimple'
(puts 'Usage: ruby xml_ticker.rb HOSTNAME PORT_NUMBER'; exit) unless ARGV.length==2
class FXTickerApp
include Fox
def initialize(hostname, port_number,
font_size = 100, quote_frequency=1)
# Quote_frequency is in minutes
@hostname = hostname
@port_number = port_number
@quote_frequency = quote_frequency
load_symbols_from_server
@fox_application=FXApp.new
@main_window=FXMainWindow.new(@fox_application, "Stock Ticker ",
nil, nil, DECOR_ALL | LAYOUT_EXPLICIT)
@tickerlabel = FXLabel.new(@main_window, get_label_text,
nil, 0, LAYOUT_EXPLICIT)
@tickerlabel.font.setFont "helvetica [bitstream],#{font_size}"
def scroll_timer(sender, sel, ptr)
self.scroll_label
@fox_application.


Pages:
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
Paintball Wrocław biuro rachunkowe gdańsk produkcja Futro mieszkania szczecin