R/profile.R

#################################################################################
##
##   R package rcsi by Alexios Ghalanos Copyright (C) 2008, 2009
##   This file is part of the R package rcsi.
##
##   The R package rcsi is free software: you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation, either version 3 of the License, or
##   (at your option) any later version.
##
##   The R package rcsi is distributed in the hope that it will be useful,
##   but WITHOUT ANY WARRANTY; without even the implied warranty of
##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##   GNU General Public License for more details.
##
#################################################################################
.marketprofile = function(symbol, is.stock = TRUE)
{
	if(!exists(".ua")) startUA()
	if ( missing(symbol) ) stop ("symbol is required!\n", call. = FALSE)
	if(is.stock) .ua[["IsStock"]] = 1 else .ua[["IsStock"]] = 0
	csinum = .getCSInum(symbol)
	.ua[["MarketNumber"]]  = csinum
	
	uaErr  = .ua$GetMarketProfile()
	if (uaErr < 1) 
		stop("Could not get market profile\n", call. = FALSE)
	
	exchange  = .ua[["Exchange"]]
	marketName  = .ua[["MarketName"]]
	firstDate  = .ua[["FirstDate"]]
	lastDate  = .ua[["LastDate"]]
	currency  = .ua[["Currency"]]
	tradingDays  = .ua$RetrieveStock(csinum, -1,-1)
	hasFundamentals = .ua[["HasStockFundamentalData"]]
	firstOptionDate = .ua[["FirstOptionDate"]]
	lastOptionDate = .ua[["LastOptionDate"]]
	conversionFactor = .ua[["ConversionFactor"]]
	optionConversionFactor = .ua[["OptionConversionFactor"]]
	tradingUnits = .ua[["TradingUnits"]]
	contractSize = .ua[["ContractSize"]]
	pointValue = .ua[["PointValue"]]
	validMonths = .ua[["ValidMonths"]]
	minTickInPoints = .ua[["MinTickInPoints"]]
	shortMarketSymbol = .ua[["ShortMarketSymbol"]]
	clist = list(symbol = symbol, csinum = csinum, isStock = is.stock,
			exchange = exchange,
			marketName = marketName,
			firstDate = firstDate,
			lastDate = lastDate,
			currency = currency,
			tradingDays = tradingDays,
			hasFundamentals= hasFundamentals,
			firstOptionDate = firstOptionDate,
			lastOptionDate = lastOptionDate,
			conversionFactor = conversionFactor,
			optionConversionFactor = optionConversionFactor,
			tradingUnits = tradingUnits,
			contractSize = contractSize,
			pointValue = pointValue,
			validMonths = validMonths,
			minTickInPoints = minTickInPoints,
			shortMarketSymbol = shortMarketSymbol)
	ans = new("uaMarketProfile",
			data = clist)
	return(ans)
}

Try the RCSI package in your browser

Any scripts or data that you put into this service are public.

RCSI documentation built on May 2, 2019, 4:50 p.m.