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 matplotlib.pyplot as plt | |
import pytz | |
import datetime as dt | |
from datetime import date | |
import streamlit as st | |
#st.set_option('deprecation.showPyplotGlobalUse', False) | |
import numpy as np | |
import os | |
import alpaca_trade_api as tradeapi |
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
os.environ["APCA_API_BASE_URL"] = "https://paper-api.alpaca.markets" | |
api = tradeapi.REST('{YOUR_ALPACA_API_KEY}','{YOUR_ALPACA_KEY_SECRET}', api_version='v2') | |
for ticker in top_movers.ticker.head(10): | |
try: | |
# Submit a market order to buy an amount of each ticker that was pulled from the top mover list | |
api.submit_order( | |
symbol=ticker, | |
qty=1, | |
side='buy', |
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 json | |
import pandas as pd | |
from datetime import datetime | |
import pytz | |
#!/usr/bin/env python | |
try: | |
# For Python 3.0 and later | |
from urllib.request import urlopen | |
except ImportError: | |
# Fall back to Python 2's urllib2 |
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 packages | |
import streamlit as st | |
import os | |
import alpaca_trade_api as tradeapi | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import requests | |
import math | |
from termcolor import colored as cl | |
import numpy as np |
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
from io import BytesIO | |
import requests | |
import time | |
import pandas as pd | |
def earnings_history_api(api_key, symbol): | |
assert symbol is not None | |
symbol = symbol.strip().upper() | |
url = f"{BASE_URL}function=EARNINGS&symbol={symbol}&apikey={api_key}" |
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
from io import BytesIO | |
import requests | |
import time | |
import pandas as pd | |
def earnings_calendar_api(api_key, horizon, symbol=None): | |
if symbol is not None: | |
url = f'{BASE_URL}function=EARNINGS_CALENDAR&symbol={symbol}&horizon={horizon}&apikey={api_key}' | |
response = requests.get(url) | |
else: |
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 arbitrage_scan(graph): | |
arb_checks = [] | |
for c1, c2 in combinations(graph.nodes, 2): | |
# print('paths from ', c1, 'to ', c2) | |
for path in nx.all_simple_paths(graph, c1, c2): | |
path_weight1 = 1 | |
for i in range(len(path) - 1): | |
# print(g[path[i]][path[i+1]]['weight']) |
NewerOlder