def check_code():
    input_keyword = input('Please input keyword for the stock searching for:')
    all_ticker = data.get_nasdaq_symbols(retry_count=3, timeout=30, pause=None)
    all_ticker = all_ticker.drop(columns=[
        'Nasdaq Traded', 'Listing Exchange', 'Market Category', 'ETF',
        'Round Lot Size', 'Test Issue', 'Financial Status', 'CQS Symbol',
        'NASDAQ Symbol', 'NextShares'
    ])

    name_list = all_ticker['Security Name'].values.tolist()
    name_list = [x.lower() for x in name_list]

    l = []
    num = 0

    for item in name_list:
        if input_keyword in item:
            l.insert(num, item)
            num = num + 1

    all_ticker = all_ticker.reset_index()
    all_ticker = all_ticker.set_index('Security Name')
    code_dic = all_ticker.to_dict()
    new_dic = code_dic.get('Symbol')
    new_dic = {k.lower(): v for k, v in new_dic.items()}

    print('\nBelow are code for security name containing: ' + input_keyword +
          '\n')

    for item in l:
        p = str(item) + ' ---- ' + str(new_dic.get(item))
        print(p)

    next = next_request()
    return next
def retrieve_stock_data(symbol):
    """
    Implements pandas_datareader to extract data from RobinHood's API into a pandas DataFrame.
    :param symbol: String, ticker-symbol of the stock who's data is to be retrieved.
    :return: pandas DataFrame object of stock data
    """
    data = pdr.DataReader(symbol, 'robinhood')
    nasdaq = pdr.get_nasdaq_symbols()
    name = nasdaq["Security Name"][symbol]
    return data, name
Example #3
0
def read_stock_data() -> pd.DataFrame:
    """
    A simple function to retrieve the stock data

    Returns
    -------
    pandas.DataFrame
        A Pandas DataFrame that stock data
    """
    try:
        data = pd.read_csv(stocks_path)
    except FileNotFoundError:
        data = pdr.get_nasdaq_symbols()
        save(data, stocks_path)

    return data
Example #4
0
import logging
Example #5
0
def save_nasdaq():
    nasdaq = web.get_nasdaq_symbols()
    nasdaq.to_pickle("./data/nasdaq_symbols.pkl")
    return nasdaq
Example #6
0
import tkinter as tk
import tkinter.ttk as ttk
from autocompletebox import AutocompleteEntry
from autocompletebox import NO_RESULTS_MESSAGE
import pandas_datareader.data as data
from scraper import getIncomeAnalysis
from scraper import getExpenseAnalysis
from scraper import getLiabilityAnalysis
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure

matplotlib.use("TkAgg")

all_ticker = data.get_nasdaq_symbols(retry_count=3, timeout=30, pause=None)
all_ticker = all_ticker.drop(columns=[
    'Nasdaq Traded', 'Listing Exchange', 'Market Category', 'ETF',
    'Round Lot Size', 'Test Issue', 'Financial Status', 'CQS Symbol',
    'NASDAQ Symbol', 'NextShares'
])
all_ticker = all_ticker.reset_index()
all_ticker = all_ticker.set_index('Security Name')
code_dic = all_ticker.to_dict()
code_dic = code_dic.get('Symbol')


class Application(tk.Frame, object):
    """Main Class of the application
       Methods:
       __init__ -- Set up the UI
Example #7
0
 def get_all_stock_code() -> []:
     sym = pdr.get_iex_symbols()
     pdr.get_nasdaq_symbols()
     return sym['symbol'].to_list()
Example #8
0
import os
import pandas as pd
from pandas_datareader import data as web  # Package and modules for importing data; this code may change depending on pandas version
import datetime
from sklearn.linear_model import LinearRegression
import numpy as np

# Setting up the model
linreg = LinearRegression()
# Collecting stock tickers we are interested in
t = web.get_nasdaq_symbols()
t = t[t['Financial Status'] == 'N']
t = t[t['Listing Exchange'] == 'Q']
t = t[t['Test Issue'] == False]
tickers = t.index.values
money = 10000
portfolio = dict((t, 0) for t in tickers)
currPrice = dict((t, 0) for t in tickers)


def evaulateForTrade(ticker, start, end):
    # First argument is the series we want, second is the source ("yahoo" for Yahoo! Finance), third is the start date, fourth is the end date
    try:
        stock = web.DataReader(ticker, "yahoo", start, end)
        type(stock)
        close = stock['Adj Close'].values[-10:]
        x = np.arange(1, len(close) + 1).reshape(-1, 1)
        linreg.fit(x, close)
        if (linreg.coef_ > 0):
            return True
    except Exception as e: