Skip to content

Instantly share code, notes, and snippets.

def set_up_dag_run(context, dag_run_obj):
dag_run_obj.payload = {"config": context["config"]}
dag_run_obj.run_id = str(uuid4())
print context
return dag_run_obj
def launch_workflow_command(args):
config_location = args.config_location
analysis_id = args.analysis_id
\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):