Я скачал список валют с веб-сайта.Все цены начинаются в 2018-01-01, за исключением одной валюты, которая начинается в 2015 году. Как я могу получить эту серию, начинающуюся в 2018 году, чтобы я мог составить их график вместе с 2018.
Я пробовал loc and datetime
и ничего не работает.код ниже.
base_polo_url = 'https://poloniex.com/public?command=returnChartData¤cyPair={}&start={}&end={}&period={}'
start_date = datetime.strptime('2018-01-01', '%Y-%m-%d') # get data from the start of 2018
end_date = datetime.now() # up until today
period = 300 # pull daily data (300 seconds per day)
def get_crypto_data(poloniex_pair):
'''Retrieve cryptocurrency data from poloniex'''
json_url = base_polo_url.format(poloniex_pair, start_date.timestamp(), end_date.timestamp(), period)
data_df = get_json_data(json_url, poloniex_pair)
data_df = data_df.set_index('date')
return data_df
altcoins = ['ETH','LTC','XRP','STR','DASH','SC','XMR','XEM','MAID']
altcoin_data = {}
for altcoin in altcoins:
coinpair = 'BTC_{}'.format(altcoin)
crypto_price_df = get_crypto_data(coinpair)
altcoin_data[altcoin] = crypto_price_df
Любая помощь будет оценена