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
do $$ declare declare begin for i in 1 .. 1000 loop execute 'create table myt' || i || '(check (id between ' || (i * 99) || ' and ' || (i * 100) || ' )) inherits(size_m)'; end loop; end; $$; |
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
PROG = run | |
OBJS = main.o | |
all: $(PROG) | |
$(PROG): $(OBJS) | |
$(CC) -o $(PROG) $(OBJS) | |
clean: | |
rm -f $(OBJS) $(PROG) |
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
PROG = run | |
OBJS = main.o | |
all: $(PROG) | |
$(PROG): $(OBJS) | |
$(CC) -o $(PROG) $(OBJS) | |
clean: | |
rm -f $(PROG) $(OBJS) |
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
package main | |
import "log" | |
import "net" | |
import "os" | |
var gaddr *net.UDPAddr = &net.UDPAddr{IP: net.IPv4(224, 0, 0, 254), Port: 12345} | |
func listener(c chan int) { | |
logger := log.New(os.Stdout, "[L]", log.Ltime | log.Lshortfile) | |
conn, err := net.ListenMulticastUDP("udp", nil, gaddr) |
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
# For this example, we're going to write a simple momentum script. | |
# When the stock goes up quickly, we're going to buy; | |
# when it goes down we're going to sell. | |
# Hopefully we'll ride the waves. | |
from collections import deque | |
import math | |
import talib | |
atr = ta.ATR(timeperiod=20) # used to calculate 20-day ATR |
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 matplotlib.pyplot as plt | |
from datetime import datetime | |
import alpaca_trade_api as tradeapi | |
import numpy as np | |
from positionhandling import positionHandler | |
import loader | |
api = tradeapi.REST() |
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 argparse | |
import sys | |
import tempfile | |
from time import time | |
import random | |
from os import listdir | |
from os.path import isfile, join | |
import pandas |
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 pandas as pd | |
''' | |
brew install phantomjs | |
or | |
brew tap homebrew/cask | |
brew cask install chromedriver | |
''' | |
# from selenium import webdriver | |
from selenium.webdriver.chrome.webdriver import WebDriver |
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 iexfinance | |
import pandas as pd | |
def iex_charts(symbols): | |
partlen = 99 | |
result = {} | |
for i in range(0, len(symbols), partlen): | |
charts = iexfinance.Stock(symbols[i:i+partlen]).get_chart(range='1m') | |
if type(charts) == list: | |
charts = {symbols[i]: charts} |
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
epoch | replicated | original | |
---|---|---|---|
2018-07-23 00:00:00-04:00 | 0.0 | 0.0 | |
2018-07-24 00:00:00-04:00 | 0.004842152599199184 | 0.005032119914346984 | |
2018-07-25 00:00:00-04:00 | 0.014004961318249324 | 0.013597430406852257 | |
2018-07-26 00:00:00-04:00 | 0.010925193556577603 | 0.011206281227694456 | |
2018-07-27 00:00:00-04:00 | 0.004277340381589269 | 0.004354032833690319 | |
2018-07-30 00:00:00-04:00 | -0.0014288588707714984 | -0.0008922198429693077 | |
2018-07-31 00:00:00-04:00 | 0.0034754019979314626 | 0.004032833690221255 | |
2018-08-01 00:00:00-04:00 | 0.0024404618505173285 | 0.0023554603854390615 | |
2018-08-02 00:00:00-04:00 | 0.007497095460409252 | 0.007815845824411126 |