View alpha_vantage_short_start.py
This file contains 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
from alpha_vantage.timeseries import TimeSeries | |
# Your key here | |
key = 'yourkeyhere' | |
ts = TimeSeries(key) | |
aapl, meta = ts.get_daily(symbol='AAPL') | |
print(aapl['2019-09-12']) |
View alpha_vantage_get_started.py
This file contains 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
''' | |
On your terminal run: | |
pip install alpha_vantage | |
This also uses the pandas dataframe, and matplotlib, commonly used python packages | |
pip install pandas | |
pip install matplotlib | |
For the develop version run: | |
pip install git+https://github.com/RomelTorres/alpha_vantage.git@develop |
View threading_alpha_vantage.py
This file contains 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
from alpha_vantage.timeseries import TimeSeries | |
import threading | |
import os | |
# I use an environment vairable to get my key, | |
# you can also just hardcode your key in the code to test this | |
KEY = os.path.expandvars("$ALPHA_VANTAGE_HIGHER_KEY") | |
ts = TimeSeries(key=KEY, output_format='pandas') | |
# 10 tickers from the NASDAQ-100 | |
tickers = ['ATVI','ADBE','AMD','ALXN','ALGN', 'GOOG', 'AMZN', 'AAL', 'ADI', 'AMAT'] |
View threadpoolexecutor.py
This file contains 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
# For python 3.2+ | |
from alpha_vantage.timeseries import TimeSeries | |
from concurrent.futures import ThreadPoolExecutor | |
import os | |
KEY = os.path.expandvars("$ALPHA_VANTAGE_HIGHER_KEY") | |
ts = TimeSeries(key=KEY, output_format='pandas') | |
tickers = ['ATVI','ADBE','AMD','ALXN','ALGN', 'GOOG', 'AMZN', 'AAL', 'ADI', 'AMAT'] | |
def thread_pool(): |
View threadpoolexecutor_full.py
This file contains 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
from alpha_vantage.timeseries import TimeSeries | |
from concurrent.futures import ThreadPoolExecutor | |
import os | |
KEY = os.path.expandvars("$ALPHA_VANTAGE_HIGHER_KEY") | |
ts = TimeSeries(key=KEY, output_format='pandas') | |
tickers = ['ATVI','ADBE','AMD','ALXN','ALGN', 'GOOG', 'AMZN', 'AAL', 'ADI', 'AMAT'] | |
def thread_pool(): | |
with ThreadPoolExecutor(max_workers=10) as executor: |
View https_redirect.js
This file contains 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
var app = express() | |
// Make sure you call this before you call any app.get functions. | |
app.use(requireHTTPS); | |
// code here, with gets and such | |
function requireHTTPS(req, res, next) { | |
// The 'x-forwarded-proto' check is for Heroku | |
if (!req.secure && req.get('x-forwarded-proto') !== 'https' && process.env.NODE_ENV !== "development") { | |
return res.redirect('https://' + req.get('host') + req.url); |
View vendor_compare.py
This file contains 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
# You'll need 3 environment variables API keys to run this | |
# ALPHAVANTAGE_API_KEY | |
# INTRINIO_PROD_KEY | |
# IEX_TOKEN | |
# Sometimes the vendor will error out the API call and you'll have to call it again.... | |
from __future__ import print_function | |
import pandas as pd | |
import threading |
View tradier_sample.py
This file contains 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 | |
import json | |
ticker = 'TSLA' | |
# Only US tickers in the developer account | |
token = 'XXXXX' | |
# Get a sandbox/developer token here: https://developer.tradier.com/ | |
headers = {'Authorization': 'Bearer {}'.format(token), | |
'Accept': 'application/json'} |
View sample_xignite.py
This file contains 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 | |
import json | |
token = 'XXXXX' | |
# Get an Xignite token from https://www.xignite.com/Register | |
url = "http://globalcurrencies.xignite.com/xGlobalCurrencies.json/ListCurrencies?_token={}".format(token) | |
response = requests.get(url) | |
print(response.json()) |
View intrinio_sample.py
This file contains 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 | |
import json | |
key = 'XXXX' | |
# Get a key from https://intrinio.com/ | |
ticker = 'MSFT' | |
url = 'https://api-v2.intrinio.com/companies/{}?api_key={}'.format(ticker, key) | |
response = requests.get(url) | |
print(response.json()) |
OlderNewer