Reading the values of cells that summarize Google Finance data results via Apps Script
As written in the Official documentation,
Historical data cannot be downloaded or accessed via the Sheets API or Apps Script. If you attempt to do so, you will see a #N/A error in place of the values in the corresponding cells of your spreadsheet.
The average formula is NOT the problem. Any attempt to take historical finance data through any formula hoops doesn't seem to be possible.
However live data doesn't seem to be restricted the same way.