Commit 9fa7d765 authored by Robert's avatar Robert
Browse files

diagram, load testing and some client stuff

parent b5c29d96
https://www.kaggle.com/qks1lver/amex-nyse-nasdaq-stock-histories
https://www.kaggle.com/proselotis/financial-ipo-data
https://www.kaggle.com/cnic92/200-financial-indicators-of-us-stocks-20142018
https://www.kaggle.com/miguelaenlle/massive-stock-news-analysis-db-for-nlpbacktests
\ No newline at end of file
<mxfile host="Electron" modified="2021-12-13T00:18:41.943Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/15.8.7 Chrome/91.0.4472.164 Electron/13.6.2 Safari/537.36" etag="USw_IEbwi30jPkCE4taQ" version="15.8.7" type="device"><diagram id="R2lEEEUBdFMjLlhIrx00" name="Page-1">7V3bcuK4Fv0aXqYqKd+BRyCdPj3VOc2ZzNTpfpoStsCaNpZHFgnM14/kC9iSIYRgiwRVpbqxLMu21tJlr70l9+zJcv2ZgCR8wAGMepYRrHv2Xc+yLMOz2H88ZVOk2JabpywICvI0c5fwiP6BRaJRpK5QANNaRopxRFFST/RxHEOf1tIAIfi5nm2Oo/pdE7CAUsKjDyI59f8ooGGeOnCNXfp/IFqE5Z1NozizBGXmIiENQYCfa0lwTe9xTItHnEKyBDGMKTvzAMhPSHrup5BS/qajnnXP/uY89+0C40UEQYLSWx8vWbKfsiz3c7BEEa/nSkHjoiB2O/tTz54QjGn+a7mewIiDVcKQP9P9nrPbeiC83CMu+OP7/x6M/w6ff4XW+Iv3EGAa/HFTlPIEolVRv48U+z+LCqKbstbTZ7SM2Cv07DF/5cfijMGO/RBFwVewwSv+GCkF/s/yaBxigv5h+UHETpksgZ0mtCCVbdRyPPIrizIJTFmeafluppD0ANa1jF9BSsunwVEEkhTNsufjFy4BWaB4jCll0OSZslfIH8J02XFRCZBQuN5bu+YWM9a4IF5CSjYsS3FBf1hQqGhX5qA4ft6R1HSKtLBCUK9IAwXpFtuid1iyHwWcr4DWkqBNN8sZjiRs2UvTDBqCf8IJjj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UNxVu+vhSPZOTPByCWNZodLKxIkDoGn0j9wRu7UooGGT/aJkfRh3fGg/5wlqR95SL9fPOWyyfhRQLOONplgLFDvWk9oaxQayoJbbTv6+Ieu9204DwaV107TUuMl2am3njMGZlbCPMW01j5y15gzWttMbZ62DlpS2miFuvc4SP1UFOCML+8d+0EotDU1DiAO8cQSl5+iwUcMSidgtD2Uxj6E/KvE6NNN4ratvO8rsnXQ0DVfHuI/eaNsII1TDANU0PrX3jWlZ22OvPvrleiAZeHVEtl8aVAaJrHRdWysxBa+DOVSNiaz7XB0m4pKDhu+WdYuJHIt+ZV3X0BG6LtXNpDSjrheSwVAY3xtUgG4hkaOqjOvqufoXB4msy1xZK+lfXMd19ZbJQHTRNawF6BYS2TK5MkjESBC7YYeKbiGRZ8G/jLLLwDY+28i+2GJAREMeuGvgeY/buKXbYVTG8+/8EAYmtSzTMui3koVuEshjaS1jtuKCRoz5vzNMw9vr4YMj7NvrNfBhKyi80U/KDgnmtb/Tf9hbhg84gDzHvw==</diagram></mxfile>
\ No newline at end of file
create table PricingAll (
date datetime,
volume decimal(12, 0),
open decimal(22, 12),
high decimal(22, 12),
low decimal(22, 12),
close decimal(22, 12),
adjClose decimal(22, 12),
symbol varchar(6)
);
load data infile '/var/lib/mysql-files/18-Stocks/fh_5yrs.csv' ignore into table PricingAll
fields terminated by ','
enclosed by '"'
lines terminated by '\n';
\ No newline at end of file
import mysql.connector
SEPARATOR = "-------------------------"
COMMAND_HELP = "help"
COMMAND_EXIT = "exit"
COMMAND_INDIVIDUAL = "individual"
COMMAND_INDIVIDUAL_SEARCH = "search "
COMMAND_INDIVIDUAL_IPO = "ipo"
COMMAND_INDIVIDUAL_PRICING = "pricing "
COMMAND_INDIVIDUAL_BACK = "back"
COMMAND_INDIVIDUAL_HELP = "help"
INDIVIDUAL_MISSING_TICKER = "Please select a ticker by using the \"search <ticker>\" command"
def main():
# First establish a connection to the database
db = None
while True:
db = login()
if db is None:
print("Connection failed, try again")
else:
print("Successful connection")
break
# Run the "interface" loop
print("Type \"help\" for instructions")
while True:
user_input = input().lower()
if user_input == COMMAND_HELP:
help()
elif user_input == COMMAND_INDIVIDUAL:
individual()
elif user_input == COMMAND_EXIT:
print("Closing connection...")
db.close()
print("Connection closed. Goodbye!")
break
else:
print("Unknown command, type \"help\" for instructions")
def help():
print("Main help")
def individual():
print(SEPARATOR + "\nEntered individual mode\nType \"help\" for additional instructions\n" + SEPARATOR)
active_ticker = None
while True:
print("Active ticker: <" + ("NONE SELECTED" if active_ticker is None else active_ticker) + ">")
user_input = input().lower()
if user_input == COMMAND_INDIVIDUAL_HELP:
individual_help()
elif user_input.startswith(COMMAND_INDIVIDUAL_SEARCH):
ticker = user_input.removeprefix(COMMAND_INDIVIDUAL_SEARCH).upper()
valid = True # TODO - Check if the ticker is valid by referencing the database
if valid:
active_ticker = ticker
else:
print("Ticker <" + ticker + "> is invalid.")
elif user_input == COMMAND_INDIVIDUAL_IPO:
if active_ticker is None:
print(INDIVIDUAL_MISSING_TICKER)
else:
print("ipo data for " + active_ticker) # TODO - get actual data from the database
elif user_input == COMMAND_INDIVIDUAL_REVENUE:
if active_ticker is None:
print (INDIVIDUAL_MISSING_TICKER)
else:
print ("revenue data for " + active_ticker) # TODO - get actual revenue data from the database
elif user_input.startswith(COMMAND_INDIVIDUAL_PRICING):
if active_ticker is None:
print(INDIVIDUAL_MISSING_TICKER)
else:
print("parse date and print pricing data for " + active_ticker) # TODO - get actual pricing data from the database
elif user_input == COMMAND_INDIVIDUAL_BACK:
print(SEPARATOR + "\nLeaving \"individual\" mode\n" + SEPARATOR)
break
else:
print("Unknown command, type \"help\" for instructions")
def individual_help():
print("Individual help")
def login():
host = "marmoset04.shoshin.uwaterloo.ca" #input("Host: ")
user = input("Username: ")
password = input("Password: ")
try:
return mysql.connector.connect(
host = host,
user = user,
password = password
)
except:
return None
if __name__ == "__main__":
main()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment