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
from flask import Flask | |
from time import sleep | |
from concurrent.futures import ThreadPoolExecutor | |
# DOCS https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ThreadPoolExecutor | |
executor = ThreadPoolExecutor(2) | |
app = Flask(__name__) | |
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
def getDiff(symbol,hours): | |
""" function to calculate Daily Returns | |
ohlc4 = (open+high+low+close)/4 | |
""" | |
delta = ohlc4_today(symbol)-ohlc_yesterday(hours) | |
return delta/ohlc_yesterday(hours) | |
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
from collections import defaultdict | |
from itertools import chain | |
from operator import methodcaller | |
# dictionaries with non-equal keys, values all lists for simplicity | |
one = {'a': {1, 2}, 'c': [5, 6], 'b': [3, 4], 'e': [6.2]} | |
two = {'a': {2.4, 3.4}, 'c': [5.6, 7.6], 'b': [3.5, 4.5], 'f': [1.3]} | |
three = {'a': [1.2], 'c': [3.4], 'b': [2.3], 'e': [3.1],'f':[1,2,3,4,5]} | |
dict_list = [one,two,three] |
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
############################ | |
# Build tools binaries in separate image | |
############################ | |
FROM golang:alpine AS tools | |
ENV TOOLS_VERSION 0.4.1 | |
RUN apk update && apk add --no-cache git \ | |
&& mkdir -p ${GOPATH}/src/github.com/timescale/ \ | |
&& cd ${GOPATH}/src/github.com/timescale/ \ |
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
FROM gliderlabs/alpine:3.3 | |
RUN \ | |
apk --update add autoconf autoconf-doc automake c-ares c-ares-dev curl gcc libc-dev libevent libevent-dev libtool make man openssl-dev pkgconfig && \ | |
curl -o /tmp/pgbouncer-1.9.0.tar.gz -L https://pgbouncer.github.io/downloads/files/1.9.0/pgbouncer-1.9.0.tar.gz && \ | |
cd /tmp && \ | |
tar xvfz /tmp/pgbouncer-1.9.0.tar.gz && \ | |
cd pgbouncer-1.9.0 && \ | |
./configure --prefix=/usr && \ |
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
from sklearn.qda import QDA | |
#from sklearn.ensemble import RandomForestRegressor | |
from sklearn import preprocessing | |
import numpy as np | |
import pandas as pd | |
def initialize(context): | |
context.assets = sid(8554) # Trade SPY | |
context.model = QDA() | |
context.lookback = 5 # Look back |
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
#!/bin/bash | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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
#!/usr/bin/env python2 | |
# -*- coding: utf-8 -*- | |
import boto3 | |
class AmazonTask(object): | |
def __init__(self,amazon_key,secret_key,bucket_name): | |
self.amazon_key=amazon_key | |
self.bucket_name=bucket_name | |
self.aws_secret=secret_key |
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
from amadeus import Flights | |
flights = Flights('QMrAAoM8koigSU9t1FCfWVALLoFT1DKv') | |
resp = flights.extensive_search( | |
origin='NCE', | |
destination='LAS', | |
departure_date='2017-11-25--2017-11-30', | |
duration='4--10') | |
print resp |
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
import couchbase.subdocument as SD | |
from couchbase.bucket import Bucket | |
# Connecting to DB | |
cb = Bucket('couchbase:///www', username = 'user_arsh',password='Amber252556!@') | |
# Creating DB | |
cb.upsert('55',{'55':[{'text':'text','user_id':'user_id','created_at':'created_at','time':'time'}]}) # only run once |
NewerOlder