def populate_stock_real_time():
    try:
        stocks_prices = get_stocks_real_time([stock.ticker for stock in Stock.all()])
    except:
        return
    for stock_price in stocks_prices:
        stock = Stock.where('ticker', stock_price['ticker']).first()
        if stock:
            stock.hourly_quotes().save(HourlyQuote(stock_price['info']))
Exemple #2
0
def populate_stock_real_time():
    try:
        stocks_prices = get_stocks_real_time(
            [stock.ticker for stock in Stock.all()])
    except:
        return
    for stock_price in stocks_prices:
        stock = Stock.where('ticker', stock_price['ticker']).first()
        if stock:
            stock.hourly_quotes().save(HourlyQuote(stock_price['info']))
Exemple #3
0
def populate_stock_real_time():
    try:
        stocks_prices = get_stocks_real_time([stock.ticker for stock in Stock.all()])
    except:
        try:
            stocks_prices = scrape_yahoo_site([stock.ticker for stock in Stock.all()])
        except:
            try:
                stocks_prices = get_stocks_real_time_google([stock.ticker for stock in Stock.all()])
            except:
                return
    for stock_price in stocks_prices:
        stock = Stock.where('ticker', stock_price['ticker']).first()
        if stock:
            stock_price['info']['stock_id'] = stock.id
            HalfHourlyQuote(stock_price['info']).save()
def populate_single_stock_history(ticker):
    stock = Stock.where('ticker', ticker).first()
def populate_single_stock_history(ticker):
    stock = Stock.where('ticker', ticker).first()