I'm tryping to create a dataframe with closingprices for stocks and have found a free api that returns JSON-data in the form of nested dicts with the data, looking like this:

```
{'name': 'AAPL',
 'history': 
           {'2019-01-04': 
                  {'open': '144.53',
                   'close': '148.26',
                   'high': '148.55',
                   'low': '143.80',
                   'volume': '58607070'},
           '2019-01-03': 
                   {'open': '143.98',
                    'close': '142.19',
                    'high': '145.72',
                    'low': '142.00',
                    'volume': '91312195'},
          '2019-01-02': 
                  {'open': '154.89',
                   'close': '157.92',
                   'high': '158.85',
                   'low': '154.23',
                   'volume': '37039737'
}}}

```

Since my desired key 'close' is nested in 'history' and each specific date I'm having a hard time extracting it and putting it in a dataframe.

What is the way to go/logic behind this type of situation? I have tried generating list of dates with datetime with no success. Do you have any suggestions or readings?

EDIT: CURRENT CODE, not working obviously

```
def make_request():
    '''Makes a request to the API that returns a JSON-response '''
    r = requests.get(url)
    sample = json.loads(r.text)
    return sample

def check_keys(data):
    '''Checks the keys in the JSON-response'''
    print(data.keys())

def check_values(data):
    '''Checks the values in the JSON-respose'''
    print(data.values())

def get_values(data):
    '''Gets the date for each day in the sample and stores it in a list'''
     for v in data.get('history'):
        values = v
        return v

def get_closeprice(data, values):
    '''Uses the dates from get_values() to iterate through the sample and get the
    closing price for each date in the sample'''
    for date in values:
        data.get('history').get(values).get('close')
        return value

```