Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions BlackSholes.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Black-Scholes Function
## Program for Black-Scholes Function
BS <- function(S, K, T, r, sig, type="C"){
d1 <- (log(S/K) + (r + sig^2/2)*T) / (sig*sqrt(T))
d2 <- d1 - sig*sqrt(T)
Expand All @@ -12,7 +12,8 @@ BS <- function(S, K, T, r, sig, type="C"){
}


## Function to find BS Implied Vol using Bisection Method
## This is a function to find BS Implied Vol using Bisection Method
## Feel free to fork this and add your own changes!
implied.vol <-
function(S, K, T, r, market, type){
sig <- 0.20
Expand Down Expand Up @@ -41,3 +42,4 @@ implied.vol <-
return(sig)
}
}

2 changes: 1 addition & 1 deletion FOSS.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ initPortf("faber", symbols=symbols, initDate=initDate)
initAcct("faber", portfolios="faber", initDate=initDate, initEq=initEq)
initOrders(portfolio="faber", initDate=initDate)

# Initialize a strategy object
# Initialising a strategy object
stratFaber <- strategy("faber")

# Add the 10-month SMA indicator
Expand Down
7 changes: 7 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
These are just some R scripts that I've found useful for school or just saw them online as snippets and wanted to see how they work.

I have put them on my github for you guys to refer to if you get stuck in R programming related issues.

Feel free to fork and add things of your own and if i find them useful i might merge them as well:)

LOVE YOU!
(MY IMAGINARY GIRLFRIEND;)
1 change: 1 addition & 0 deletions capm.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Uncomment this to install the quantmod package for the first time
#did you uncomment??
#install.packages("quantmod")

#Load required libraries
Expand Down
2 changes: 1 addition & 1 deletion twitter.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ twitterMap <- function(userName,userLocation=NULL,fileName="twitterMap.pdf",nMax
followingLL = followingLL[!is.na(followingLL[,1]),]
followersLL = followersLL[!is.na(followersLL[,1]),]


#twitter
cat("Plotting results.\n")
# Set up the colors
cols = brewer.pal(7,"Set2")
Expand Down