pricedb/app.py
def get_prices(self, date: str, currency: str) -> List[PriceModel]:
        """ Fetches all the prices for the given arguments """
        from .repositories import PriceRepository

        session = self.session
        repo = PriceRepository(session)
        query = repo.query
        if date:
            query = query.filter(dal.Price.date == date)
        if currency:
            query = query.filter(dal.Price.currency == currency)
        # Sort by symbol.
        query = query.order_by(dal.Price.namespace, dal.Price.symbol)
        price_entities = query.all()

        mapper = mappers.PriceMapper()
        result = []
        for entity in price_entities:
            model = mapper.map_entity(entity)
            result.append(model)
        return result
def get_prices(self, date: str, currency: str) -> List[PriceModel]:
        from .repositories import PriceRepository

        session = self.session
        repo = PriceRepository(session)
        query = repo.query
        if date:
            query = query.filter(dal.Price.date == date)
        if currency:
            query = query.filter(dal.Price.currency == currency)
        # Sort by symbol.
        query = query.order_by(dal.Price.namespace, dal.Price.symbol)
        price_entities = query.all()

        mapper = mappers.PriceMapper()
        result = []
        for entity in price_entities:
            model = mapper.map_entity(entity)
            result.append(model)
        return result
def get_prices ( self , date : str , currency : str ) -> List [ PriceModel ] : from . repositories import PriceRepository session = self . session repo = PriceRepository ( session ) query = repo . query if date : query = query . filter ( dal . Price . date == date ) if currency : query = query . filter ( dal . Price . currency == currency ) # Sort by symbol. query = query . order_by ( dal . Price . namespace , dal . Price . symbol ) price_entities = query . all ( ) mapper = mappers . PriceMapper ( ) result = [ ] for entity in price_entities : model = mapper . map_entity ( entity ) result . append ( model ) return result
Fetches all the prices for the given arguments
Fetches all the prices for the given arguments