Síða 1 af 1

verdbref spurning

Sent: Þri 08. Feb 2022 23:17
af Semboy

Kóði: Velja allt

list_of_yesterday = []
stock_response = requests.get(stock_api_info["end_point"],params=stock_api_info["parameters"])
stock_response.raise_for_status()
stock_data = stock_response.json()

# LETS REMOVE THE TODAYS DATA
def remove_the_todays_data(data):
    today = dt.datetime.now().date()
    # for period in stock_data["Time Series (60min)"]:
    #     period_to_date = dt.datetime.strptime(period, '%Y-%m-%d %H:%M:%S')
    #     if today == period_to_date.date():
    #         continue
    #     else:
    #         new_stock_data[period] = stock_data["Time Series (60min)"][period]
    new_stock_data = {period: data for (period, data) in stock_data["Time Series (60min)"].items() if today != dt.datetime.strptime(period, '%Y-%m-%d %H:%M:%S').date()}

    return new_stock_data


print(stock_data["Time Series (60min)"])
print(remove_the_todays_data(stock_data))


Eg er nybyrjadur ad kynna mer allt um verdbref,aettu their ekki bunir ad loka fyrir kaup og solum af verdbrefum fyrir thennan dag?.

Re: verdbref spurning

Sent: Þri 08. Feb 2022 23:31
af Semboy
nvm, thad er 24 tima seinkun sett a mig, hata fri gogn :).