This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# data must be a data.table | |
# lags is a vector of positive integer lags | |
add_lag_variables <- function(data, lags){ | |
setkey(data, ticker_id, timestamp) | |
setorder(data, ticker_id, timestamp) | |
col_to_lag <- names(data) | |
col_to_lag <- col_to_lag[!(col_to_lag %in% c('ticker_id', 'timestamp'))] | |
for(lag in lags){ | |
lag_col_names <- paste(col_to_lag, "lag", lag, sep = "_") | |
data[,(lag_col_names) := shift(.SD, n = lag, type = 'lag'), by = ticker_id, .SDcols = col_to_lag] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Poloniex api doesn't give the lending fees that are needed to reconcile accounts. | |
#Poloniex trade history export also doesn't give the lending fees | |
#Scraping is the only way I could get this data | |
#Hope this helps you, no warrenty :) | |
#Env Vars - POLONIEX_USER, POLONIEX_PASS, POLONIEX_OTP | |
#Incase you didn't catch that - POLONIEX_OTP - Is the one time password secret needed to make it through 2 factor auth | |
import os | |
from xvfbwrapper import Xvfb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am page1 on github. | |
* I am scottpage (https://keybase.io/scottpage) on keybase. | |
* I have a public key whose fingerprint is F81A 8C0E 6161 724D 9C11 1667 2BC9 CD34 814A 6EA5 | |
To claim this, I am signing this object: |