Skip to content
Snippets Groups Projects
Commit 4ef18cea authored by David Matthew Antonio's avatar David Matthew Antonio
Browse files

Stuff

parent cd257018
No related branches found
No related tags found
No related merge requests found
......@@ -2,32 +2,10 @@ import config
import interface
from controllers import stocks
import multiprocessing as mp
from utility import data_fetcher
print("Acquiring exchanges")
try:
stocks.retrieve_exchanges()
except:
print("Cannot retrieve exchanges from the API")
exit()
else:
print("Exchange list updated!")
# Due to API Limits, only Philippine stocks are considered
print("Acquiring tickers")
try:
tickers = stocks.retrieve_tickers("PSE")
except:
print("Cannot retrieve tickers from the API")
exit()
else:
print("Ticker list updated!")
print("Acquiring stock data")
processes = [mp.Process(target = stocks.retrieve_eod_historical_data, args = ("PSE", i["Code"])) for i in tickers]
for p in processes:
p.start()
for p in processes:
p.join()
if (config.FETCH_ON_RUN):
data_fetcher.run()
print("Initializing gradio app")
gradio_app = interface.initialize()
......
......@@ -8,7 +8,7 @@ STOCKS_DIRECTORY = 'stocks/'
EXCHANGES_FILEPATH = 'exchanges.json'
# Some flags
INITIALIZE_ON_RUN = True
FETCH_ON_RUN = True
GRADIO_PUBLIC = True
LLM_MODEL = "gpt-4o-mini"
......
from controllers import stocks
import multiprocessing as mp
def run():
print("Acquiring exchanges")
try:
stocks.retrieve_exchanges()
except:
print("Cannot retrieve exchanges from the API")
exit()
else:
print("Exchange list updated!")
# Due to API Limits, only Philippine stocks are considered
print("Acquiring tickers")
try:
tickers = stocks.retrieve_tickers("PSE")
except:
print("Cannot retrieve tickers from the API")
exit()
else:
print("Ticker list updated!")
print("Acquiring stock data")
processes = [mp.Process(target = stocks.retrieve_eod_historical_data, args = ("PSE", i["Code"])) for i in tickers]
for p in processes:
p.start()
for p in processes:
p.join()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment