Polygon.IO Fundamental Data in Amiquote

I was wondering if anyone has figured out how to utilize AmiQuote to pull fundamental data from Polygon.IO. I know currently that I it has the functionality for historical OHLCV but I would like to pull data fundamental data as well.

1 Like

Theoretically they do have some data here Stock Financials vX - Polygon
and I see no reason why it could not be downloaded and processed using Javascript processor available in AmiQuote 4.15
You can use existing Yahoo Fundamental New ads file as a starting point.

Interestingly I asked Chat GPT to write Javascript function to convert their JSON to CSV and it responded with that

function convertToCSV(json) {
  const results = json.results;
  if (!results || results.length === 0) {
    return '';

  // Extract header
  const header = Object.keys(results[0].financials.balance_sheet).map(item => `"${item}"`).join(',');

  // Extract data
  const rows = results.map(result => {
    const balanceSheet = result.financials.balance_sheet;
    return Object.values(balanceSheet).map(value => `"${value.value}"`).join(',');

  // Combine header and rows
  return `${header}\n${rows.join('\n')}`;

I did not test it, but as a starting point it does not look bad.