forked from lab/TPM
parent
42542d5626
commit
603abc0f09
11 changed files with 53 additions and 23 deletions
@ -0,0 +1,17 @@ |
||||
# Byte-compiled / optimized / DLL files |
||||
.ipynb_checkpoints/ |
||||
__pycache__/ |
||||
.DS_Store |
||||
.vscode/ |
||||
|
||||
tpm/ |
||||
|
||||
# Distribution / packaging |
||||
main.old.py |
||||
postgres_runner.py |
||||
*.ipynb |
||||
*.csv |
||||
backup.sql |
||||
tickers_sorted_tw.py |
||||
tickers_sorted.py |
||||
main_old.py |
||||
@ -1,8 +1,8 @@ |
||||
FROM python:3.9.6 |
||||
WORKDIR /flask |
||||
ADD . /flask |
||||
RUN apt update |
||||
RUN apt install nano |
||||
#RUN apt update |
||||
#RUN apt install nano |
||||
RUN pip install --upgrade pip |
||||
RUN pip3 install -r requirements.txt |
||||
EXPOSE 8000 |
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,15 +0,0 @@ |
||||
import os |
||||
import json |
||||
dir_path = os.path.dirname(os.path.realpath(__file__)) |
||||
dir_abspath = os.path.abspath(dir_path) |
||||
print("Abs Path : ",dir_abspath) |
||||
dir_list = os.listdir(dir_path) |
||||
|
||||
print("Files and directories in '", dir_path, "' :") |
||||
|
||||
# prints all files |
||||
print(dir_list) |
||||
with open('/flask/data_init/assets_us.json') as f: |
||||
data_tw = json.load(f) |
||||
print(data_tw) |
||||
|
||||
@ -0,0 +1,26 @@ |
||||
import pandas as pd |
||||
import yfinance as yf |
||||
import json |
||||
#download sp500 list |
||||
sp500url = 'https://en.wikipedia.org/wiki/List_of_S%26P_500_companies' |
||||
sp500 = pd.read_html(sp500url, header=0)[0] |
||||
sp500 = sp500[['Symbol', 'Security']] |
||||
sp500.columns = ['ticker', 'name'] |
||||
sp500 = sp500.set_index('ticker')['name'].to_dict() |
||||
#download NASDQ list |
||||
nasdaqurl = 'https://en.wikipedia.org/wiki/NASDAQ-100' |
||||
nasdaq = pd.read_html(nasdaqurl, header=0)[4] |
||||
nasdaq = nasdaq[['Ticker', 'Company']] |
||||
nasdaq.columns = ['ticker', 'name'] |
||||
nasdaq = nasdaq.set_index('ticker')['name'].to_dict() |
||||
#Add nasdaq after sp500 |
||||
sp500.update(nasdaq) |
||||
#Add Special stocks after sp500 |
||||
stocks = {"BTC-USD":"BTC-USD | Bitcoin USD", "ETH-USD" : "ETH-USD | Ethereum USD", "SPY" : "SPDR S&P 500 ETF Trust","IEF" : "iShares 7-10 Year Treasury Bond ETF", |
||||
"IAU": "iShares Gold Trust","XME":"SPDR S&P Metals & Mining ETF" ,"XLI":" Industrial Select Sector SPDR Fund","XLRE":"Real Estate Select Sector SPDR Fund", |
||||
"XLF":"Financial Select Sector SPDR Fund","XLE":"Energy Select Sector SPDR Fund","XLK":"Technology Select Sector SPDR Fund","XTL":"SPDR S&P Telecom ETF","XLP":"Consumer Staples Select Sector SPDR Fund","XLY":"Consumer Discretionary Select Sector SPDR Fund" |
||||
,"XLU":"Utilities Select Sector SPDR Fund","XLV":"Health Care Select Sector SPDR Fund"} |
||||
sp500.update(stocks) |
||||
#save as json |
||||
with open('assets_us.json', 'w') as f: |
||||
json.dump(sp500, f) |
||||
Loading…
Reference in new issue