Skip to content

Instantly share code, notes, and snippets.

View ssh352's full-sized avatar

j ssh352

View GitHub Profile
@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

@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 / 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 / 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 / macos-tmux-256color.md
Created September 28, 2020 02:49 — forked from bbqtd/macos-tmux-256color.md
Installing tmux-256color for macOS

Installing tmux-256color for macOS

  • macOS 10.15.5
  • tmux 3.1b

macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.

The Fast Blazing Solution

Instead of tmux-256color, use screen-256color which comes with system. Place this command into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later):

@ssh352
ssh352 / private.xml
Created October 27, 2020 13:24 — forked from Eric-Guo/private.xml
Karabiner private.xml for Topre REALFORCE 87U on rMBP
<?xml version="1.0"?>
<root>
<item>
<name>For Topre REALFORCE 87u Users</name>
<devicevendordef>
<vendorname>TopreCorporation</vendorname>
<vendorid>0x0853</vendorid>
</devicevendordef>
<item>
<name>Fix FN + F1..F12 and functional keys</name>
@ssh352
ssh352 / performance_java.md
Created December 17, 2020 08:00 — forked from whostolebenfrog/performance_java.md
Notes on: Performance testing Java applications - Martin Thompson

Performance testing java applications - Martin Thompson

What is testing

Fast is generic, breaks down to: -- throughput -- bandwidth

-- latency -- response time

@ssh352
ssh352 / gist:69499e861c56bcedbc73fd79494f9fec
Created March 17, 2021 01:55 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@ssh352
ssh352 / stylerFormatl.R
Created January 5, 2022 02:43
styler format
library(dplyr)
library(tidyr)
library(purrr) # map
library(slider)
# only returns rsquared
get_coef1 <- function(data) {
coef1 <- lm(data = data, r1 ~ r2 + r3) %>%
coef() %>%
.["r2"] %>%

https://web.archive.org/web/20110219163448/http://howtohft.wordpress.com/2011/02/15/how-to-build-a-fast-limit-order-book/

The response to my first few posts has been much larger than I’d imagined and I’d like to thank everyone for the encouragement.

If you’re interested in building a trading system I recommend first reading my previous post on general ideas to keep in mind.

My first really technical post will be on how to build a limit order book, probably the single most important component of a trading system. Because the data structure chosen to represent the limit order book will be the primary source of market information for trading models, it is important to make it both absolutely correct and extremely fast.

To give some idea of the data volumes, the Nasdaq TotalView ITCH feed, which is every event in every instrument traded on the Nasdaq, can have data rates of 20+ gigabytes/day with spikes of 3 megabytes/second or more. The individual messages average about 20 bytes each so this means handling