Beispiel #1
0
def test_dl_prices_for_currency(session):
    """ See if only prices for USD get downloaded.
    Testing the securities filter.
    """
    # TODO add at least one symbol with USD currency to the in-memory database first

    app = PriceDbApplication(session=session)
    app.download_prices(currency="USD")
Beispiel #2
0
def download(ctx, help: bool, symbol: str, namespace: str, agent: str,
             currency: str):
    """ Download the latest prices """
    if help:
        click.echo(ctx.get_help())
        ctx.exit()

    app = PriceDbApplication()
    app.logger = logger

    if currency:
        currency = currency.strip()
        currency = currency.upper()

    # Otherwise download the prices for securities listed in the database.
    app.download_prices(currency=currency,
                        agent=agent,
                        symbol=symbol,
                        namespace=namespace)
Beispiel #3
0
def test_namespace_parameter(session):
    """
    Test that the namespace parameter filters out appropriate symbols.
    Debugging test.
    """
    from pricedb.dal import Security

    # Arrange
    app = PriceDbApplication(session)
    repo = app.get_security_repository()
    sec = Security()
    sec.symbol = "BOND"
    sec.namespace = "VANGUARD"
    sec.updater = "vanguard_au"
    sec.currency = "AUD"
    repo.session.add(sec)

    # Act
    app.download_prices(namespace="vanguard")

    # Assert
    prices = app.get_latest_prices()
    assert prices
    
def test_download_using_symbols_in_db():
    """ Download the prices that are listed in db.
    Used for debugging
    """
    app = PriceDbApplication()
    app.download_prices()