pricedb/app.py
def __download_price(self, symbol: str, currency: str, agent: str):
        """ Downloads and parses the price """
        from finance_quote_python import Quote

        assert isinstance(symbol, str)
        assert isinstance(currency, str)
        assert isinstance(agent, str)

        if not symbol:
            return None

        #self.logger.info(f"Downloading {symbol}... ")

        dl = Quote()
        dl.logger = self.logger

        dl.set_source(agent)
        dl.set_currency(currency)

        result = dl.fetch(agent, [symbol])

        if not result:
            raise ValueError(f"Did not receive a response for {symbol}.")

        price = result[0]

        if not price:
            raise ValueError(f"Price not downloaded/parsed for {symbol}.")
        else:
            # Create price data entity, to be inserted.
            self.add_price(price)

        return price
def __download_price(self, symbol: str, currency: str, agent: str):
        from finance_quote_python import Quote

        assert isinstance(symbol, str)
        assert isinstance(currency, str)
        assert isinstance(agent, str)

        if not symbol:
            return None

        #self.logger.info(f"Downloading {symbol}... ")

        dl = Quote()
        dl.logger = self.logger

        dl.set_source(agent)
        dl.set_currency(currency)

        result = dl.fetch(agent, [symbol])

        if not result:
            raise ValueError(f"Did not receive a response for {symbol}.")

        price = result[0]

        if not price:
            raise ValueError(f"Price not downloaded/parsed for {symbol}.")
        else:
            # Create price data entity, to be inserted.
            self.add_price(price)

        return price
def __download_price ( self , symbol : str , currency : str , agent : str ) : from finance_quote_python import Quote assert isinstance ( symbol , str ) assert isinstance ( currency , str ) assert isinstance ( agent , str ) if not symbol : return None #self.logger.info(f"Downloading {symbol}... ") dl = Quote ( ) dl . logger = self . logger dl . set_source ( agent ) dl . set_currency ( currency ) result = dl . fetch ( agent , [ symbol ] ) if not result : raise ValueError ( f"Did not receive a response for {symbol}." ) price = result [ 0 ] if not price : raise ValueError ( f"Price not downloaded/parsed for {symbol}." ) else : # Create price data entity, to be inserted. self . add_price ( price ) return price
Downloads and parses the price
Downloads and parses the price