## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----eval=FALSE---------------------------------------------------------------
# require(data.table)
# ng_dta <- av_get_pf("","NATURAL_GAS")[,.(symbol="GAS_HH",timestamp,close=value)]
# asset_df <- data.frame(symbol=c("GAS_HH"),type=c("user"),currency=c("USD"), name=c("Henry Hub Gas Spot"))
# av_add_px(ng_dta, assettypes=asset_df)

## ----eval=FALSE---------------------------------------------------------------
# suppressMessages(require(quantmod))
# ffdta <- as.data.table(quantmod::getSymbols("FEDFUNDS",src="FRED",auto.assign=FALSE))
# ffdta <- ffdta[,.(DT_ENTRY=index,close=FEDFUNDS,symbol="FEDFUNDS")]
# av_add_px(ffdta)

## ----eval=FALSE---------------------------------------------------------------
# av_add_px(equitylist=c("IBM","GS","JPM"))

## ----eval=FALSE---------------------------------------------------------------
# av_add_earn(equitylist=c("IBM","GS"))
# 
# tmp_earn <- av_get_pf("JPM","EARNINGS") |> av_extract_df("quarterlyEarnings")
# tmp_earnf<- av_get_pf("JPM","EARNINGS_ESTIMATES") |> av_extract_df("estimates")
# av_add_earn(substitute_earn=tmp_earn)
# av_add_earn(substitute_earnest=tmp_earnf)
# 
# 
# tmp_earn <- av_get_pf("MU","EARNINGS") |> av_extract_df("quarterlyEarnings")
# tmp_earnf<- av_get_pf("MU","EARNINGS_ESTIMATES") |> av_extract_df("estimates")
# av_add_earn(substitute_earn=tmp_earn, substitute_earnest=tmp_earnf)

## ----echo=FALSE, eval=FALSE---------------------------------------------------
# testlist <- s("GS;IBM;JPM;MU")
# u1 <- lapply(testlist, \(x) kill_symbol(x))
# dump_inv("^(GS|IBM|JPM|MU)")
# av_add_px(equitylist = testlist)
# dump_inv("^(GS|IBM|JPM|MU)")
# 
# av_add_earn(equitylist=c("IBM","GS"))
# dump_inv("^(GS|IBM|JPM|MU)")
# 
# tmp_earn <- av_get_pf("JPM","EARNINGS") |> av_extract_df("quarterlyEarnings")
# tmp_earnf<- av_get_pf("JPM","EARNINGS_ESTIMATES") |> av_extract_df("estimates")
# av_add_earn(substitute_earn=tmp_earn)
# av_add_earn(substitute_earnest=tmp_earnf)
# dump_inv("GS|IBM|JPM|MU")
# 
# tmp_earn <- av_get_pf("MU","EARNINGS") |> av_extract_df("quarterlyEarnings")
# tmp_earnf<- av_get_pf("MU","EARNINGS_ESTIMATES") |> av_extract_df("estimates")
# av_add_earn(substitute_earn=tmp_earn, substitute_earnest=tmp_earnf)
# dump_inv("GS|IBM|JPM|MU")

## ----eval=FALSE---------------------------------------------------------------
# newtickers <- c("QQQ","QQQE","NDX")
# newweights <- c(0.5,0.2,0.3)
# newasset_dt <- data.table(ticker=newtickers,listnm=rep("nasdaq",length(newtickers)), weight=newweights)
# av_add_assetgroups(newasset_dt)
# dump_assetgroups()

