Skip to content

Instantly share code, notes, and snippets.

/*
* This is a litle tech demo to demonstrate using clojureCLR in a CLR web app.
*
* A custom IHttpHandler (ClojureHttpHandler) handles invocation of clojure code,
* and a custom IRouteHandler (ClojureRouteHandler) routes requests to the HttpHandler.
*
* See comments in the code for further detail.
*
* Cheers, zdam
* http://zimpler.com/blog/clojureclr-in-an-asp-net-mvc-app
@lincpa
lincpa / cntrade.r
Created January 25, 2013 13:28 — forked from yanping/cntrade.r
# cntrade R语言版
# 作者:陈堰平(新华指数有限责任公司,chen@yanping.me)
# 使用网易股票数据接口
# 原stata版的作者为:
# 李春涛(中南财经政法大学,chtl@znufe.edu.cn)
# 张璇(中南财经政法大学,zhangx@znufe.edu.cn)
# example:
# cntrade(c("600000", "000008"), path = "D:/stockprice", start = "20010104", end = "20120124")
cntrade <- function(tickers, path = "", start = "19910101", end = ""){
# readHexun.r
# 从和讯读取财务数据
readHexun <- function(stockid, year, accountdate ){
if(accountdate == 1){
ad <- paste(year,".03.15",sep="")
}else if(accountdate == 2){
ad <- paste(year,".06.30",sep="")
}else if(accountdate == 3){
# getHexunFinaceData.r
# 从和讯读取财务数据
# version: 0.9
# 例子: test <- getHexunFinaceData(600028,2001,2002)
getHexunFinaceData <- function(stockid, start = 1991, end = as.numeric(substr(Sys.time(), 1, 4))) {
if(!is.vector(stockid)){
stop("参数stockid必须是向量形式!")
}else{