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']))
Пример #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']))
Пример #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()
Пример #4
0
def populate_single_stock_history(ticker):
    stock = Stock.where('ticker', ticker).first()
def populate_single_stock_history(ticker):
    stock = Stock.where('ticker', ticker).first()