def add_random_row():
    row = {
        'ticker': random_utilities.random_letters(),
        'company_profile': random_utilities.random_date(),
        'daily_history': random_utilities.random_date()
    }
    api_progress_table.insert_row(row)
def test_update_company_profile_progress():
    api_progress_table.add_ticker(test_ticker)
    date = random_utilities.random_date()
    assert api_progress_table.update_company_profile_progress(
        test_ticker, date) is True
    retrieved_date = api_progress_table.get_value('ticker', test_ticker,
                                                  'company_profile')
    assert retrieved_date == date
def test_reset_daily_history_progress():
    api_progress_table.add_ticker(test_ticker)
    date = random_utilities.random_date()
    api_progress_table.update_daily_history_progress(test_ticker, date)
    assert api_progress_table.reset_daily_history_progress(test_ticker) is True
    retrieved_date = api_progress_table.get_value('ticker', test_ticker,
                                                  'daily_history')
    assert retrieved_date is None
def _random_row(ticker=None):
    if ticker is None:
        ticker = random_utilities.random_letters()
    return {
        'ticker': ticker,
        'date': random_utilities.random_date(),
        'open': random_utilities.random_double(),
        'high': random_utilities.random_double(),
        'low': random_utilities.random_double(),
        'close': random_utilities.random_double(),
        'adjusted_close': random_utilities.random_double(),
        'volume': random_utilities.random_int(0, 10000000),
        'dividend': random_utilities.random_double(),
        'split_coefficient': 1.000
    }
Example #5
0
def test_update_row_date(cursor):
    new_date = random_utilities.random_date()
    assert postgres.update_value(cursor, test_table_name, 'id', test_table_row_id, 'date_col', new_date) is True
Example #6
0
def test_random_date():
    date = random_utilities.random_date()
    assert date is not None
    assert isinstance(date, datetime.date)
Example #7
0
def test_row_exists_doesnt_exist():
    ticker = random_utilities.random_letters()
    year = random_utilities.random_date().year
    assert yearly_history_table.row_exists(ticker, year) is False