Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 cpcv_generator(t_span, n, k, verbose=True): | |
# split data into N groups, with N << T | |
# this will assign each index position to a group position | |
group_num = np.arange(t_span) // (t_span // n) | |
group_num[group_num == n] = n-1 | |
# generate the combinations | |
test_groups = np.array(list(itt.combinations(np.arange(n), k))).reshape(-1, k) | |
C_nk = len(test_groups) | |
n_paths = C_nk * k // n |
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 python3 | |
'''2021-03-26: Reverse-engineer by searching for the following terms in features*.js: | |
- bracketMaintenanceMarginRate | |
- cumFastMaintenanceAmount | |
- bracketNotionalFloor | |
- bracketNotionalCap''' | |
# (max) position, maintenance margin, maintenance amount | |
maint_lookup_table = [ |
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
# Store the short term moving average in a new column 'window_ST' | |
prices.loc[:, 'window_ST'] = prices['close'].rolling( | |
context.short_term_window).mean() | |
# Store the long term moving average in a new column 'window_LT' | |
prices.loc[:, 'window_LT'] = prices['close'].rolling( | |
context.long_term_window).mean() | |
# Get the latest signal, 1 for golden cross, -1 for death cross | |
prices.loc[:, 'signal'] = np.where( |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
Date Open High Low Close Volume | |
2020-05-06 18:15:00-04:00 2832 2838.5 2832 2838 3750 | |
2020-05-06 18:30:00-04:00 2838 2838.5 2826 2827.75 6864 | |
2020-05-06 18:45:00-04:00 2827.75 2830.5 2827 2829.5 2937 | |
2020-05-06 19:00:00-04:00 2829.5 2830.5 2823 2826.5 4619 | |
2020-05-06 19:15:00-04:00 2826.75 2829.5 2825.25 2827.75 3610 | |
2020-05-06 19:30:00-04:00 2827.75 2829.5 2825.5 2826.75 2460 | |
2020-05-06 19:45:00-04:00 2826.75 2830.75 2826.25 2830.5 2531 | |
2020-05-06 20:00:00-04:00 2830.5 2833.5 2830.25 2833.5 2361 |
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 select | |
import datetime | |
import psycopg2 | |
import psycopg2.extensions | |
conn = psycopg2.connect(database="postgres", user="vagrant") | |
#conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) | |
curs = conn.cursor() |
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 select | |
import datetime | |
import psycopg2 | |
import psycopg2.extensions | |
from sqlalchemy import create_engine, text | |
engine = create_engine("postgresql+psycopg2://vagrant@/postgres") |
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 numpy as np | |
import matplotlib.pyplot as plt | |
import tensorflow as tf | |
import tensorflow.keras.layers as layers | |
import tensorflow.keras.losses as loss | |
import tensorflow_datasets.public_api as tfds | |
from sys import argv | |
from random import Random | |
from os import walk |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/python2.7 | |
"""Quick hack of 'modern' OpenGL example using pysdl2 and pyopengl | |
that shows a textured triangle; assumes there is a 'hazard.png' image | |
file in working directory. | |
Based on: | |
pysdl2 OpenGL example | |
http://www.tomdalling.com/blog/modern-opengl/02-textures/ | |
http://www.arcsynthesis.org/gltut/Basics/Tut02%20Vertex%20Attributes.html |