src/currency.py
def _get_first_value(cls, currency, start_date):
        """Check for the first valid exchange rate before start_date
        and replace the Nan value at the first date."""
        days_back = 1
        while True:
            start_date_ = pd.to_datetime(start_date) - pd.Timedelta(
                days=days_back)
            end_date_ = start_date_ + pd.Timedelta(days=1)
            start_date_str = start_date_.strftime('%Y-%m-%d')
            end_date_str = end_date_.strftime('%Y-%m-%d')
            df = (web.DataReader(currency + cls._base_currency + '=X',
                                 data_source='yahoo', start=start_date_str,
                                 end=end_date_str)['Adj Close'])
            if df.index[0] != start_date_:
                days_back += 1
            else:
                return df.iloc[0]
Check for the first valid exchange rate before start_date
        and replace the Nan value at the first date.
Check for the first valid exchange rate before start_date
and replace the Nan value at the first date.
Check for the first valid exchange rate before start_date and replace the Nan value at the first date .
def _get_first_value(cls, currency, start_date):
        days_back = 1
        while True:
            start_date_ = pd.to_datetime(start_date) - pd.Timedelta(
                days=days_back)
            end_date_ = start_date_ + pd.Timedelta(days=1)
            start_date_str = start_date_.strftime('%Y-%m-%d')
            end_date_str = end_date_.strftime('%Y-%m-%d')
            df = (web.DataReader(currency + cls._base_currency + '=X',
                                 data_source='yahoo', start=start_date_str,
                                 end=end_date_str)['Adj Close'])
            if df.index[0] != start_date_:
                days_back += 1
            else:
                return df.iloc[0]
def _get_first_value ( cls , currency , start_date ) : days_back = 1 while True : start_date_ = pd . to_datetime ( start_date ) - pd . Timedelta ( days = days_back ) end_date_ = start_date_ + pd . Timedelta ( days = 1 ) start_date_str = start_date_ . strftime ( '%Y-%m-%d' ) end_date_str = end_date_ . strftime ( '%Y-%m-%d' ) df = ( web . DataReader ( currency + cls . _base_currency + '=X' , data_source = 'yahoo' , start = start_date_str , end = end_date_str ) [ 'Adj Close' ] ) if df . index [ 0 ] != start_date_ : days_back += 1 else : return df . iloc [ 0 ]
Check for the first valid exchange rate before start_date
and replace the Nan value at the first date.
Check for the first valid exchange rate before start_date and replace the Nan value at the first date .
"""Check for the first valid exchange rate before start_date
        and replace the Nan value at the first date."""
cls
currency
start_date