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.
This file contains hidden or 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
# 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 |
Lecture 1: Introduction to Research — [📝Lecture Notebooks] [
Lecture 2: Introduction to Python — [📝Lecture Notebooks] [
Lecture 3: Introduction to NumPy — [📝Lecture Notebooks] [
Lecture 4: Introduction to pandas — [📝Lecture Notebooks] [
Lecture 5: Plotting Data — [📝Lecture Notebooks] [[