Skip to content

Instantly share code, notes, and snippets.

View quantviews's full-sized avatar

Salikhov Marcel quantviews

View GitHub Profile
@quantviews
quantviews / rolling-beta.R
Created February 27, 2019 20:57
Rolling beta for stock returns
library(data.table) # fast data tables
library(rollRegres) # fast rolling regression
file <- '2006.csv'
DT <- fread(file)
DT = DT[,c("LastPrice", "Time", "Date", "Ticker")] # keep only columns needed
DT$DateTime <- as.POSIXct(paste0(DT$Date, ' ', DT$Time), format = "%Y%m%d %H:%M:%S", tz = "America/New_York") # convert character to datetime object
DT[, log_ret := c(NA, diff(log(LastPrice))), by = list(Ticker)] # calculate log returns
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://d3js.org/topojson.v1.min.js' type='text/javascript'></script>
<script src='http://datamaps.github.io/scripts/datamaps.all.min.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js' type='text/javascript'></script>

Choropleth map of Russia regions with data 'free' male and female at the age 18-39.

Source map was taken from http://gis-lab.info/qa/rusbounds-rosreestr.html.

Source data is from Rosstat, Russia's state statistics service.

Data tooltip were created based on Scott Murrays's book on D3.

Contact: , Salikhov Marcel

Choropleth map of Russia regions with data on average per capita incomes in 2012 (RUB/month) mapped.

Source map was taken from http://gis-lab.info/qa/rusbounds-rosreestr.html.

Source data is from Rosstat, Russia's state statistics service.

Data tooltip were created based on Scott Murrays's book on D3.

Contact: , Salikhov Marcel

@quantviews
quantviews / gist:d910bbb381659ba7c939
Created June 21, 2014 11:53
Количество "свободных" мужчин и женщин по регионам РФ
Подробнее quantviews.blogspot.ru
This file has been truncated, but you can view the full file.
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='https://rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<script src='http://harrywood.co.uk/maps/examples/leaflet/leaflet-plugins/layer/vector/KML.js' type='text/javascript'></script>
This file has been truncated, but you can view the full file.
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='https://rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<style>
This file has been truncated, but you can view the full file.
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='https://rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<style>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='https://rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<style>
@quantviews
quantviews / electro.csv
Last active December 18, 2015 08:09
Moscow Marey's train diagram
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 1.
"number","type","direction","stop|Москва Ленинградская| 0.0|0","stop|Рижская| 3.0|0","stop|Останкино| 6.0|0","stop|Петровско-Разумовское| 9.0|0","stop|Моссельмаш| 12.0|0","stop|Ховрино| 14.0|0","stop|Левобережье| 17.0|0","stop|Химки| 19.0|0","stop|Планерная| 24.0|0","stop|Новоподрезково| 27.0|0","stop|Подрезково| 28.5|0","stop|Сходня| 30.0|0","stop|Фирсановская| 33.0|0","stop|Малино| 36.0|0","stop|Крюково (Зеленоград)| 39.0|0","stop|Алабушево| 43.0|0","stop|Радищево| 47.0|0","stop|Поваровка| 50.0|0","stop|Поварово-1| 52.0|0","stop|Берёзки Дачные| 55.0|0","stop|Подсолнечная| 65.0|0","stop|Сенеж| 68.0|0","stop|Головково| 70.0|0","stop|Покровка| 75.0|0","stop|Фроловское| 81.0|0","stop|Стреглово| 84.0|0","stop|Клин| 89.0|0","stop|Ямуга| 97.0|0","stop|Решетниково|105.0|0","stop|Путепроводная|112.0|0","stop|Черничная|114.0|0","stop|Конаковский Мох|123.0|0","stop|Завидово|119.0|0","stop|Донховка|129.0|0","stop|Московское Море|126.0|0","stop|Редкино|132.0|0","stop|Конаково ГРЭС|141.0|0","stop|Межево|143.0|0","sto