def quandl_code(asset) -> str: if isinstance(asset, Asset.Pair): if not FxUtils.is_usd_cross(asset): raise ValueError('Use of Quandl source for ccy pairs requires USD crosses only, got {}'.format(asset)) # Since this a USD cross, only expect 1 ccy when unpacking non_usd_ccy, = FxUtils.non_usd_currencies(asset) return quandl_db(asset) + '/' + non_usd_ccy.__str__()
def tickers(self): pairs = FxUtils.split_to_usd_crosses(self.asset) return [Ticker(Source.quandl_code(p), FxUtils.is_inverted(p)) for p in pairs]