Skip to content

Instantly share code, notes, and snippets.

@GerardBCN
GerardBCN / manipulation_explorer.ipynb
Created July 16, 2018 12:48
Statistical analysis of Bitcoin price manipulation by Tether issuance in late 2017
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GerardBCN
GerardBCN / policy_iterator_RL_gridworld.ipynb
Created December 20, 2018 13:59
Policy iterator for RL applied to gridworld
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GerardBCN
GerardBCN / monte_carlo.ipynb
Last active July 31, 2020 01:58
State-value function approximation for the gridworld task using Monte Carlo simulations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GerardBCN
GerardBCN / gist:9e0357c70873a2cfe5788d610b2d8261
Created December 24, 2018 19:13
Using temporal-difference - TD(0) or one-step TD to solve the gridworld task
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GerardBCN
GerardBCN / stock_price_autoencoding.ipynb
Created January 18, 2019 21:15
Stock market Bitcoin data compression with autoencoders
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GerardBCN
GerardBCN / tickbar_generator.py
Created April 22, 2019 19:02
Tickbar generator
# expects a numpy array with trades
# each trade is composed of: [time, price, quantity]
def generate_tickbars(ticks, frequency=1000):
times = ticks[:,0]
prices = ticks[:,1]
volumes = ticks[:,2]
res = np.zeros(shape=(len(range(frequency, len(prices), frequency)), 6))
it = 0
for i in range(frequency, len(prices), frequency):
res[it][0] = times[i-1] # time
def returns(candles_close_prices):
return np.diff(np.log(candles_close_prices))
Value Meaning
DB-statistic << 2 positive serial correlation
DB-statistic ~ 2 no first-order correlation
DB-statistic >> 2 negative serial correlation
@GerardBCN
GerardBCN / dollarbar_generator.py
Created April 26, 2019 15:59
Dollar bar generator
import numpy as np
# expects a numpy array with trades
# each trade is composed of: [time, price, quantity]
def generate_dollarbars(trades, frequency=1000):
times = trades[:,0]
prices = trades[:,1]
volumes = trades[:,2]
ans = np.zeros(shape=(len(prices), 6))
candle_counter = 0
@GerardBCN
GerardBCN / volumebar_generator.py
Created April 26, 2019 16:00
Volume bar generator
import numpy as np
# expects a numpy array with trades
# each trade is composed of: [time, price, quantity]
def generate_volumebars(trades, frequency=10):
times = trades[:,0]
prices = trades[:,1]
volumes = trades[:,2]
ans = np.zeros(shape=(len(prices), 6))
candle_counter = 0