MarketStatistics {fBasics}R Documentation

Import Market Data from the Internet

Description

A collection and description of functions to extract financial and economic market statistics from the data available in the CIA World Factbook and from the exchange data collected by the World Federation of Stock Exchanges.

The functions are:

ciaCountries Returns a list of CIA country codes,
ciaIndicators Returns a list of CIA indicator codes,
ciaByCountry Returns all Indicators by country,
ciaByIndicator Returns for all countries indicator ranking.

To load statistics from the WFE:

data(wfe1) Market capitalization of domestic companies,
data(wfe2) Total number of companies with shares listed,
data(wfe3) Total value of share trading,
data(wfe4) Market value of bonds listed,
data(wfe5) Total value of bond trading, and
data(wfe6) Price earning ratio an gross dividend yield.

Usage

ciaCountries()
ciaIndicators()

ciaByCountry(code = "CH", from = FALSE, names = FALSE, details = TRUE)
ciaByIndicator(code = 2001, from = FALSE, details = TRUE)

## S3 method for class 'ciaCountries':
print(x, ...)
## S3 method for class 'ciaIndicators':
print(x, ...)

Arguments

code [ciaByCountry] -
a character string denoting the country code.
[ciaByIndicator] -
a character string or integer denoting the indicator code.
details a logical flag. Should details be printed? By default TRUE.
from a logical flag. If set to TRUE an additional column will be returned with the information when the data were recorded.
names a logical flag. If set to TRUE" then the full names of the countries will be returned in an additional column
x x an object of class ciaCountries or ciaIndicators as returned by the functions ciaCountry or ciaIndicator, respectively.
... arguments to be past to the print method.

Details

Financial and economic market statistics can be found at several web pages for free. The "OECD Factbook" from the 'Organisation for Economic Co-operation and Development', www.oecd.org, "The World Factbook" from the 'Central Intelligence Agency' of the US, www.cia.gov, and the "Penn World Tables" from the 'Center for International Comparisons' at University of Pennsylvania, pwt.econ.upenn.edu, offer sources of economic, environmental and social indicators for the world's core economies.

Statistical data from the exchanges around the world can be obtained from the 'World Federation of Stock Exchanges', www.fibv.com.

Further sources of statistical data can be found on the web pages of the 'Bank for International Settlement', www.bis.org, and on the web pages of the 'International Monetary Fund', www.imf.org.

Value

ciaCountries
returns a data frame with countries and contry codes.

ciaIndicators
returns a data frame with indicator codes.

ciaByCountry
returns a data frame with indicators by country.

ciaByIndicator
returns a data frame with ranked data for a given indicator.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

References

CIA, 2004, CIA Factbbook 2004, http://www.cia.gov/cia/publications/factbook.

WFE, 2004, World Federation of Stock Exchanges, Focus 2004, http://www.world-exchanges.org.

Examples

## SOURCE("fBasics.11A-MarketStatistics")

## Pie Chart from CIA Oil Production Indicator (Code 2173): 
   # Search for Code:
   ciaIndicators()
   # Create Pie Chart:
   OilProduction = as.integer(as.vector(ciaByIndicator(2173)[2:11, 2]))
   names(OilProduction) = as.vector(ciaByIndicator(2173)[2:11,1])
   OilProduction 
   pie(OilProduction,col = rainbow(10))
   title(main = "Oil Production 2004\n bbl/day")
   mtext("Source: CIA World Factbook", side = 1)

## Barplot from WFE Capitalization Statistics:
   # Extract Capitalization of/at:
   # NYSE: 7, Tokyo: 37, London: 22, Frankfurt: 15
   # 1991 - 2003 triannual: 3,6,9,12,15
   data(wfe1)
   Table =t(wfe1[c(7,37,22,15),c(3,6,9,12,15)])/1e6
   colnames(Table) = c("NewYork", "Tokyo", "London", "Frankfurt")
   rownames(Table) = as.character(seq(1991, 2003, by = 3))
   Table
   # Create Barplot:
   barplot(Table, beside = TRUE, legend = rownames(Table),
         col = c("lightblue", "mistyrose", "lightcyan", "lavender", "cornsilk"))
   title(main = "Stock Market Capitalization\n 1991 - 2003")
   mtext("Source: World Federation of Exchanges", side = 4, 
         line = -2, cex = 0.7) 

[Package fBasics version 221.10065 Index]