| 1 2
34
56
78
910
1112
1314
1516
1718
1920
2122
2324
2526
2728
2930
3132
3334
3536
3738
3940
4142
4344
4546
4748
4950
5152
5354
5556
5758
5960
6162
6364
6566
6768
6970
7172
7374
7576
7778
7980
81 |
require(Quandl)
Quandl.auth("yourTokenHere")
authCode <- "yourTokenHere"
quandlSCF <- function(code, authCode, from =
NA, to = NA) {
dataCode <- paste0("SCF/",
code) out <- Quandl(dataCode,
authCode = authCode)
out <- xts(out[, -1], order.by=out$Date)
colnames(out)[4] <- "Close"
colnames(out)[6] <- "PrevDayOpInt"
if(!is.na(from)) {
out <- out[paste0(from,
"::")] }
if(!is.na(to)) {
out <- out[paste0("::",
to)]
} return(out)
}
#Front open-interest cross
from <- NAto <- NA
#Energies
CME_CL1 <- quandlSCF("CME_CL1_ON",
authCode = authCode, from = from, to = to) #crudeCME_NG1 <-
quandlSCF("CME_NG1_ON", authCode = authCode,
from = from, to = to) #natgas
CME_HO1 <- quandlSCF("CME_HO1_ON",
authCode = authCode, from = from, to = to) #heatOilCME_RB1 <-
quandlSCF("CME_RB1_ON", authCode = authCode,
from = from, to = to) #RBob
ICE_B1 <- quandlSCF("ICE_B1_ON",
authCode = authCode, from = from, to = to) #BrentICE_G1 <-
quandlSCF("ICE_G1_ON", authCode = authCode,
from = from, to = to) #GasOil
#Grains
CME_C1 <- quandlSCF("CME_C1_ON",
authCode = authCode, from = from, to = to) #Chicago CornCME_S1
<- quandlSCF("CME_S1_ON", authCode = authCode,
from = from, to = to) #Chicago Soybeans
CME_W1 <- quandlSCF("CME_W1_ON",
authCode = authCode, from = from, to = to) #Chicago WheatCME_SM1
<- quandlSCF("CME_SM1_ON", authCode = authCode,
from = from, to = to) #Chicago Soybean Meal
CME_KW1 <- quandlSCF("CME_KW1_ON",
authCode = authCode, from = from, to = to) #Kansas City WheatCME_BO1
<- quandlSCF("CME_BO1_ON", authCode = authCode,
from = from, to = to) #Chicago Soybean Oil
#Softs
ICE_SB1 <- quandlSCF("ICE_SB1_ON",
authCode = authCode, from = from, to = to) #Sugar No. 11ICE_KC1
<- quandlSCF("ICE_KC1_ON", authCode = authCode,
from = from, to = to) #Coffee
ICE_CC1 <- quandlSCF("ICE_CC1_ON",
authCode = authCode, from = from, to = to) #CocoaICE_CT1 <-
quandlSCF("ICE_CT1_ON", authCode = authCode,
from = from, to = to) #Cotton
#Other Ags
CME_LC1 <- quandlSCF("CME_LC1_ON",
authCode = authCode, from = from, to = to) #Live CattleCME_LN1
<- quandlSCF("CME_LN1_ON", authCode = authCode,
from = from, to = to) #Lean Hogs
#Precious Metals
CME_GC1 <- quandlSCF("CME_GC1_ON",
authCode = authCode, from = from, to = to) #GoldCME_SI1 <-
quandlSCF("CME_SI1_ON", authCode = authCode,
from = from, to = to) #Silver
CME_PL1 <- quandlSCF("CME_PL1_ON",
authCode = authCode, from = from, to = to) #PlatinumCME_PA1 <-
quandlSCF("CME_PA1_ON", authCode = authCode,
from = from, to = to) #Palladium
#Base
CME_HG1 <- quandlSCF("CME_HG1_ON",
authCode = authCode, from = from, to = to) #Copper
#Currencies
CME_AD1 <- quandlSCF("CME_AD1_ON",
authCode = authCode, from = from, to = to) #OzzieCME_CD1 <-
quandlSCF("CME_CD1_ON", authCode = authCode,
from = from, to = to) #Canadian Dollar
CME_SF1 <- quandlSCF("CME_SF1_ON",
authCode = authCode, from = from, to = to) #Swiss FrancCME_EC1
<- quandlSCF("CME_EC1_ON", authCode = authCode,
from = from, to = to) #Euro
CME_BP1 <- quandlSCF("CME_BP1_ON",
authCode = authCode, from = from, to = to) #PoundCME_JY1 <-
quandlSCF("CME_JY1_ON", authCode = authCode,
from = from, to = to) #Yen
ICE_DX1 <- quandlSCF("ICE_DX1_ON",
authCode = authCode, from = from, to = to) #Dollar Index
#Equities
CME_ES1 <- quandlSCF("CME_ES1_ON",
authCode = authCode, from = from, to = to) #EminiCME_MD1 <-
quandlSCF("CME_MD1_ON", authCode = authCode,
from = from, to = to) #Midcap 400
CME_NQ1 <- quandlSCF("CME_NQ1_ON",
authCode = authCode, from = from, to = to) #Nasdaq 100ICE_RF1
<- quandlSCF("ICE_RF1_ON", authCode = authCode,
from = from, to = to) #Russell Smallcap
CME_NK1 <- quandlSCF("CME_NK1_ON",
authCode = authCode, from = from, to = to) #Nikkei
#Bonds/rates
CME_FF1 <- quandlSCF("CME_FF1_ON",
authCode = authCode, from = from, to = to) #30-day fed fundsCME_ED1
<- quandlSCF("CME_ED1_ON", authCode = authCode,
from = from, to = to) #3 Mo. Eurodollar/TED Spread
CME_FV1 <- quandlSCF("CME_FV1_ON",
authCode = authCode, from = from, to = to) #Five Year TNoteCME_TY1
<- quandlSCF("CME_TY1_ON", authCode = authCode,
from = from, to = to) #Ten Year Note
CME_US1 <- quandlSCF("CME_US1_ON",
authCode = authCode, from = from, to = to) #30 year bond |