I’m having trouble understanding nested classes and have a specific problem

I have a model “Pair” which has an attribute “name.” I’d like to have a nested class called “History” that passes variables “start” and “end” as well as its parent (Pair) variable’s “name”. A @property decorated function would then return the standard deviation of that list.

To call the standard deviation I’d be looking for something like:

pair = Pair(base_currency='USD', quote_currency='GBP')
print(pair.History(granularity='1D', start=start_date, end=end_date).std_dev
>>> 634

I think it should look something like the below, but cant figure out how to inherit the outer class attribute “name”

class Pair:
    def __init__(self, base_currency, quote_currency):
        self.base_currency = base_currency
        self.quote_currency = quote_currency
        self.name = '{base}-{quote}'.format(base=base_currency, quote=quote_currency)
        self.history = self.History()

    class History:
        def __init__(self, granularity, start, end):
            self.name = HOW DO I GET THE PARENT NAME HERE
            self.granularity = granularity
            self.start = start
            self.end = end

        def data(self):
            return retrieve_history(product=self.name, granularity=self.granularity, start=self.start, end=self.end)

        def std_dev(self):
            return stdev(self.data)