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
def define_edges(crypto_ids, crypto_abbreviations, crypto_data): | |
# initialize the graph and an empty list for edges | |
graph = nx.DiGraph() | |
edges = [] | |
# define all edges and add to graph | |
for coin1 in crypto_ids: | |
for coin2 in crypto_ids: | |
if coin1 != coin2: | |
# find the index of coin1 and coin2 in the ids list. Use those values to get the abbreviations |
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
def get_coingecko_data(crypto_ids, crypto_abbreviations): | |
# define the base url and another piece that will be added later | |
base = 'https://api.coingecko.com/api/v3/simple/price?ids=' | |
vs_currencies_string= '&vs_currencies=' | |
# determine the number of ids in the list. This will help us know how many commas to add to the url | |
id_remaining = len(crypto_ids) | |
# loop through each coin and append its id to the url. Decrease id_remaining each iteration, add a comma to the url if it is needed | |
for coin in crypto_ids: |
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
# load required packages (must be previously installed) | |
import json | |
import requests | |
import networkx as nx | |
from itertools import combinations | |
import pandas as pd | |
pd.options.display.max_rows = 1000 | |
# define the lists of ids and abbreviations | |
# make sure the abbreviations are in the same order as the corresponding cryptos in the id_list |
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 cbpro | |
import os | |
import websocket | |
import pprint | |
import ta | |
import numpy as np | |
import pandas as pd | |
import cbpro, time | |
public_client = cbpro.PublicClient() |
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 os | |
import alpaca_trade_api as tradeapi | |
import pandas as pd | |
import numpy as np | |
import boto3 | |
import ta | |
s3 = boto3.client('s3') | |
sns = boto3.client('sns') |
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
# Define function directory | |
ARG FUNCTION_DIR="/function" | |
FROM python:buster as build-image | |
# Install aws-lambda-cpp build dependencies | |
RUN apt-get update && \ | |
apt-get install -y \ | |
g++ \ | |
make \ |
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 sys | |
def handler(event, context): | |
return 'Hello from AWS Lambda using Python' + sys.version + '!' |
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 pandas as pd | |
import sklearn | |
import xgboost as xgb | |
def handler(event, context): | |
message = [] | |
message.append('The xgboost version is {}.'.format(xgb.__version__)) | |
message.append('The scikit-learn version is {}.'.format(sklearn.__version__)) | |
message.append('The pandas version is {}.'.format(pd.__version__)) |
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 pandas as pd | |
import sklearn | |
import xgboost as xgb | |
def handler(event, context): | |
message = [] | |
message.append('The xgboost version is {}.'.format(xgb.__version__)) | |
message.append('The scikit-learn version is {}.'.format(sklearn.__version__)) | |
message.append('The pandas version is {}.'.format(pd.__version__)) |
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
# Define function directory | |
ARG FUNCTION_DIR="/function" | |
FROM python:buster as build-image | |
# Install aws-lambda-cpp build dependencies | |
RUN apt-get update && \ | |
apt-get install -y \ | |
g++ \ | |
make \ |