Skip to content

Instantly share code, notes, and snippets.

View ssh352's full-sized avatar

j ssh352

View GitHub Profile
@ssh352
ssh352 / VPIN
Created August 20, 2019 07:56 — forked from ProbablePattern/VPIN
VPIN calculation using bulk-volume classification
#### VPIN calculation #########################################################
#install.packages('fasttime',repos='http://www.rforge.net/')
require(data.table); require(fasttime); require(plyr)
# Assuming TAQ data is arranged in 1 year stock csv files
stock=fread('/TAQ_data.csv'); stock=stock[,1:3,with=FALSE]
setnames(stock,colnames(stock),c('DateTime','Price','Volume'));
stock[,DateTime:=paste(paste(substr(DateTime,1,4),substr(DateTime,5,6),
substr(DateTime,7,8),sep='-'),substr(DateTime,10,17))]
setkey(stock,DateTime);
stock=as.xts(stock[,2:3,with=FALSE],unique=FALSE,
@ssh352
ssh352 / margintale_blog_2.R
Created March 13, 2019 07:26 — forked from theHausdorffMetric/margintale_blog_2.R
Time Series Heatmaps in ggplot2
require(quantmod)
require(ggplot2)
require(reshape2)
require(plyr)
require(scales)
# Download some Data, e.g. the CBOE VIX
getSymbols("^VIX",src="yahoo")
# Make a dataframe
@ssh352
ssh352 / HeatmapHrByDay.R
Created March 6, 2019 07:55 — forked from johnmackintosh/HeatmapHrByDay.R
How I made the hourly~daily~monthly~yearly heatmap
library(ggplot2)
library(dplyr) # easier data wrangling
library(viridis) # colour blind friendly palette, works in B&W also
library(Interpol.T) # will generate a large dataset on initial load
library(lubridate) # for easy date manipulation
library(ggExtra) # because remembering ggplot theme options is beyond me
library(tidyr)
data<- data(Trentino_hourly_T,package = "Interpol.T")
@ssh352
ssh352 / ExploreHiddenR.md
Created January 22, 2019 07:11 — forked from ZeccaLehn/ExploreHiddenR.md
[R] Explore Hidden Environments and Functions -- by example

Shows function Internals

library(BayesianFirstAid)
debugonce(bayes.t.test) # turns off debugging for function after first run
bayes.t.test(co2)

Returns hidden and unhidden environments