Skip to content

Instantly share code, notes, and snippets.

@otbbdeploy
otbbdeploy / 2018-09-01-article_signal_list.csv
Created August 31, 2018 13:24
Data From ZRX Trading Article
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 10.
,signal_index,signal_direction,signal_definition
1,0,positive,"macd histogram(12,26,9) > 0 and slope of macd histogram(12,26,9) over 1 period crosses below 0"
3,1,positive,"macd histogram(12,26,9) > 0 and slope of macd histogram(12,26,9) over 1 period crosses below 0"
5,2,positive,"macd histogram(12,26,9) > 0 and slope of macd histogram(12,26,9) over 1 period crosses below 0"
7,3,positive,"macd histogram(12,26,9) > 0 and slope of macd histogram(12,26,9) over 1 period crosses below 0"
9,4,negative,"macd histogram(12,26,9) < 0 and slope of macd histogram(12,26,9) over 1 period crosses above 0"
11,5,negative,"macd histogram(12,26,9) < 0 and slope of macd histogram(12,26,9) over 1 period crosses above 0"
13,6,negative,"macd histogram(12,26,9) < 0 and slope of macd histogram(12,26,9) over 1 period crosses above 0"
16,7,negative,"macd histogram(12,26,9) < 0 and slope of macd histogram(12,26,9) over 1 period crosses above 0"
17,8,negative,"macd histogram(12,26,9) < 0 and slope of macd histogram(12,26,9) over 1 perio
# Set up the color scales
bupu = cl.scales['3']['seq']['BuPu']
colorscale = cl.interp( bupu, 16 )
colorscale.reverse()
# Create the data structure needed for plotly
i=0
data = []
while i < len(test_periods):
for p in test_periods:
# Print our progress
print('Running test period ' + str(p));
# Create the condition
condition = 'price change percentage(1) < ' + str(p)
# Form the request
request_data = {'symbol':symbol,'condition_id':1,'condition':condition,"periods":periods,'from':usingdatafrom,'to':usingdatato}
symbol = 'BTC:USD:daily'
test_periods = np.arange(-0.10,0,0.02)
periods = 45
usingdatafrom = "2017-01-09"
usingdatato = "2018-01-09"
apikey = "<your_api_key>" # enter your own API key here (to request an API key visit gatsiva.com)
data_run_list = [] # List for mean return information
obs_num_list = [] # List for storing number of observations in each run
# Import utility libraries we will need
import requests
import json
import numpy as np
import pandas as pd
import warnings
import colorlover as cl
# Import plotly for graphing awesomeness
from plotly import __version__