Skip to content

Instantly share code, notes, and snippets.

@a8lo
a8lo / list.md
Created November 21, 2024 14:38 — forked from ih2502mk/list.md
Quantopian Lectures Saved
@a8lo
a8lo / options.adoc
Created November 21, 2024 14:40 — forked from johnymontana/options.adoc
My entry for the Neo4j GraphGist December competition. Very simplified options trading in a graph.

Options Trading As A Graph


Introduction

This GraphGist will begin to explore how stock option data can be modeled as a graph, some simple Cypher queries for calculating payout at expiration for an options contract and a very basic look at finding profitable options trades given a specific forecast. Please note that some of the concepts here have been simplified and are only meant as an educational overview of exploring Neo4j and graph data modeling.

@a8lo
a8lo / tickbar_generator.py
Created November 21, 2024 14:40 — forked from GerardBCN/tickbar_generator.py
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