Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Get it Done! "Engineer"

Arshpreet Singh arshpreetsingh

💭
Get it Done! "Engineer"
View GitHub Profile
View Dockerfile
############################
# 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/ \
View Dockerfile
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 && \
@arshpreetsingh
arshpreetsingh / script.sh
Created Apr 8, 2018
HyperLedger pre-req installtion script
View script.sh
#!/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,
@arshpreetsingh
arshpreetsingh / flask_parallel.py
Created Oct 3, 2017
run flask in parallel using thread pool executor
View flask_parallel.py
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__)
@arshpreetsingh
arshpreetsingh / ama.py
Created Sep 26, 2017
amazon_uploader using boto3
View ama.py
#!/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
View ama2_flight_search.py
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
@arshpreetsingh
arshpreetsingh / coucg_db.py
Created Jul 10, 2017
CouchBD_Python-Operations
View coucg_db.py
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
View Order_API.py
#!/usr/bin/python
# required imports
import requests
class TradeClient(object):
""" Client for tradidng through WebAPI
"""
View model1_ml.py
"""
Important notes about model
Training Machine-Learning model is trained every Monday (I found that if I train my model every-day it shows less returns)
Trading is happening after each 10 minutes
Machine_learning Model:
I am using two independent Features: '5 minutes price change' and '15 minutes price change'
View QDA_case.py
# Use the previous 10 bars' movements to predict the next movement.
# Use a random forest classifier. More here: http://scikit-learn.org/stable/user_guide.html
#from sklearn.ensemble import RandomForestRegressor
import numpy as np
from sklearn.qda import QDA
def initialize(context):
context.security = sid(8554) # Trade SPY