We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Ticket data from different timezone are not aligned (bug introduced with #1085)
I am trying to find correlations between tickets in differnet timezone (one in the New York Stock exchange and the other in the London Stock Exchange). Due to changes to the timezone logic, the data in each row of `yfinance.download` are no longer the data of the Tickets at the same time. Using `ignore_tz=False` fixes this problem. This problem didn't exist with version `0.1.77` and previous. So I think by default `ignore_tz` should be set to `False` as that behaviour is consistent with the previous minor versions. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `yfinance/multi.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # yfinance - market data downloader
5 # https://github.com/ranaroussi/yfinance
6 #
7 # Copyright 2017-2019 Ran Aroussi
8 #
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 #     http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 #
21 
22 from __future__ import print_function
23 
24 import time as _time
25 import multitasking as _multitasking
26 import pandas as _pd
27 
28 from . import Ticker, utils
29 from . import shared
30 
31 
32 def download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=True,
33              group_by='column', auto_adjust=False, back_adjust=False, repair=False, keepna=False,
34              progress=True, period="max", show_errors=True, interval="1d", prepost=False,
35              proxy=None, rounding=False, timeout=10):
36     """Download yahoo tickers
37     :Parameters:
38         tickers : str, list
39             List of tickers to download
40         period : str
41             Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
42             Either Use period parameter or use start and end
43         interval : str
44             Valid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo
45             Intraday data cannot extend last 60 days
46         start: str
47             Download start date string (YYYY-MM-DD) or _datetime.
48             Default is 1900-01-01
49         end: str
50             Download end date string (YYYY-MM-DD) or _datetime.
51             Default is now
52         group_by : str
53             Group by 'ticker' or 'column' (default)
54         prepost : bool
55             Include Pre and Post market data in results?
56             Default is False
57         auto_adjust: bool
58             Adjust all OHLC automatically? Default is False
59         repair: bool
60             Detect currency unit 100x mixups and attempt repair
61             Default is False
62         keepna: bool
63             Keep NaN rows returned by Yahoo?
64             Default is False
65         actions: bool
66             Download dividend + stock splits data. Default is False
67         threads: bool / int
68             How many threads to use for mass downloading. Default is True
69         ignore_tz: bool
70             When combining from different timezones, ignore that part of datetime.
71             Default is True
72         proxy: str
73             Optional. Proxy server URL scheme. Default is None
74         rounding: bool
75             Optional. Round values to 2 decimal places?
76         show_errors: bool
77             Optional. Doesn't print errors if False
78         timeout: None or float
79             If not None stops waiting for a response after given number of
80             seconds. (Can also be a fraction of a second e.g. 0.01)
81     """
82 
83     # create ticker list
84     tickers = tickers if isinstance(
85         tickers, (list, set, tuple)) else tickers.replace(',', ' ').split()
86 
87     # accept isin as ticker
88     shared._ISINS = {}
89     _tickers_ = []
90     for ticker in tickers:
91         if utils.is_isin(ticker):
92             isin = ticker
93             ticker = utils.get_ticker_by_isin(ticker, proxy)
94             shared._ISINS[ticker] = isin
95         _tickers_.append(ticker)
96 
97     tickers = _tickers_
98 
99     tickers = list(set([ticker.upper() for ticker in tickers]))
100 
101     if progress:
102         shared._PROGRESS_BAR = utils.ProgressBar(len(tickers), 'completed')
103 
104     # reset shared._DFS
105     shared._DFS = {}
106     shared._ERRORS = {}
107 
108     # download using threads
109     if threads:
110         if threads is True:
111             threads = min([len(tickers), _multitasking.cpu_count() * 2])
112         _multitasking.set_max_threads(threads)
113         for i, ticker in enumerate(tickers):
114             _download_one_threaded(ticker, period=period, interval=interval,
115                                    start=start, end=end, prepost=prepost,
116                                    actions=actions, auto_adjust=auto_adjust,
117                                    back_adjust=back_adjust, repair=repair, keepna=keepna,
118                                    progress=(progress and i > 0), proxy=proxy,
119                                    rounding=rounding, timeout=timeout)
120         while len(shared._DFS) < len(tickers):
121             _time.sleep(0.01)
122 
123     # download synchronously
124     else:
125         for i, ticker in enumerate(tickers):
126             data = _download_one(ticker, period=period, interval=interval,
127                                  start=start, end=end, prepost=prepost,
128                                  actions=actions, auto_adjust=auto_adjust,
129                                  back_adjust=back_adjust, repair=repair, keepna=keepna,
130                                  proxy=proxy,
131                                  rounding=rounding, timeout=timeout)
132             shared._DFS[ticker.upper()] = data
133             if progress:
134                 shared._PROGRESS_BAR.animate()
135 
136     if progress:
137         shared._PROGRESS_BAR.completed()
138 
139     if shared._ERRORS and show_errors:
140         print('\n%.f Failed download%s:' % (
141             len(shared._ERRORS), 's' if len(shared._ERRORS) > 1 else ''))
142         # print(shared._ERRORS)
143         print("\n".join(['- %s: %s' %
144                          v for v in list(shared._ERRORS.items())]))
145 
146     if ignore_tz:
147         for tkr in shared._DFS.keys():
148             if (shared._DFS[tkr] is not None) and (shared._DFS[tkr].shape[0] > 0):
149                 shared._DFS[tkr].index = shared._DFS[tkr].index.tz_localize(None)
150 
151     if len(tickers) == 1:
152         ticker = tickers[0]
153         return shared._DFS[shared._ISINS.get(ticker, ticker)]
154 
155     try:
156         data = _pd.concat(shared._DFS.values(), axis=1, sort=True,
157                           keys=shared._DFS.keys())
158     except Exception:
159         _realign_dfs()
160         data = _pd.concat(shared._DFS.values(), axis=1, sort=True,
161                           keys=shared._DFS.keys())
162 
163     # switch names back to isins if applicable
164     data.rename(columns=shared._ISINS, inplace=True)
165 
166     if group_by == 'column':
167         data.columns = data.columns.swaplevel(0, 1)
168         data.sort_index(level=0, axis=1, inplace=True)
169 
170     return data
171 
172 
173 def _realign_dfs():
174     idx_len = 0
175     idx = None
176 
177     for df in shared._DFS.values():
178         if len(df) > idx_len:
179             idx_len = len(df)
180             idx = df.index
181 
182     for key in shared._DFS.keys():
183         try:
184             shared._DFS[key] = _pd.DataFrame(
185                 index=idx, data=shared._DFS[key]).drop_duplicates()
186         except Exception:
187             shared._DFS[key] = _pd.concat([
188                 utils.empty_df(idx), shared._DFS[key].dropna()
189             ], axis=0, sort=True)
190 
191         # remove duplicate index
192         shared._DFS[key] = shared._DFS[key].loc[
193             ~shared._DFS[key].index.duplicated(keep='last')]
194 
195 
196 @_multitasking.task
197 def _download_one_threaded(ticker, start=None, end=None,
198                            auto_adjust=False, back_adjust=False, repair=False,
199                            actions=False, progress=True, period="max",
200                            interval="1d", prepost=False, proxy=None,
201                            keepna=False, rounding=False, timeout=10):
202     try:
203         data = _download_one(ticker, start, end, auto_adjust, back_adjust, repair,
204                              actions, period, interval, prepost, proxy, rounding,
205                              keepna, timeout)
206     except Exception as e:
207         # glob try/except needed as current thead implementation breaks if exception is raised.
208         shared._DFS[ticker] = utils.empty_df()
209         shared._ERRORS[ticker] = repr(e)
210     else:
211         shared._DFS[ticker.upper()] = data
212     if progress:
213         shared._PROGRESS_BAR.animate()
214 
215 
216 def _download_one(ticker, start=None, end=None,
217                   auto_adjust=False, back_adjust=False, repair=False,
218                   actions=False, period="max", interval="1d",
219                   prepost=False, proxy=None, rounding=False,
220                   keepna=False, timeout=10):
221     return Ticker(ticker).history(
222         period=period, interval=interval,
223         start=start, end=end, prepost=prepost,
224         actions=actions, auto_adjust=auto_adjust,
225         back_adjust=back_adjust, repair=repair, proxy=proxy,
226         rounding=rounding, keepna=keepna, timeout=timeout,
227         debug=False, raise_errors=False  # debug and raise_errors false to not log and raise errors in threads
228     )
229
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/yfinance/multi.py b/yfinance/multi.py
--- a/yfinance/multi.py
+++ b/yfinance/multi.py
@@ -29,7 +29,7 @@
 from . import shared
 
 
-def download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=True,
+def download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=False,
              group_by='column', auto_adjust=False, back_adjust=False, repair=False, keepna=False,
              progress=True, period="max", show_errors=True, interval="1d", prepost=False,
              proxy=None, rounding=False, timeout=10):
@@ -68,7 +68,7 @@
             How many threads to use for mass downloading. Default is True
         ignore_tz: bool
             When combining from different timezones, ignore that part of datetime.
-            Default is True
+            Default is False
         proxy: str
             Optional. Proxy server URL scheme. Default is None
         rounding: bool

{"golden_diff": "diff --git a/yfinance/multi.py b/yfinance/multi.py\n--- a/yfinance/multi.py\n+++ b/yfinance/multi.py\n@@ -29,7 +29,7 @@\n from . import shared\n \n \n-def download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=True,\n+def download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=False,\n              group_by='column', auto_adjust=False, back_adjust=False, repair=False, keepna=False,\n              progress=True, period=\"max\", show_errors=True, interval=\"1d\", prepost=False,\n              proxy=None, rounding=False, timeout=10):\n@@ -68,7 +68,7 @@\n             How many threads to use for mass downloading. Default is True\n         ignore_tz: bool\n             When combining from different timezones, ignore that part of datetime.\n-            Default is True\n+            Default is False\n         proxy: str\n             Optional. Proxy server URL scheme. Default is None\n         rounding: bool\n", "issue": "Ticket data from different timezone are not aligned (bug introduced with #1085)\nI am trying to find correlations between tickets in differnet timezone (one in the New York Stock exchange and the other in the London Stock Exchange). Due to changes to the timezone logic, the data in each row of `yfinance.download` are no longer the data of the Tickets at the same time. Using `ignore_tz=False` fixes this problem. This problem didn't exist with version `0.1.77` and previous. So I think by default `ignore_tz` should be set to `False` as that behaviour is consistent with the previous minor versions. \n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# yfinance - market data downloader\n# https://github.com/ranaroussi/yfinance\n#\n# Copyright 2017-2019 Ran Aroussi\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nfrom __future__ import print_function\n\nimport time as _time\nimport multitasking as _multitasking\nimport pandas as _pd\n\nfrom . import Ticker, utils\nfrom . import shared\n\n\ndef download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=True,\n             group_by='column', auto_adjust=False, back_adjust=False, repair=False, keepna=False,\n             progress=True, period=\"max\", show_errors=True, interval=\"1d\", prepost=False,\n             proxy=None, rounding=False, timeout=10):\n    \"\"\"Download yahoo tickers\n    :Parameters:\n        tickers : str, list\n            List of tickers to download\n        period : str\n            Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max\n            Either Use period parameter or use start and end\n        interval : str\n            Valid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo\n            Intraday data cannot extend last 60 days\n        start: str\n            Download start date string (YYYY-MM-DD) or _datetime.\n            Default is 1900-01-01\n        end: str\n            Download end date string (YYYY-MM-DD) or _datetime.\n            Default is now\n        group_by : str\n            Group by 'ticker' or 'column' (default)\n        prepost : bool\n            Include Pre and Post market data in results?\n            Default is False\n        auto_adjust: bool\n            Adjust all OHLC automatically? Default is False\n        repair: bool\n            Detect currency unit 100x mixups and attempt repair\n            Default is False\n        keepna: bool\n            Keep NaN rows returned by Yahoo?\n            Default is False\n        actions: bool\n            Download dividend + stock splits data. Default is False\n        threads: bool / int\n            How many threads to use for mass downloading. Default is True\n        ignore_tz: bool\n            When combining from different timezones, ignore that part of datetime.\n            Default is True\n        proxy: str\n            Optional. Proxy server URL scheme. Default is None\n        rounding: bool\n            Optional. Round values to 2 decimal places?\n        show_errors: bool\n            Optional. Doesn't print errors if False\n        timeout: None or float\n            If not None stops waiting for a response after given number of\n            seconds. (Can also be a fraction of a second e.g. 0.01)\n    \"\"\"\n\n    # create ticker list\n    tickers = tickers if isinstance(\n        tickers, (list, set, tuple)) else tickers.replace(',', ' ').split()\n\n    # accept isin as ticker\n    shared._ISINS = {}\n    _tickers_ = []\n    for ticker in tickers:\n        if utils.is_isin(ticker):\n            isin = ticker\n            ticker = utils.get_ticker_by_isin(ticker, proxy)\n            shared._ISINS[ticker] = isin\n        _tickers_.append(ticker)\n\n    tickers = _tickers_\n\n    tickers = list(set([ticker.upper() for ticker in tickers]))\n\n    if progress:\n        shared._PROGRESS_BAR = utils.ProgressBar(len(tickers), 'completed')\n\n    # reset shared._DFS\n    shared._DFS = {}\n    shared._ERRORS = {}\n\n    # download using threads\n    if threads:\n        if threads is True:\n            threads = min([len(tickers), _multitasking.cpu_count() * 2])\n        _multitasking.set_max_threads(threads)\n        for i, ticker in enumerate(tickers):\n            _download_one_threaded(ticker, period=period, interval=interval,\n                                   start=start, end=end, prepost=prepost,\n                                   actions=actions, auto_adjust=auto_adjust,\n                                   back_adjust=back_adjust, repair=repair, keepna=keepna,\n                                   progress=(progress and i > 0), proxy=proxy,\n                                   rounding=rounding, timeout=timeout)\n        while len(shared._DFS) < len(tickers):\n            _time.sleep(0.01)\n\n    # download synchronously\n    else:\n        for i, ticker in enumerate(tickers):\n            data = _download_one(ticker, period=period, interval=interval,\n                                 start=start, end=end, prepost=prepost,\n                                 actions=actions, auto_adjust=auto_adjust,\n                                 back_adjust=back_adjust, repair=repair, keepna=keepna,\n                                 proxy=proxy,\n                                 rounding=rounding, timeout=timeout)\n            shared._DFS[ticker.upper()] = data\n            if progress:\n                shared._PROGRESS_BAR.animate()\n\n    if progress:\n        shared._PROGRESS_BAR.completed()\n\n    if shared._ERRORS and show_errors:\n        print('\\n%.f Failed download%s:' % (\n            len(shared._ERRORS), 's' if len(shared._ERRORS) > 1 else ''))\n        # print(shared._ERRORS)\n        print(\"\\n\".join(['- %s: %s' %\n                         v for v in list(shared._ERRORS.items())]))\n\n    if ignore_tz:\n        for tkr in shared._DFS.keys():\n            if (shared._DFS[tkr] is not None) and (shared._DFS[tkr].shape[0] > 0):\n                shared._DFS[tkr].index = shared._DFS[tkr].index.tz_localize(None)\n\n    if len(tickers) == 1:\n        ticker = tickers[0]\n        return shared._DFS[shared._ISINS.get(ticker, ticker)]\n\n    try:\n        data = _pd.concat(shared._DFS.values(), axis=1, sort=True,\n                          keys=shared._DFS.keys())\n    except Exception:\n        _realign_dfs()\n        data = _pd.concat(shared._DFS.values(), axis=1, sort=True,\n                          keys=shared._DFS.keys())\n\n    # switch names back to isins if applicable\n    data.rename(columns=shared._ISINS, inplace=True)\n\n    if group_by == 'column':\n        data.columns = data.columns.swaplevel(0, 1)\n        data.sort_index(level=0, axis=1, inplace=True)\n\n    return data\n\n\ndef _realign_dfs():\n    idx_len = 0\n    idx = None\n\n    for df in shared._DFS.values():\n        if len(df) > idx_len:\n            idx_len = len(df)\n            idx = df.index\n\n    for key in shared._DFS.keys():\n        try:\n            shared._DFS[key] = _pd.DataFrame(\n                index=idx, data=shared._DFS[key]).drop_duplicates()\n        except Exception:\n            shared._DFS[key] = _pd.concat([\n                utils.empty_df(idx), shared._DFS[key].dropna()\n            ], axis=0, sort=True)\n\n        # remove duplicate index\n        shared._DFS[key] = shared._DFS[key].loc[\n            ~shared._DFS[key].index.duplicated(keep='last')]\n\n\n@_multitasking.task\ndef _download_one_threaded(ticker, start=None, end=None,\n                           auto_adjust=False, back_adjust=False, repair=False,\n                           actions=False, progress=True, period=\"max\",\n                           interval=\"1d\", prepost=False, proxy=None,\n                           keepna=False, rounding=False, timeout=10):\n    try:\n        data = _download_one(ticker, start, end, auto_adjust, back_adjust, repair,\n                             actions, period, interval, prepost, proxy, rounding,\n                             keepna, timeout)\n    except Exception as e:\n        # glob try/except needed as current thead implementation breaks if exception is raised.\n        shared._DFS[ticker] = utils.empty_df()\n        shared._ERRORS[ticker] = repr(e)\n    else:\n        shared._DFS[ticker.upper()] = data\n    if progress:\n        shared._PROGRESS_BAR.animate()\n\n\ndef _download_one(ticker, start=None, end=None,\n                  auto_adjust=False, back_adjust=False, repair=False,\n                  actions=False, period=\"max\", interval=\"1d\",\n                  prepost=False, proxy=None, rounding=False,\n                  keepna=False, timeout=10):\n    return Ticker(ticker).history(\n        period=period, interval=interval,\n        start=start, end=end, prepost=prepost,\n        actions=actions, auto_adjust=auto_adjust,\n        back_adjust=back_adjust, repair=repair, proxy=proxy,\n        rounding=rounding, keepna=keepna, timeout=timeout,\n        debug=False, raise_errors=False  # debug and raise_errors false to not log and raise errors in threads\n    )\n", "path": "yfinance/multi.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# yfinance - market data downloader\n# https://github.com/ranaroussi/yfinance\n#\n# Copyright 2017-2019 Ran Aroussi\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nfrom __future__ import print_function\n\nimport time as _time\nimport multitasking as _multitasking\nimport pandas as _pd\n\nfrom . import Ticker, utils\nfrom . import shared\n\n\ndef download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=False,\n             group_by='column', auto_adjust=False, back_adjust=False, repair=False, keepna=False,\n             progress=True, period=\"max\", show_errors=True, interval=\"1d\", prepost=False,\n             proxy=None, rounding=False, timeout=10):\n    \"\"\"Download yahoo tickers\n    :Parameters:\n        tickers : str, list\n            List of tickers to download\n        period : str\n            Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max\n            Either Use period parameter or use start and end\n        interval : str\n            Valid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo\n            Intraday data cannot extend last 60 days\n        start: str\n            Download start date string (YYYY-MM-DD) or _datetime.\n            Default is 1900-01-01\n        end: str\n            Download end date string (YYYY-MM-DD) or _datetime.\n            Default is now\n        group_by : str\n            Group by 'ticker' or 'column' (default)\n        prepost : bool\n            Include Pre and Post market data in results?\n            Default is False\n        auto_adjust: bool\n            Adjust all OHLC automatically? Default is False\n        repair: bool\n            Detect currency unit 100x mixups and attempt repair\n            Default is False\n        keepna: bool\n            Keep NaN rows returned by Yahoo?\n            Default is False\n        actions: bool\n            Download dividend + stock splits data. Default is False\n        threads: bool / int\n            How many threads to use for mass downloading. Default is True\n        ignore_tz: bool\n            When combining from different timezones, ignore that part of datetime.\n            Default is False\n        proxy: str\n            Optional. Proxy server URL scheme. Default is None\n        rounding: bool\n            Optional. Round values to 2 decimal places?\n        show_errors: bool\n            Optional. Doesn't print errors if False\n        timeout: None or float\n            If not None stops waiting for a response after given number of\n            seconds. (Can also be a fraction of a second e.g. 0.01)\n    \"\"\"\n\n    # create ticker list\n    tickers = tickers if isinstance(\n        tickers, (list, set, tuple)) else tickers.replace(',', ' ').split()\n\n    # accept isin as ticker\n    shared._ISINS = {}\n    _tickers_ = []\n    for ticker in tickers:\n        if utils.is_isin(ticker):\n            isin = ticker\n            ticker = utils.get_ticker_by_isin(ticker, proxy)\n            shared._ISINS[ticker] = isin\n        _tickers_.append(ticker)\n\n    tickers = _tickers_\n\n    tickers = list(set([ticker.upper() for ticker in tickers]))\n\n    if progress:\n        shared._PROGRESS_BAR = utils.ProgressBar(len(tickers), 'completed')\n\n    # reset shared._DFS\n    shared._DFS = {}\n    shared._ERRORS = {}\n\n    # download using threads\n    if threads:\n        if threads is True:\n            threads = min([len(tickers), _multitasking.cpu_count() * 2])\n        _multitasking.set_max_threads(threads)\n        for i, ticker in enumerate(tickers):\n            _download_one_threaded(ticker, period=period, interval=interval,\n                                   start=start, end=end, prepost=prepost,\n                                   actions=actions, auto_adjust=auto_adjust,\n                                   back_adjust=back_adjust, repair=repair, keepna=keepna,\n                                   progress=(progress and i > 0), proxy=proxy,\n                                   rounding=rounding, timeout=timeout)\n        while len(shared._DFS) < len(tickers):\n            _time.sleep(0.01)\n\n    # download synchronously\n    else:\n        for i, ticker in enumerate(tickers):\n            data = _download_one(ticker, period=period, interval=interval,\n                                 start=start, end=end, prepost=prepost,\n                                 actions=actions, auto_adjust=auto_adjust,\n                                 back_adjust=back_adjust, repair=repair, keepna=keepna,\n                                 proxy=proxy,\n                                 rounding=rounding, timeout=timeout)\n            shared._DFS[ticker.upper()] = data\n            if progress:\n                shared._PROGRESS_BAR.animate()\n\n    if progress:\n        shared._PROGRESS_BAR.completed()\n\n    if shared._ERRORS and show_errors:\n        print('\\n%.f Failed download%s:' % (\n            len(shared._ERRORS), 's' if len(shared._ERRORS) > 1 else ''))\n        # print(shared._ERRORS)\n        print(\"\\n\".join(['- %s: %s' %\n                         v for v in list(shared._ERRORS.items())]))\n\n    if ignore_tz:\n        for tkr in shared._DFS.keys():\n            if (shared._DFS[tkr] is not None) and (shared._DFS[tkr].shape[0] > 0):\n                shared._DFS[tkr].index = shared._DFS[tkr].index.tz_localize(None)\n\n    if len(tickers) == 1:\n        ticker = tickers[0]\n        return shared._DFS[shared._ISINS.get(ticker, ticker)]\n\n    try:\n        data = _pd.concat(shared._DFS.values(), axis=1, sort=True,\n                          keys=shared._DFS.keys())\n    except Exception:\n        _realign_dfs()\n        data = _pd.concat(shared._DFS.values(), axis=1, sort=True,\n                          keys=shared._DFS.keys())\n\n    # switch names back to isins if applicable\n    data.rename(columns=shared._ISINS, inplace=True)\n\n    if group_by == 'column':\n        data.columns = data.columns.swaplevel(0, 1)\n        data.sort_index(level=0, axis=1, inplace=True)\n\n    return data\n\n\ndef _realign_dfs():\n    idx_len = 0\n    idx = None\n\n    for df in shared._DFS.values():\n        if len(df) > idx_len:\n            idx_len = len(df)\n            idx = df.index\n\n    for key in shared._DFS.keys():\n        try:\n            shared._DFS[key] = _pd.DataFrame(\n                index=idx, data=shared._DFS[key]).drop_duplicates()\n        except Exception:\n            shared._DFS[key] = _pd.concat([\n                utils.empty_df(idx), shared._DFS[key].dropna()\n            ], axis=0, sort=True)\n\n        # remove duplicate index\n        shared._DFS[key] = shared._DFS[key].loc[\n            ~shared._DFS[key].index.duplicated(keep='last')]\n\n\n@_multitasking.task\ndef _download_one_threaded(ticker, start=None, end=None,\n                           auto_adjust=False, back_adjust=False, repair=False,\n                           actions=False, progress=True, period=\"max\",\n                           interval=\"1d\", prepost=False, proxy=None,\n                           keepna=False, rounding=False, timeout=10):\n    try:\n        data = _download_one(ticker, start, end, auto_adjust, back_adjust, repair,\n                             actions, period, interval, prepost, proxy, rounding,\n                             keepna, timeout)\n    except Exception as e:\n        # glob try/except needed as current thead implementation breaks if exception is raised.\n        shared._DFS[ticker] = utils.empty_df()\n        shared._ERRORS[ticker] = repr(e)\n    else:\n        shared._DFS[ticker.upper()] = data\n    if progress:\n        shared._PROGRESS_BAR.animate()\n\n\ndef _download_one(ticker, start=None, end=None,\n                  auto_adjust=False, back_adjust=False, repair=False,\n                  actions=False, period=\"max\", interval=\"1d\",\n                  prepost=False, proxy=None, rounding=False,\n                  keepna=False, timeout=10):\n    return Ticker(ticker).history(\n        period=period, interval=interval,\n        start=start, end=end, prepost=prepost,\n        actions=actions, auto_adjust=auto_adjust,\n        back_adjust=back_adjust, repair=repair, proxy=proxy,\n        rounding=rounding, keepna=keepna, timeout=timeout,\n        debug=False, raise_errors=False  # debug and raise_errors false to not log and raise errors in threads\n    )\n", "path": "yfinance/multi.py"}]}