# IDEE GENERALI
#
# Date: specificate in formato data
# Vdate: default today forzabile a altra data (per backtesting, scenari)
# DateYearFrac: calcolate dalle due precedenti e passate agli engine
#
# Currency dell'opzione
# Currency del sottostante (default=ccy sottostante)
#
# Ticker sottostante (opzionale)
# Prevedere metodo che automaticamente
# imposta i parametri di pricing prendendoli da un DB (tasso, fxVol/Corr)
#
# ENGINE
# Semplice funzione che sfrutta curry (libreria functional)
# opt<-vanilla('call', T=today+1y, X=1)
# opt$engine<-genBS(sigma,etc)
# opt$NPV()
# OPPURE USIAMO SOLO LIST COME ARGOMENTI
# ...i parametri sono membro dello strumento e questo li passa all'engine
# opt<-vanilla('call', T=today+1y, X=1)
# opt$param<-list(sigma=,r=,etc)
# opt$engine<-genBS
# opt$NPV() #<-- oggetto chiama engine(param)
# facile anche costruire oggetto completo in una riga
# opt<-vanilla('call', T=today+1y, X=1, engine=genBS, param=list(S,sigma,r,...))
# opt<-vanilla('call', T=today+1y, X=1, engine=MC, param=list(N=,proc=,list(dt, sigma, etc)))
# SOLUZIONE ELEGANTE CON DO.CALL
# passare la list dei parametri ad una funzione che non accetta una
# list ==> convertire list in parametri per la funzione
# lo si ottiene con do.call
# funz <- function(x,y) {
# x+y
# }
#
# param<-list(x=2, y=3)
# do.call(funz,param)
# EMULARE QL PER PASSAGGIO DI ARGG A ENGINE
# vanilla <- setRefClass("vanilla",
# fields = list( maturity = "Date", mktData="list", updated="logical", engine='function'),
# methods = list(
# initialize=function(..., maturity, param=list(), mktData=list(), engine=NULL, updated=FALSE){
# maturity<<-maturity; param<<-param; mktData<<-mktData; updated<<-updated; engine<<-engine;
# callSuper(...)
# }
# npv<-function(){do.call(engine,mktData)}
# )
# )
#opt<-vanilla$new(maturity=Sys.Date())
#opt<-vanilla$new(maturity=Sys.Date(), param=list(strike=1), engine=BSM)
#f<-function(a,b){}
# GENERAL INSTRUMENT
# VANILLA OPTION
# BINARY OPTION
# BARRIER OPTION
# ZERO COUPON BOND
# COUPON BOND
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.