Exemplo n.º 1
0
def test__return_none_if_no_finsym_is_found():
    not_existing_id = 'micex/MCFTR_doesntexist'
    assert_that(y.information(name=not_existing_id), none())

    infos = y.information(names=['infl/RUB', not_existing_id])
    assert_that(infos[0], not_none())
    assert_that(infos[1], none())
Exemplo n.º 2
0
def test__be_invariant_in_respect_to_order():
    infos1 = [
        y.identifier.format()
        for y in y.information(names=['infl/RUB', 'infl/EUR'])
    ]
    infos2 = [
        y.identifier.format()
        for y in y.information(names=['infl/EUR', 'infl/RUB'])
    ]
    assert_that(infos1, contains_inanyorder(*infos2))
Exemplo n.º 3
0
def test__returns_sym_info():
    info = y.information(name='micex/FXRU')
    assert_that(info, instance_of(FinancialSymbol))

    info = y.information(names=[])
    assert_that(info, instance_of(list))
    assert_that(info, empty())

    info = y.information(names=['infl/RUB'])
    assert_that(info, instance_of(list))
    assert_that(info, has_length(1))

    info = y.information(names=['micex/FXRU', 'infl/RUB'])
    assert_that(info, instance_of(list))
    assert_that(info, has_length(2))
Exemplo n.º 4
0
def test__have_valid_max_period_range():
    okid10 = y.portfolio_asset(name=__asset_name)
    cbr_top10 = y.information(name='cbr/TOP_rates')

    assert okid10.close(
    ).start_period == cbr_top10.start_period + _MONTHS_PER_YEAR
    assert (cbr_top10.end_period - okid10.close().end_period).n < 2
Exemplo n.º 5
0
def test__currency_usd__should_have_correct_fields():
    info = y.information(name='cbr/USD')
    assert_that(info, has_property('namespace', 'cbr'))
    assert_that(info, has_property('name', 'USD'))
    assert_that(info, has_property('isin', None))
    assert_that(info, has_property('short_name', 'Доллар США'))
    assert_that(info, has_property('long_name', None))
    assert_that(info, has_property('exchange', None))
    assert_that(info, has_property('currency', Currency.USD))
    assert_that(info, has_property('security_type', SecurityType.CURRENCY))
    assert_that(info, has_property('period', Period.DAY))
    assert_that(info, has_property('adjusted_close', True))
Exemplo n.º 6
0
def test__quandl_stocks_should_have_correct_fields():
    info = y.information(name='ny/VNQ')
    assert_that(info, has_property('namespace', 'ny'))
    assert_that(info, has_property('name', 'VNQ'))
    assert_that(info, has_property('isin', None))
    assert_that(info, has_property('short_name', 'Vanguard Real Estate'))
    assert_that(info, has_property('long_name', None))
    assert_that(info, has_property('exchange', 'NYSE Arca'))
    assert_that(info, has_property('currency', Currency.USD))
    assert_that(info, has_property('security_type', SecurityType.STOCK_ETF))
    assert_that(info, has_property('period', Period.DAY))
    assert_that(info, has_property('adjusted_close', True))
Exemplo n.º 7
0
def test__micex_stocks_should_have_correct_fields():
    info = y.information(name='micex/SBER')
    assert_that(info, has_property('namespace', 'micex'))
    assert_that(info, has_property('name', 'SBER'))
    assert_that(info, has_property('isin', 'RU0009029540'))
    assert_that(info, has_property('short_name', 'Сбербанк'))
    assert_that(info, has_property('long_name', 'Сбербанк России ПАО ао'))
    assert_that(info, has_property('exchange', 'MICEX'))
    assert_that(info, has_property('currency', Currency.RUB))
    assert_that(info, has_property('security_type', SecurityType.STOCK_ETF))
    assert_that(info, has_property('period', Period.DAY))
    assert_that(info, has_property('adjusted_close', True))
Exemplo n.º 8
0
def test__us_data_source_should_have_correct_fields():
    info = y.information(name='us/VNQ')
    assert_that(info, has_property('namespace', 'us'))
    assert_that(info, has_property('name', 'VNQ'))
    assert_that(info, has_property('isin', None))
    assert_that(
        info,
        has_property('short_name',
                     'Vanguard Real Estate Index Fund ETF Shares'))
    assert_that(info, has_property('long_name', None))
    assert_that(info, has_property('exchange', 'NYSE ARCA'))
    assert_that(info, has_property('currency', Currency.USD))
    assert_that(info, has_property('security_type', SecurityType.STOCK_ETF))
    assert_that(info, has_property('period', Period.MONTH))
    assert_that(info, has_property('adjusted_close', True))
Exemplo n.º 9
0
def test__inflation_ru__should_have_correct_fields():
    info = y.information(name='infl/RUB')
    assert_that(info, has_property('namespace', 'infl'))
    assert_that(info, has_property('name', 'RUB'))
    assert_that(info, has_property('isin', None))
    assert_that(info, has_property('short_name', 'Инфляция РФ'))
    assert_that(info, has_property('long_name', None))
    assert_that(info, has_property('exchange', None))
    assert_that(info, has_property('currency', Currency.RUB))
    assert_that(info, has_property('security_type', SecurityType.INFLATION))
    assert_that(info, has_property('period', Period.MONTH))
    assert_that(info, has_property('adjusted_close', False))
    assert_that(
        info.values(start_period=str(pd.Period.now(freq='M') - 2),
                    end_period=str(pd.Period.now(freq='M'))).columns,
        contains_inanyorder('period', 'value'))
Exemplo n.º 10
0
def test__top_rates__should_have_correct_fields():
    info = y.information(name='cbr/TOP_rates')
    assert_that(info, has_property('namespace', 'cbr'))
    assert_that(info, has_property('name', 'TOP_rates'))
    assert_that(info, has_property('isin', None))
    assert_that(info, has_property('short_name', None))
    assert_that(info.long_name,
                starts_with('Динамика максимальной процентной'))
    assert_that(info, has_property('exchange', None))
    assert_that(info, has_property('currency', Currency.RUB))
    assert_that(info, has_property('security_type', SecurityType.RATES))
    assert_that(info, has_property('period', Period.DECADE))
    assert_that(info, has_property('adjusted_close', False))
    assert_that(
        info.values(start_period=str(pd.Period.now(freq='M') - 2),
                    end_period=str(pd.Period.now(freq='M'))).columns,
        contains_inanyorder('period', 'rate'))
Exemplo n.º 11
0
def test__return_same_infos_count_as_provided():
    ids_arr = ['infl/RUB', 'infl/EUR', 'micex/MCFTR', 'micex/FXRU']
    infos = y.information(names=ids_arr)
    assert len(infos) == len(ids_arr)
Exemplo n.º 12
0
def test__all_data_should_be_available():
    assert_that(y.information(name='ny/MSFT'), not_none())
    assert_that(y.information(name='micex/FXRU'), not_none())
    assert_that(y.information(name='micex/FXMM'), not_none())
    assert_that(y.information(name='index/MCFTR'), not_none())
    assert_that(y.information(name='index/IMOEX'), not_none())
    assert_that(y.information(name='index/OKID10'), not_none())
    assert_that(y.information(name='index/^STOXX50E'), not_none())
    assert_that(y.information(name='mut_ru/0890-94127385'), not_none())
    assert_that(y.information(name='cbr/USD'), not_none())
    assert_that(y.information(name='cbr/EUR'), not_none())
    assert_that(y.information(name='infl/RUB'), not_none())
    assert_that(y.information(name='infl/USD'), not_none())
    assert_that(y.information(name='infl/EUR'), not_none())
    assert_that(y.information(name='cbr/TOP_rates'), not_none())