Skip to content

Instantly share code, notes, and snippets.

\documentclass[12pt, twoside]{report}
\usepackage[a4paper,width=150mm, top=25mm, bottom=25mm, bindingoffset=6mm]{geometry}
\usepackage{minted}
\usepackage{caption}
\usepackage[backend=biber,style=numeric,hyperref=true]{biblatex}
\setlength{\parindent}{1em}
\setlength{\parskip}{1em}
\raggedbottom
\begin{document}
import time
import random
import asyncio
from ib_insync import *
from collections import namedtuple
LiveFuturesSettings = namedtuple('LiveFuturesSettings',
'tickers, exchange, bar_size, whatToShow, influx_measurement, log_filename,')
from ibapi.wrapper import EWrapper
from ibapi.client import EClient
from ibapi.contract import Contract as IBcontract
from threading import Thread
import queue
import datetime
import time
import QuantLib as ql # version 1.5
#import matplotlib.pyplot as plt
#%matplotlib inline
# option data
maturity_date = ql.Date(1, 6, 2018)
spot_price = 2720
strike_price = 2725
volatility = 0.13 # the historical vols for a year
dividend_rate = 0.0
count_outcomes_by_condition <- function(my_data, cond){
ret = apply.weekly(na.omit(my_data), function(r){sum(eval(parse(text=cond)))})
names(ret)[1] = cond
return(ret)
}
xts2df <- function(x) {
res_qqq_df = xts2df(res_qqq)
data.frame(date=index(x), coredata(x))
}
class EditableCell extends React.Component {
state = {
value: this.props.value,
editable: this.props.editable || false,
};
componentWillReceiveProps(nextProps) {
if (nextProps.editable !== this.state.editable) {
this.setState({ editable: nextProps.editable });
if (nextProps.editable) {
this.cacheValue = this.state.value;
{
"__schema":{
"queryType":{
"name":"Query"
},
"mutationType":{
"name":"MyMutations"
},
"subscriptionType":null,
"types":[
upstream chronograf {
server influxdb.service.consul:8888;
}
upstream rabbitmq {
server rabbitmq.service.consul:15672;
}
upstream airflow {
server airflow.service.consul:8889;
...
class URLPrefixMiddleware(object):
def __init__(self, app, prefix=''):
self.app = app
self.prefix = prefix
def __call__(self, environ, start_response):
if environ['PATH_INFO'].startswith(self.prefix):
siakhnin@mac-korbel21:~/Documents/workspace/butler/provision/terraform/collaboratory/salt-master$ terraform apply -var-file ../collaboratory_credentials.tfvars
2017/01/12 20:57:42 [INFO] Terraform version: 0.8.4 a791ff09b29d063dd4b6da0cac04ad3b83c836f5
2017/01/12 20:57:42 [INFO] CLI args: []string{"/Users/siakhnin/Documents/workspace/go/bin/terraform", "apply", "-var-file", "../collaboratory_credentials.tfvars"}
2017/01/12 20:57:42 [DEBUG] Detected home directory from env var: /Users/siakhnin
2017/01/12 20:57:42 [DEBUG] Detected home directory from env var: /Users/siakhnin
2017/01/12 20:57:42 [DEBUG] Attempting to open CLI config file: /Users/siakhnin/.terraformrc
2017/01/12 20:57:42 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/01/12 20:57:42 [DEBUG] Detected home directory from env var: /Users/siakhnin
2017/01/12 20:57:42 [DEBUG] New state was assigned lineage "f6c68402-6178-44d5-8809-a7d75fcb98cd"
var.salt_master_ip