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
#!/usr/bin/env python | |
""" | |
Read Lobster orderbook files to Python Pandas DataFrame | |
""" | |
import click | |
import os | |
import pandas as pd | |
from pandas.io.common import ZipFile |
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
import requests | |
from pandas.io.common import urlencode | |
from pandas.tseries.frequencies import to_offset | |
ALPHAVANTAGE_API_URL = "http://www.alphavantage.co/query" | |
ALPHAVANTAGE_API_KEY_DEFAULT = "demo" | |
def _init_session(session): |
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
# Download Data Using Alphavantage | |
using HTTP | |
using StatPlots | |
res = HTTP.get("https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=AAPL&interval=1min&apikey=your_api_key&datatype=csv") | |
mycsv = readcsv(res.body) | |
x = convert(DataFrame, mycsv) | |
x = x[2:nrow(x),:] # subset remove header row | |
# Rename Columns | |
colnames = ["Date","Open","High","Low","Close","Volume"] |
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
############################################################### | |
# exit first profitable price over entry | |
# exit after fixed bars (max_hold) if no profitable trade | |
############################################################### | |
signal = [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] | |
close = [10,10,8,3,14,5,6,2,4,22,2,1,1,1,10,3,3,3,3,3,3,30] | |
first_prof = zero(signal) | |
max_hold = 6 | |
for i = 1:length(signal) # 1:length(signal)-1 if buying next bar at open |
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
Verifying my Blockstack ID is secured with the address 14BzAGWqh8hx72DZ7J5Df71fAeWMzKrckH https://explorer.blockstack.org/address/14BzAGWqh8hx72DZ7J5Df71fAeWMzKrckH |
OlderNewer