Skip to content

Instantly share code, notes, and snippets.

@tibkiss
tibkiss / main.py
Created August 30, 2021 08:48 — forked from f0ster/main.py
quantconnect wheel strategy example
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@tibkiss
tibkiss / fio.sh
Created September 6, 2020 09:19 — forked from fdegir/fio.sh
fio
#!/bin/bash
RESULT_FILE=/tmp/result_$$
rm -rf $HOME/tmp-fio
mkdir -p $HOME/tmp-fio && cd $HOME/tmp-fio
echo "Starting storage tests"
echo "Results will be saved in $RESULT_FILE"
@tibkiss
tibkiss / awk_netstat.sh
Created March 6, 2019 14:45 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
curl -Lo docker-machine-driver-hyperkit https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-hyperkit \
&& chmod +x docker-machine-driver-hyperkit \
&& sudo cp docker-machine-driver-hyperkit /usr/local/bin/ \
&& rm docker-machine-driver-hyperkit \
&& sudo chown root:wheel /usr/local/bin/docker-machine-driver-hyperkit \
&& sudo chmod u+s /usr/local/bin/docker-machine-driver-hyperkit
source ~/.zplug/init.zsh
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "chrissicool/zsh-256color"
zplug "srijanshetty/docker-zsh"
zplug "unixorn/git-extra-commands"
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-history-substring-search"
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/jira", from:oh-my-zsh
@tibkiss
tibkiss / ingest_csvdir.py
Created October 16, 2017 19:26
csv ingestor which forward fills missing daily data & loads split/dividends from yahoo finance
"""
Module for building a complete dataset from local directory with csv files.
"""
import os
import glob
import logbook
import requests
#from retry import retry
from numpy import empty, NaN
import pandas as pd
#https://github.com/RomelTorres/alpha_vantage
from alpha_vantage.timeseries import TimeSeries
ALPHA_VANTAGE_KEY = 'XXXXXXXXXXXX'
##################################
# Alpha vantage version of data.history and data.current
def av_data_history(assets, fields, bar_count, frequency):
ts = TimeSeries(key=ALPHA_VANTAGE_KEY, output_format='pandas')
import os
import numpy as np
import pandas as pd
from pandas_datareader.data import DataReader
from pandas_datareader._utils import RemoteDataError
import requests
from zipline.utils.cli import maybe_show_progress
@tibkiss
tibkiss / ingest_iqfeed.py
Created September 20, 2017 05:05
Zipline IQFeed CSV Ingestor
import os
import glob
import numpy as np
import pandas as pd
import requests
from pandas_datareader.data import DataReader
from pandas_datareader._utils import RemoteDataError
@tibkiss
tibkiss / extension.py
Last active October 27, 2018 22:44
Zipline Google Downloader
import os
import glob
import numpy as np
import pandas as pd
from pandas_datareader.data import DataReader
import datetime
import requests
from zipline.utils.calendars import get_calendar