Yahoo financial data feed and model side scripting

This example workbook demonstrates using Resolver One to access Yahoo! financial data.

You will learn...

  • How to access Yahoo! financial data.
  • How to use model side scripting to ensure that data persists between recalculations and Resolver One sessions.

Before you begin

Do one of the following:

  • In Windows, select Start, Resolver One, Samples, Yahoo financial data feed and model side scripting
  • Download the example from the Resolver Exchange.

About the example

The example contains two columns with input data, Symbol and Qty.

The Update button fetches current prices of the stocks listed in column Symbol from Yahoo! Finance, and stores them in the column Price.

Try adding more symbols to the portfolio.

How the example works

Getting the data

Data is fetched from Yahoo!'s webservice using the getStockPrices function, which takes a list of symbols and returns a dictionary mapping these symbols to their current price....

  1. Downloads a file with quotes from the Yahoo! website.
  2. Parses it using the built in CsvReader class.

For more on CSV parsing, see loading data from CSV files

Storing the data using model side scripting

Prices for stocks are stored by setting the Formula on a cell:

for symbol, price in prices.iteritems():
    portfolio.Cells['Price', symbol].Formula = price

Setting the Formula property ensures the values will persist across recalculations and between Resolver One sessions. A name for this is model side scripting.

Comments