library(Rblpapi)
knitr::opts_chunk$set(echo = FALSE)
# source("C:\\Users\\yunch\\Documents\\Projects\\tidymas\\scripts\\convenience.R")
source("convenience.R")
blpConnect()

ticker_list <- c("RX1 Comdty", "G 1 Comdty", "IK1 Comdty", "OAT1 Comdty", 
                 "GBPUSD Curncy", "GBPEUR Curncy", "UKTWBROA Index", 
                 "GTGBP2Y Govt", "GTGBP5Y Govt", "GTGBP10Y Govt", "GTGBP30Y Govt",
                 "UKGGBE05Y Index", "UKGGBE10Y Index", "UKGGBE30Y Index",
                 "GB0BPR Index", "EURUSD Curncy", "EURGBP Curncy", "GTDEM2Y Govt",
                 "GTDEM5Y Govt", "GTDEM10Y Govt", "GTDEM30Y Govt", "GTESP2Y Govt",
                 "GTESP5Y Govt", "GTESP10Y Govt", "GTESP30Y Govt", "GTITL2Y Govt",
                 "GTITL5Y Govt", "GTITL10Y Govt", "GTITL30Y Govt", "EURCHF Curncy",
                 "SNBN SW Equity", "BBDXY Index", "GT2 Govt", "GT5 Govt", "GT10 Govt",
                 "GT30 Govt", "USGGBE02 Index", "USGGBE05 Index", "USGGBE10 Index",
                 "USGGBE30 Index", "SPX Index", "INDU Index", "CCMP Index",
                 "RTY Index","UKX Index", "MCX Index", "ASX Index", "SX5E Index",
                 "DAX Index", "CAC Index", "SMI Index", "IBEX Index", "FTSEMIB Index",
                 "BVLX Index", "ASE Index", "NKY Index", "HSI Index", "KOSPI Index",
                 "STI Index", "VIX Index", "V2X Index", "V1X Index", "VFTSE Index",
                 "CL1 Comdty", "CO1 Comdty", "XAU Curncy", "XAG Curncy", "C 1 Comdty",
                 "W 1 Comdty", "FB US Equity", "AAPL US Equity", "AMZN US Equity",
                 "NFLX US Equity", "GOOG US Equity", "TSLA US Equity", "SPOT US Equity",
                 "MSFT US Equity", "V US Equity", "ORCL US Equity", "MA US Equity",
                 "CRM US Equity", "IBM US Equity", "CSCO US Equity", "INTC US Equity",
                 "NVDA US Equity", "AMD US Equity", "MU US Equity", "TXN US Equity",
                 "AMAT US Equity", "6954 JT Equity", "6861 JT Equity", "JPM US Equity",
                 "WFC US Equity", "BAC US Equity", "C US Equity", "GS US Equity", 
                 "MS US Equity", "BLK US Equity", "BK US Equity", "STT US Equity",
                 "NTRS US Equity", "BX US Equity", "KKR US Equity", "APO US Equity",
                 "CG US Equity", "OAK US Equity", "III LN Equity", "XBTUSD BGN Curncy",
                 "XRPUSD BGN Curncy", "XETUSD BGN Curncy", "XLCUSD BGN Curncy",
                 "5 HK Equity", "144 HK Equity", "939 HK Equity", "941 HK Equity",
                 "1398 HK Equity", "3988 HK Equity", "1548 HK Equity", "BABA US Equity",
                 "BIDU US Equity", "TCEHY US Equity", "BZUN US Equity", "CAPL SP Equity", 
                 "GENS SP Equity")

dailymon_db <- fetch_daily_bbg_data(ticker_list, Sys.Date()-365, Sys.Date(), opt)

Futures

Bond Futures

grid.arrange(
  ggTS("RX1 Comdty"),
  ggTS("G 1 Comdty"),
  ggTS("IK1 Comdty"),
  ggTS("OAT1 Comdty"),
  nrow = 2
)

UK

GBPUSD

g1 <- ggTS("GBPUSD Curncy")
g2 <- ggTS("GBPEUR Curncy")
g3 <- ggTS("UKTWBROA Index", title = "BoE Broad FX index")
grid.arrange(g1, g2, g3, nrow = 2)

UK Nominal Yields

uk_2y <- ggTS("GTGBP2Y Govt", yield_mode = TRUE)
uk_5y <- ggTS("GTGBP5Y Govt", yield_mode = TRUE)
uk_10y <- ggTS("GTGBP10Y Govt", yield_mode = TRUE)
uk_30y <- ggTS("GTGBP30Y Govt", yield_mode = TRUE)
grid.arrange(uk_2y, uk_5y, uk_10y, uk_30y, nrow = 2)

UK Breakevens

uk_5y_r <- ggTS("UKGGBE05Y Index", yield_mode = TRUE)
uk_10y_r <- ggTS("UKGGBE10Y Index", yield_mode = TRUE)
uk_30y_r <- ggTS("UKGGBE30Y Index", yield_mode = TRUE)
grid.arrange(blank_chart(), uk_5y_r, uk_10y_r, uk_30y_r, nrow = 2)

UK Hike Probability

ggTS("GB0BPR Index", title = "OIS-implied hike probability at next MPC meeting", yield_mode = TRUE)

Europe

EUR

g1 <- ggTS("EURUSD Curncy")
g2 <- ggTS("EURGBP Curncy")
grid.arrange(g1, g2, nrow = 2)

German Nominal Yields

dem_2y <- ggTS("GTDEM2Y Govt", yield_mode = TRUE)
dem_5y <- ggTS("GTDEM5Y Govt", yield_mode = TRUE)
dem_10y <- ggTS("GTDEM10Y Govt", yield_mode = TRUE)
dem_30y <- ggTS("GTDEM30Y Govt", yield_mode = TRUE)
grid.arrange(dem_2y, dem_5y, dem_10y, dem_30y, nrow = 2)

Spanish Nominal Yields

grid.arrange(ggTS("GTESP2Y Govt", yield_mode = TRUE),
             ggTS("GTESP5Y Govt", yield_mode = TRUE),
             ggTS("GTESP10Y Govt", yield_mode = TRUE),
             ggTS("GTESP30Y Govt", yield_mode = TRUE),
             nrow = 2)

Italy Nominal Yields

grid.arrange(ggTS("GTITL2Y Govt", yield_mode = TRUE),
             ggTS("GTITL5Y Govt", yield_mode = TRUE),
             ggTS("GTITL10Y Govt", yield_mode = TRUE),
             ggTS("GTITL30Y Govt", yield_mode = TRUE),
             nrow = 2)

Swiss

CHF

grid.arrange(
  ggTS("EURCHF Curncy"),
  ggTS("SNBN SW Equity"),
  ncol = 2
)

US

USD

ggTS("BBDXY Index", title = "Bloomberg Dollar Spot Index")

US Nominal Yields

us_2y <- ggTS("GT2 Govt", yield_mode = TRUE)
us_5y <- ggTS("GT5 Govt", yield_mode = TRUE)
us_10y <- ggTS("GT10 Govt", yield_mode = TRUE)
us_30y <- ggTS("GT30 Govt", yield_mode = TRUE)
grid.arrange(us_2y, us_5y, us_10y, us_30y, nrow = 2)

US Breakeven Yields

grid.arrange(
  ggTS("USGGBE02 Index", yield_mode = TRUE),
  ggTS("USGGBE05 Index", yield_mode = TRUE),
  ggTS("USGGBE10 Index", yield_mode = TRUE),
  ggTS("USGGBE30 Index", yield_mode = TRUE),
  nrow = 2
)

Equities Indices

US Equities

spx <- ggTS("SPX Index", title = "S&P500")
dow_jones <- ggTS("INDU Index", title = "Dow Jones")
nasdaq <- ggTS("CCMP Index", title = "NASDAQ Composite")
russell_2000 <- ggTS("RTY Index", title = "Russell 2000")
grid.arrange(spx, dow_jones, nasdaq, russell_2000, nrow = 2)

UK Equities

ftse100 <- ggTS("UKX Index", title = "FTSE 100")
ftse250 <- ggTS("MCX Index", title = "FTSE 250")
ftse_all <- ggTS("ASX Index", title = "FTSE All Share")
grid.arrange(ftse100, ftse250, ftse_all, nrow = 2)

Core Europe Equities

sx5e <- ggTS("SX5E Index", title = "EuroStoxx")
dax <- ggTS("DAX Index", title = "German DAX")
cac <- ggTS("CAC Index", title = "France CAC")
smi <- ggTS("SMI Index", title = "Swiss SMI")
grid.arrange(sx5e, dax, cac, smi, nrow = 2)

Periphery Europe Equities

ibex <- ggTS("IBEX Index", title = "Spain IBEX")
mib <- ggTS("FTSEMIB Index", title = "Italy MIB")
psi <- ggTS("BVLX Index", title = "Portugal PSI")
ase <- ggTS("ASE Index", title = "Greece ASE")
grid.arrange(ibex, mib, psi, ase, nrow = 2)

Asia Equities

nikkei <- ggTS("NKY Index", title = "Nikkei")
hang_seng <- ggTS("HSI Index", title = "Hang Seng")
kospi <- ggTS("KOSPI Index", title = "KOSPI")
sti <- ggTS("STI Index", title = "STI")
grid.arrange(nikkei, hang_seng, kospi, sti, nrow = 2)

Volatility

Key Volatility Indices

vix <- ggTS("VIX Index", title = "VIX")
v2x <- ggTS("V2X Index", title = "VSTOXX")
vdax <- ggTS("V1X Index", title = "VDAX")
vftse <- ggTS("VFTSE Index", title = "VFTSE")
grid.arrange(vix, v2x, vdax, vftse, nrow = 2)

Commodities

Key Commodities Futures

wti <- ggTS("CL1 Comdty", title = "WTI 1st contract")
brent <- ggTS("CO1 Comdty", title = "Brent 1st contract")
gold <- ggTS("XAU Curncy", title = "Gold")
silver <- ggTS("XAG Curncy", title = "Silver")
corn <- ggTS("C 1 Comdty", title = "Corn")
wheat <- ggTS("W 1 Comdty", title = "Wheat")
grid.arrange(wti, gold, corn, brent, silver, wheat, ncol = 3)

Select Names

FAANGS

facebook <- ggTS("FB US Equity", title = "Facebook")
apple <- ggTS("AAPL US Equity", title = "Apple")
amazon <- ggTS("AMZN US Equity", title = "Amazon")
netflix <- ggTS("NFLX US Equity", title = "Netflix")
google <- ggTS("GOOG US Equity", title = "Alphabet")
grid.arrange(facebook, apple, amazon, netflix, google, ncol = 3)

Tech - special interest

tsla <- ggTS("TSLA US Equity", title = "Tesla")
spotify <- ggTS("SPOT US Equity", title = "Spotify")
grid.arrange(tsla, spotify)

Tech - Software & Services

msft <- ggTS("MSFT US Equity", title = "Microsoft")
visa <- ggTS("V US Equity", title = "Visa")
oracle <- ggTS("ORCL US Equity", title = "Oracle")
ma <- ggTS("MA US Equity", title = "Mastercard")
salesforce <- ggTS("CRM US Equity", title = "SalesForce")
ibm <- ggTS("IBM US Equity", title = "IBM")
grid.arrange(msft, visa, oracle, ma, salesforce, ibm, ncol = 3)

Tech - Hardware & Equipment

csco <- ggTS("CSCO US Equity", title = "CISCO")
grid.arrange(csco)

Tech - Semiconductors & Equipment

intc <- ggTS("INTC US Equity", title = "Intel")
nvda <- ggTS("NVDA US Equity", title = "Nvidia")
amd <- ggTS("AMD US Equity", title = "AMD")
micron <- ggTS("MU US Equity", title = "Micron")
txn <- ggTS("TXN US Equity", title = "Texas Instrument")
amat <- ggTS("AMAT US Equity", title = "Applied Materials")
grid.arrange(intc, nvda, amd, micron, txn, amat, nrow = 2)

Robotics

fanuc <- ggTS("6954 JT Equity", title = "FANUC")
keyence <- ggTS("6861 JT Equity", title = "Keyence")
grid.arrange(fanuc)

US Banks

jpm <- ggTS("JPM US Equity", "JP Morgan")
wf <- ggTS("WFC US Equity", "Wells Fargo")
bac <- ggTS("BAC US Equity", "Bank of America")
citi <- ggTS("C US Equity", "Citigroup")
gs <- ggTS("GS US Equity", "Goldman Sachs")
ms <- ggTS("MS US Equity", "Morgan Stanley")
grid.arrange(jpm, wf, bac, citi, gs, ms, nrow = 2)

Asset Managers

blk <- ggTS("BLK US Equity", title = "BlackRock")
bony <- ggTS("BK US Equity", title = "Bank of New York")
ss <- ggTS("STT US Equity", title = "State Street")
nt <- ggTS("NTRS US Equity", title = "Northern Trust")
grid.arrange(blk, bony, ss, nt, nrow = 2)

Private equity

bs <- ggTS("BX US Equity", title = "BlackStone Group")
kkr <- ggTS("KKR US Equity", title = "KKR & Co LP")
apo <- ggTS("APO US Equity", title = "Apollo Global")
cg <- ggTS("CG US Equity", title = "Carlyle Group")
oak <- ggTS("OAK US Equity", title = "Oaktree Capital")
iii <- ggTS("III LN Equity", title = "3i")
grid.arrange(bs, kkr, apo, cg, oak, iii, nrow = 2)

Cryptocurrencies

bitcoin <- ggTS("XBTUSD BGN Curncy", title = "Bitcoin")
ripple <- ggTS("XRPUSD BGN Curncy", title = "Ripple")
ethereum <- ggTS("XETUSD BGN Curncy", title = "Ethereum")
litecoin  <- ggTS("XLCUSD BGN Curncy", title = "Litecoin")
grid.arrange(bitcoin, ripple, ethereum, litecoin, nrow = 2)

Chinese stocks

hsbc <- ggTS("5 HK Equity", title = "HSBC")
c_merc <- ggTS("144 HK Equity", title = "China Merchants")
ccb <- ggTS("939 HK Equity", title = "China Construction Bank")
c_mob <- ggTS("941 HK Equity", title = "China Mobile")
icbc <- ggTS("1398 HK Equity", title = "ICBC")
boc <- ggTS("3988 HK Equity", title = "Bank of China")
grid.arrange(hsbc, c_merc, ccb, c_mob, icbc, boc, nrow = 2)

Chinese stocks 2

ggTS("1548 HK Equity", title = "Genscript")

BAT+

baba <- ggTS("BABA US Equity", title = "Alibaba")
baidu <- ggTS("BIDU US Equity", title = "Baidu")
tencent <- ggTS("TCEHY US Equity", title = "Tencent")
bzun <- ggTS("BZUN US Equity", title = "Baozun")
grid.arrange(baba, baidu, tencent, bzun, nrow = 2)

Singapore stocks

capland <- ggTS("CAPL SP Equity", title = "Capitaland")
genting <- ggTS("GENS SP Equity", title = "Genting")
grid.arrange(capland, genting)

Watch



yunching/tidymas documentation built on Feb. 5, 2023, 1:42 p.m.