Jump to content

File:GoldPriceUSD.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (SVG file, nominally 768 × 432 pixels, file size: 84 KB)

Summary

Description
English: Gold price in USD per troy ounce plotted using the Python code in the separate section.
Date
Source Own work
Author Dan Polansky

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

Plotting code

from matplotlib import pyplot as plt
import datetime
plotPrices = True
plot5YRates = True
plot10YRates = True
plot20YRates = True
plot30YRates = True
# from https://www.macrotrends.net/1333/historical-gold-prices-100-year-chart
# from its frame https://www.macrotrends.net/assets/php/chart_iframe_comp.php?id=1333&url=historical-gold-prices-100-year-chart

inputDataPre1971 = [ # For reference only: not used for plotting
  "1915-01-01:19.250",
  "1915-02-01:19.250",
  "1915-03-01:19.250",
  "1915-04-01:19.250",
  "1915-05-01:19.250",
  "1915-06-01:19.250",
  "1915-07-01:19.250",
  "1915-08-01:19.250",
  "1915-09-01:19.250",
  "1915-10-01:19.250",
  "1915-11-01:19.250",
  "1915-12-01:19.250",
  "1916-01-01:19.470",
  "1916-02-01:19.470",
  "1916-03-01:19.470",
  "1916-04-01:19.470",
  "1916-05-01:19.470",
  "1916-06-01:19.470",
  "1916-07-01:19.470",
  "1916-08-01:19.470",
  "1916-09-01:19.470",
  "1916-10-01:19.470",
  "1916-11-01:19.470",
  "1916-12-01:19.470",
  "1917-01-01:19.660",
  "1917-02-01:19.660",
  "1917-03-01:19.660",
  "1917-04-01:19.660",
  "1917-05-01:19.660",
  "1917-06-01:19.660",
  "1917-07-01:19.660",
  "1917-08-01:19.660",
  "1917-09-01:19.660",
  "1917-10-01:19.660",
  "1917-11-01:19.660",
  "1917-12-01:19.660",
  "1918-01-01:19.840",
  "1918-02-01:19.840",
  "1918-03-01:19.840",
  "1918-04-01:19.840",
  "1918-05-01:19.840",
  "1918-06-01:19.840",
  "1918-07-01:19.840",
  "1918-08-01:19.840",
  "1918-09-01:19.840",
  "1918-10-01:19.840",
  "1918-11-01:19.840",
  "1918-12-01:19.840",
  "1919-01-01:20.030",
  "1919-02-01:20.030",
  "1919-03-01:20.030",
  "1919-04-01:20.030",
  "1919-05-01:20.030",
  "1919-06-01:20.030",
  "1919-07-01:20.030",
  "1919-08-01:20.030",
  "1919-09-01:20.030",
  "1919-10-01:20.030",
  "1919-11-01:20.030",
  "1919-12-01:20.030",
  "1920-01-01:20.630",
  "1920-02-01:20.630",
  "1920-03-01:20.630",
  "1920-04-01:20.630",
  "1920-05-01:20.630",
  "1920-06-01:20.630",
  "1920-07-01:20.630",
  "1920-08-01:20.630",
  "1920-09-01:20.630",
  "1920-10-01:20.630",
  "1920-11-01:20.630",
  "1920-12-01:20.630",
  "1921-01-01:20.690",
  "1921-02-01:20.690",
  "1921-03-01:20.690",
  "1921-04-01:20.690",
  "1921-05-01:20.690",
  "1921-06-01:20.690",
  "1921-07-01:20.690",
  "1921-08-01:20.690",
  "1921-09-01:20.690",
  "1921-10-01:20.690",
  "1921-11-01:20.690",
  "1921-12-01:20.690",
  "1922-01-01:20.840",
  "1922-02-01:20.840",
  "1922-03-01:20.840",
  "1922-04-01:20.840",
  "1922-05-01:20.840",
  "1922-06-01:20.840",
  "1922-07-01:20.840",
  "1922-08-01:20.840",
  "1922-09-01:20.840",
  "1922-10-01:20.840",
  "1922-11-01:20.840",
  "1922-12-01:20.840",
  "1923-01-01:20.750",
  "1923-02-01:20.750",
  "1923-03-01:20.750",
  "1923-04-01:20.750",
  "1923-05-01:20.750",
  "1923-06-01:20.750",
  "1923-07-01:20.750",
  "1923-08-01:20.750",
  "1923-09-01:20.750",
  "1923-10-01:20.750",
  "1923-11-01:20.750",
  "1923-12-01:20.750",
  "1924-01-01:20.780",
  "1924-02-01:20.780",
  "1924-03-01:20.780",
  "1924-04-01:20.780",
  "1924-05-01:20.780",
  "1924-06-01:20.780",
  "1924-07-01:20.780",
  "1924-08-01:20.780",
  "1924-09-01:20.780",
  "1924-10-01:20.780",
  "1924-11-01:20.780",
  "1924-12-01:20.780",
  "1925-01-01:20.750",
  "1925-02-01:20.750",
  "1925-03-01:20.750",
  "1925-04-01:20.750",
  "1925-05-01:20.750",
  "1925-06-01:20.750",
  "1925-07-01:20.750",
  "1925-08-01:20.750",
  "1925-09-01:20.750",
  "1925-10-01:20.750",
  "1925-11-01:20.750",
  "1925-12-01:20.750",
  "1926-01-01:20.720",
  "1926-02-01:20.720",
  "1926-03-01:20.720",
  "1926-04-01:20.720",
  "1926-05-01:20.720",
  "1926-06-01:20.720",
  "1926-07-01:20.720",
  "1926-08-01:20.720",
  "1926-09-01:20.720",
  "1926-10-01:20.720",
  "1926-11-01:20.720",
  "1926-12-01:20.720",
  "1927-01-01:20.750",
  "1927-02-01:20.750",
  "1927-03-01:20.750",
  "1927-04-01:20.750",
  "1927-05-01:20.750",
  "1927-06-01:20.750",
  "1927-07-01:20.750",
  "1927-08-01:20.750",
  "1927-09-01:20.750",
  "1927-10-01:20.750",
  "1927-11-01:20.750",
  "1927-12-01:20.750",
  "1928-01-01:20.780",
  "1928-02-01:20.780",
  "1928-03-01:20.780",
  "1928-04-01:20.780",
  "1928-05-01:20.780",
  "1928-06-01:20.780",
  "1928-07-01:20.780",
  "1928-08-01:20.780",
  "1928-09-01:20.780",
  "1928-10-01:20.780",
  "1928-11-01:20.780",
  "1928-12-01:20.780",
  "1929-01-01:20.720",
  "1929-02-01:20.720",
  "1929-03-01:20.720",
  "1929-04-01:20.720",
  "1929-05-01:20.720",
  "1929-06-01:20.720",
  "1929-07-01:20.720",
  "1929-08-01:20.720",
  "1929-09-01:20.720",
  "1929-10-01:20.720",
  "1929-11-01:20.720",
  "1929-12-01:20.720",
  "1930-01-01:20.690",
  "1930-02-01:20.690",
  "1930-03-01:20.690",
  "1930-04-01:20.690",
  "1930-05-01:20.690",
  "1930-06-01:20.690",
  "1930-07-01:20.690",
  "1930-08-01:20.690",
  "1930-09-01:20.690",
  "1930-10-01:20.690",
  "1930-11-01:20.690",
  "1930-12-01:20.690",
  "1931-01-01:22.590",
  "1931-02-01:22.590",
  "1931-03-01:22.590",
  "1931-04-01:22.590",
  "1931-05-01:22.590",
  "1931-06-01:22.590",
  "1931-07-01:22.590",
  "1931-08-01:22.590",
  "1931-09-01:22.590",
  "1931-10-01:22.590",
  "1931-11-01:22.590",
  "1931-12-01:22.590",
  "1932-01-01:20.780",
  "1932-02-01:20.780",
  "1932-03-01:20.780",
  "1932-04-01:20.780",
  "1932-05-01:20.780",
  "1932-06-01:20.780",
  "1932-07-01:20.780",
  "1932-08-01:20.780",
  "1932-09-01:20.780",
  "1932-10-01:20.780",
  "1932-11-01:20.780",
  "1932-12-01:20.780",
  "1933-01-01:26.470",
  "1933-02-01:26.470",
  "1933-03-01:26.470",
  "1933-04-01:26.470",
  "1933-05-01:26.470",
  "1933-06-01:26.470",
  "1933-07-01:26.470",
  "1933-08-01:26.470",
  "1933-09-01:26.470",
  "1933-10-01:26.470",
  "1933-11-01:26.470",
  "1933-12-01:26.470",
  "1934-01-01:35.000",
  "1934-02-01:35.000",
  "1934-03-01:35.000",
  "1934-04-01:35.000",
  "1934-05-01:35.000",
  "1934-06-01:35.000",
  "1934-07-01:35.000",
  "1934-08-01:35.000",
  "1934-09-01:35.000",
  "1934-10-01:35.000",
  "1934-11-01:35.000",
  "1934-12-01:35.000",
  "1935-01-01:35.000",
  "1935-02-01:35.000",
  "1935-03-01:35.000",
  "1935-04-01:35.000",
  "1935-05-01:35.000",
  "1935-06-01:35.000",
  "1935-07-01:35.000",
  "1935-08-01:35.000",
  "1935-09-01:35.000",
  "1935-10-01:35.000",
  "1935-11-01:35.000",
  "1935-12-01:35.000",
  "1936-01-01:35.000",
  "1936-02-01:35.000",
  "1936-03-01:35.000",
  "1936-04-01:35.000",
  "1936-05-01:35.000",
  "1936-06-01:35.000",
  "1936-07-01:35.000",
  "1936-08-01:35.000",
  "1936-09-01:35.000",
  "1936-10-01:35.000",
  "1936-11-01:35.000",
  "1936-12-01:35.000",
  "1937-01-01:35.000",
  "1937-02-01:35.000",
  "1937-03-01:35.000",
  "1937-04-01:35.000",
  "1937-05-01:35.000",
  "1937-06-01:35.000",
  "1937-07-01:35.000",
  "1937-08-01:35.000",
  "1937-09-01:35.000",
  "1937-10-01:35.000",
  "1937-11-01:35.000",
  "1937-12-01:35.000",
  "1938-01-01:35.000",
  "1938-02-01:35.000",
  "1938-03-01:35.000",
  "1938-04-01:35.000",
  "1938-05-01:35.000",
  "1938-06-01:35.000",
  "1938-07-01:35.000",
  "1938-08-01:35.000",
  "1938-09-01:35.000",
  "1938-10-01:35.000",
  "1938-11-01:35.000",
  "1938-12-01:35.000",
  "1939-01-01:34.690",
  "1939-02-01:34.690",
  "1939-03-01:34.690",
  "1939-04-01:34.690",
  "1939-05-01:34.690",
  "1939-06-01:34.690",
  "1939-07-01:34.690",
  "1939-08-01:34.690",
  "1939-09-01:34.690",
  "1939-10-01:34.690",
  "1939-11-01:34.690",
  "1939-12-01:34.690",
  "1940-01-01:34.060",
  "1940-02-01:34.060",
  "1940-03-01:34.060",
  "1940-04-01:34.060",
  "1940-05-01:34.060",
  "1940-06-01:34.060",
  "1940-07-01:34.060",
  "1940-08-01:34.060",
  "1940-09-01:34.060",
  "1940-10-01:34.060",
  "1940-11-01:34.060",
  "1940-12-01:34.060",
  "1941-01-01:34.060",
  "1941-02-01:34.060",
  "1941-03-01:34.060",
  "1941-04-01:34.060",
  "1941-05-01:34.060",
  "1941-06-01:34.060",
  "1941-07-01:34.060",
  "1941-08-01:34.060",
  "1941-09-01:34.060",
  "1941-10-01:34.060",
  "1941-11-01:34.060",
  "1941-12-01:34.060",
  "1942-01-01:34.060",
  "1942-02-01:34.060",
  "1942-03-01:34.060",
  "1942-04-01:34.060",
  "1942-05-01:34.060",
  "1942-06-01:34.060",
  "1942-07-01:34.060",
  "1942-08-01:34.060",
  "1942-09-01:34.060",
  "1942-10-01:34.060",
  "1942-11-01:34.060",
  "1942-12-01:34.060",
  "1943-01-01:34.060",
  "1943-02-01:34.060",
  "1943-03-01:34.060",
  "1943-04-01:34.060",
  "1943-05-01:34.060",
  "1943-06-01:34.060",
  "1943-07-01:34.060",
  "1943-08-01:34.060",
  "1943-09-01:34.060",
  "1943-10-01:34.060",
  "1943-11-01:34.060",
  "1943-12-01:34.060",
  "1944-01-01:34.060",
  "1944-02-01:34.060",
  "1944-03-01:34.060",
  "1944-04-01:34.060",
  "1944-05-01:34.060",
  "1944-06-01:34.060",
  "1944-07-01:34.060",
  "1944-08-01:34.060",
  "1944-09-01:34.060",
  "1944-10-01:34.060",
  "1944-11-01:34.060",
  "1944-12-01:34.060",
  "1945-01-01:35.000",
  "1945-02-01:35.000",
  "1945-03-01:35.000",
  "1945-04-01:35.000",
  "1945-05-01:35.000",
  "1945-06-01:35.000",
  "1945-07-01:35.000",
  "1945-08-01:35.000",
  "1945-09-01:35.000",
  "1945-10-01:35.000",
  "1945-11-01:35.000",
  "1945-12-01:35.000",
  "1946-01-01:35.000",
  "1946-02-01:35.000",
  "1946-03-01:35.000",
  "1946-04-01:35.000",
  "1946-05-01:35.000",
  "1946-06-01:35.000",
  "1946-07-01:35.000",
  "1946-08-01:35.000",
  "1946-09-01:35.000",
  "1946-10-01:35.000",
  "1946-11-01:35.000",
  "1946-12-01:35.000",
  "1947-01-01:35.000",
  "1947-02-01:35.000",
  "1947-03-01:35.000",
  "1947-04-01:35.000",
  "1947-05-01:35.000",
  "1947-06-01:35.000",
  "1947-07-01:35.000",
  "1947-08-01:35.000",
  "1947-09-01:35.000",
  "1947-10-01:35.000",
  "1947-11-01:35.000",
  "1947-12-01:35.000",
  "1948-01-01:35.000",
  "1948-02-01:35.000",
  "1948-03-01:35.000",
  "1948-04-01:35.000",
  "1948-05-01:35.000",
  "1948-06-01:35.000",
  "1948-07-01:35.000",
  "1948-08-01:35.000",
  "1948-09-01:35.000",
  "1948-10-01:35.000",
  "1948-11-01:35.000",
  "1948-12-01:35.000",
  "1949-01-01:31.880",
  "1949-02-01:31.880",
  "1949-03-01:31.880",
  "1949-04-01:31.880",
  "1949-05-01:31.880",
  "1949-06-01:31.880",
  "1949-07-01:31.880",
  "1949-08-01:31.880",
  "1949-09-01:31.880",
  "1949-10-01:31.880",
  "1949-11-01:31.880",
  "1949-12-01:31.880",
  "1950-01-01:35.000",
  "1950-02-01:35.000",
  "1950-03-01:35.000",
  "1950-04-01:35.000",
  "1950-05-01:35.000",
  "1950-06-01:35.000",
  "1950-07-01:35.000",
  "1950-08-01:35.000",
  "1950-09-01:35.000",
  "1950-10-01:35.000",
  "1950-11-01:35.000",
  "1950-12-01:35.000",
  "1951-01-01:35.000",
  "1951-02-01:35.000",
  "1951-03-01:35.000",
  "1951-04-01:35.000",
  "1951-05-01:35.000",
  "1951-06-01:35.000",
  "1951-07-01:35.000",
  "1951-08-01:35.000",
  "1951-09-01:35.000",
  "1951-10-01:35.000",
  "1951-11-01:35.000",
  "1951-12-01:35.000",
  "1952-01-01:34.690",
  "1952-02-01:34.690",
  "1952-03-01:34.690",
  "1952-04-01:34.690",
  "1952-05-01:34.690",
  "1952-06-01:34.690",
  "1952-07-01:34.690",
  "1952-08-01:34.690",
  "1952-09-01:34.690",
  "1952-10-01:34.690",
  "1952-11-01:34.690",
  "1952-12-01:34.690",
  "1953-01-01:35.000",
  "1953-02-01:35.000",
  "1953-03-01:35.000",
  "1953-04-01:35.000",
  "1953-05-01:35.000",
  "1953-06-01:35.000",
  "1953-07-01:35.000",
  "1953-08-01:35.000",
  "1953-09-01:35.000",
  "1953-10-01:35.000",
  "1953-11-01:35.000",
  "1953-12-01:35.000",
  "1954-01-01:35.310",
  "1954-02-01:35.310",
  "1954-03-01:35.310",
  "1954-04-01:35.310",
  "1954-05-01:35.310",
  "1954-06-01:35.310",
  "1954-07-01:35.310",
  "1954-08-01:35.310",
  "1954-09-01:35.310",
  "1954-10-01:35.310",
  "1954-11-01:35.310",
  "1954-12-01:35.310",
  "1955-01-01:35.310",
  "1955-02-01:35.310",
  "1955-03-01:35.310",
  "1955-04-01:35.310",
  "1955-05-01:35.310",
  "1955-06-01:35.310",
  "1955-07-01:35.310",
  "1955-08-01:35.310",
  "1955-09-01:35.310",
  "1955-10-01:35.310",
  "1955-11-01:35.310",
  "1955-12-01:35.310",
  "1956-01-01:35.310",
  "1956-02-01:35.310",
  "1956-03-01:35.310",
  "1956-04-01:35.310",
  "1956-05-01:35.310",
  "1956-06-01:35.310",
  "1956-07-01:35.310",
  "1956-08-01:35.310",
  "1956-09-01:35.310",
  "1956-10-01:35.310",
  "1956-11-01:35.310",
  "1956-12-01:35.310",
  "1957-01-01:35.000",
  "1957-02-01:35.000",
  "1957-03-01:35.000",
  "1957-04-01:35.000",
  "1957-05-01:35.000",
  "1957-06-01:35.000",
  "1957-07-01:35.000",
  "1957-08-01:35.000",
  "1957-09-01:35.000",
  "1957-10-01:35.000",
  "1957-11-01:35.000",
  "1957-12-01:35.000",
  "1958-01-01:35.310",
  "1958-02-01:35.310",
  "1958-03-01:35.310",
  "1958-04-01:35.310",
  "1958-05-01:35.310",
  "1958-06-01:35.310",
  "1958-07-01:35.310",
  "1958-08-01:35.310",
  "1958-09-01:35.310",
  "1958-10-01:35.310",
  "1958-11-01:35.310",
  "1958-12-01:35.310",
  "1959-01-01:35.310",
  "1959-02-01:35.310",
  "1959-03-01:35.310",
  "1959-04-01:35.310",
  "1959-05-01:35.310",
  "1959-06-01:35.310",
  "1959-07-01:35.310",
  "1959-08-01:35.310",
  "1959-09-01:35.310",
  "1959-10-01:35.310",
  "1959-11-01:35.310",
  "1959-12-01:35.310",
  "1960-01-01:35.310",
  "1960-02-01:35.310",
  "1960-03-01:35.310",
  "1960-04-01:35.310",
  "1960-05-01:35.310",
  "1960-06-01:35.310",
  "1960-07-01:35.310",
  "1960-08-01:35.310",
  "1960-09-01:35.310",
  "1960-10-01:35.310",
  "1960-11-01:35.310",
  "1960-12-01:35.310",
  "1961-01-01:35.310",
  "1961-02-01:35.310",
  "1961-03-01:35.310",
  "1961-04-01:35.310",
  "1961-05-01:35.310",
  "1961-06-01:35.310",
  "1961-07-01:35.310",
  "1961-08-01:35.310",
  "1961-09-01:35.310",
  "1961-10-01:35.310",
  "1961-11-01:35.310",
  "1961-12-01:35.310",
  "1962-01-01:35.310",
  "1962-02-01:35.310",
  "1962-03-01:35.310",
  "1962-04-01:35.310",
  "1962-05-01:35.310",
  "1962-06-01:35.310",
  "1962-07-01:35.310",
  "1962-08-01:35.310",
  "1962-09-01:35.310",
  "1962-10-01:35.310",
  "1962-11-01:35.310",
  "1962-12-01:35.310",
  "1963-01-01:35.310",
  "1963-02-01:35.310",
  "1963-03-01:35.310",
  "1963-04-01:35.310",
  "1963-05-01:35.310",
  "1963-06-01:35.310",
  "1963-07-01:35.310",
  "1963-08-01:35.310",
  "1963-09-01:35.310",
  "1963-10-01:35.310",
  "1963-11-01:35.310",
  "1963-12-01:35.310",
  "1964-01-01:35.310",
  "1964-02-01:35.310",
  "1964-03-01:35.310",
  "1964-04-01:35.310",
  "1964-05-01:35.310",
  "1964-06-01:35.310",
  "1964-07-01:35.310",
  "1964-08-01:35.310",
  "1964-09-01:35.310",
  "1964-10-01:35.310",
  "1964-11-01:35.310",
  "1964-12-01:35.310",
  "1965-01-01:35.310",
  "1965-02-01:35.310",
  "1965-03-01:35.310",
  "1965-04-01:35.310",
  "1965-05-01:35.310",
  "1965-06-01:35.310",
  "1965-07-01:35.310",
  "1965-08-01:35.310",
  "1965-09-01:35.310",
  "1965-10-01:35.310",
  "1965-11-01:35.310",
  "1965-12-01:35.310",
  "1966-01-01:35.310",
  "1966-02-01:35.310",
  "1966-03-01:35.310",
  "1966-04-01:35.310",
  "1966-05-01:35.310",
  "1966-06-01:35.310",
  "1966-07-01:35.310",
  "1966-08-01:35.310",
  "1966-09-01:35.310",
  "1966-10-01:35.310",
  "1966-11-01:35.310",
  "1966-12-01:35.310",
  "1967-01-01:35.310",
  "1967-02-01:35.310",
  "1967-03-01:35.310",
  "1967-04-01:35.310",
  "1967-05-01:35.310",
  "1967-06-01:35.310",
  "1967-07-01:35.310",
  "1967-08-01:35.310",
  "1967-09-01:35.310",
  "1967-10-01:35.310",
  "1967-11-01:35.310",
  "1967-12-01:35.310",
  "1968-01-01:40.310",
  "1968-02-01:40.310",
  "1968-03-01:40.310",
  "1968-04-01:40.310",
  "1968-05-01:40.310",
  "1968-06-01:40.310",
  "1968-07-01:40.310",
  "1968-08-01:40.310",
  "1968-09-01:40.310",
  "1968-10-01:40.310",
  "1968-11-01:40.310",
  "1968-12-01:40.310",
  "1969-01-01:41.880",
  "1969-02-01:41.880",
  "1969-03-01:41.880",
  "1969-04-01:41.880",
  "1969-05-01:41.880",
  "1969-06-01:41.880",
  "1969-07-01:41.880",
  "1969-08-01:41.880",
  "1969-09-01:41.880",
  "1969-10-01:41.880",
  "1969-11-01:41.880",
  "1969-12-01:41.880",
  "1970-01-01:36.560",
  "1970-02-01:36.560",
  "1970-03-01:36.560",
  "1970-04-01:36.560",
  "1970-05-01:36.560",
  "1970-06-01:36.560",
  "1970-07-01:36.560",
  "1970-08-01:36.560",
  "1970-09-01:36.560",
  "1970-10-01:36.560",
  "1970-11-01:36.560",
  "1970-12-01:36.560"]

inputData = [
  "1971-01-01:37.880", 
  "1971-02-01:38.740",
  "1971-03-01:38.870",
  "1971-04-01:39.010",
  "1971-05-01:40.520",
  "1971-06-01:40.100",
  "1971-07-01:40.950",
  "1971-08-01:42.710",
  "1971-09-01:42.030",
  "1971-10-01:42.500",
  "1971-11-01:42.860",
  "1971-12-01:43.480",
  "1972-01-01:45.750",
  "1972-02-01:48.260",
  "1972-03-01:48.330",
  "1972-04-01:49.030",
  "1972-05-01:54.620",
  "1972-06-01:62.090",
  "1972-07-01:65.660",
  "1972-08-01:67.030",
  "1972-09-01:65.460",
  "1972-10-01:64.860",
  "1972-11-01:62.910",
  "1972-12-01:63.910",
  "1973-01-01:65.140",
  "1973-02-01:74.200",
  "1973-03-01:84.460",
  "1973-04-01:90.510",
  "1973-05-01:102.560",
  "1973-06-01:120.200",
  "1973-07-01:119.920",
  "1973-08-01:106.580",
  "1973-09-01:102.670",
  "1973-10-01:100.080",
  "1973-11-01:95.220",
  "1973-12-01:106.750",
  "1974-01-01:129.510",
  "1974-02-01:151.220",
  "1974-03-01:168.580",
  "1974-04-01:172.120",
  "1974-05-01:162.950",
  "1974-06-01:153.790",
  "1974-07-01:143.990",
  "1974-08-01:154.490",
  "1974-09-01:151.420",
  "1974-10-01:158.980",
  "1974-11-01:182.500",
  "1974-12-01:183.720",
  "1975-01-01:176.520",
  "1975-02-01:179.730",
  "1975-03-01:178.040",
  "1975-04-01:169.580",
  "1975-05-01:167.270",
  "1975-06-01:164.360",
  "1975-07-01:165.170",
  "1975-08-01:162.700",
  "1975-09-01:143.830",
  "1975-10-01:142.750",
  "1975-11-01:142.280",
  "1975-12-01:139.310",
  "1976-01-01:131.250",
  "1976-02-01:131.140",
  "1976-03-01:132.510",
  "1976-04-01:127.920",
  "1976-05-01:126.890",
  "1976-06-01:125.620",
  "1976-07-01:117.510",
  "1976-08-01:109.780",
  "1976-09-01:114.380",
  "1976-10-01:116.160",
  "1976-11-01:130.640",
  "1976-12-01:133.950",
  "1977-01-01:132.200",
  "1977-02-01:136.520",
  "1977-03-01:148.380",
  "1977-04-01:149.170",
  "1977-05-01:146.500",
  "1977-06-01:140.750",
  "1977-07-01:143.430",
  "1977-08-01:144.980",
  "1977-09-01:149.750",
  "1977-10-01:159.030",
  "1977-11-01:162.050",
  "1977-12-01:160.330",
  "1978-01-01:173.350",
  "1978-02-01:178.310",
  "1978-03-01:183.680",
  "1978-04-01:174.700",
  "1978-05-01:176.640",
  "1978-06-01:183.760",
  "1978-07-01:189.250",
  "1978-08-01:206.370",
  "1978-09-01:212.290",
  "1978-10-01:227.630",
  "1978-11-01:205.330",
  "1978-12-01:207.700",
  "1979-01-01:227.330",
  "1979-02-01:246.160",
  "1979-03-01:241.840",
  "1979-04-01:239.360",
  "1979-05-01:258.270",
  "1979-06-01:279.240",
  "1979-07-01:294.860",
  "1979-08-01:301.550",
  "1979-09-01:357.410",
  "1979-10-01:390.870",
  "1979-11-01:393.140",
  "1979-12-01:455.920",
  "1980-01-01:677.970",
  "1980-02-01:664.300",
  "1980-03-01:550.620",
  "1980-04-01:516.920",
  "1980-05-01:515.610",
  "1980-06-01:603.060",
  "1980-07-01:643.460",
  "1980-08-01:627.320",
  "1980-09-01:674.840",
  "1980-10-01:660.250",
  "1980-11-01:623.330",
  "1980-12-01:593.840",
  "1981-01-01:555.830",
  "1981-02-01:499.060",
  "1981-03-01:499.870",
  "1981-04-01:495.130",
  "1981-05-01:479.370",
  "1981-06-01:459.350",
  "1981-07-01:408.610",
  "1981-08-01:410.910",
  "1981-09-01:444.100",
  "1981-10-01:437.600",
  "1981-11-01:412.710",
  "1981-12-01:410.300",
  "1982-01-01:383.950",
  "1982-02-01:373.670",
  "1982-03-01:329.510",
  "1982-04-01:350.660",
  "1982-05-01:333.210",
  "1982-06-01:314.790",
  "1982-07-01:339.900",
  "1982-08-01:365.510",
  "1982-09-01:437.240",
  "1982-10-01:422.730",
  "1982-11-01:415.210",
  "1982-12-01:444.400",
  "1983-01-01:482.760",
  "1983-02-01:488.750",
  "1983-03-01:419.940",
  "1983-04-01:432.980",
  "1983-05-01:437.420",
  "1983-06-01:412.980",
  "1983-07-01:422.600",
  "1983-08-01:416.340",
  "1983-09-01:411.180",
  "1983-10-01:393.310",
  "1983-11-01:382.180",
  "1983-12-01:388.030",
  "1984-01-01:370.800",
  "1984-02-01:386.570",
  "1984-03-01:394.130",
  "1984-04-01:380.910",
  "1984-05-01:377.810",
  "1984-06-01:377.100",
  "1984-07-01:346.760",
  "1984-08-01:347.800",
  "1984-09-01:341.120",
  "1984-10-01:339.920",
  "1984-11-01:341.080",
  "1984-12-01:319.560",
  "1985-01-01:302.250",
  "1985-02-01:298.320",
  "1985-03-01:304.470",
  "1985-04-01:325.060",
  "1985-05-01:316.500",
  "1985-06-01:316.390",
  "1985-07-01:317.620",
  "1985-08-01:329.970",
  "1985-09-01:322.770",
  "1985-10-01:325.870",
  "1985-11-01:325.200",
  "1985-12-01:321.610",
  "1986-01-01:345.850",
  "1986-02-01:338.600",
  "1986-03-01:345.640",
  "1986-04-01:340.710",
  "1986-05-01:342.490",
  "1986-06-01:342.650",
  "1986-07-01:348.680",
  "1986-08-01:377.360",
  "1986-09-01:418.050",
  "1986-10-01:423.130",
  "1986-11-01:397.690",
  "1986-12-01:390.800",
  "1987-01-01:408.290",
  "1987-02-01:401.020",
  "1987-03-01:409.240",
  "1987-04-01:439.280",
  "1987-05-01:459.950",
  "1987-06-01:449.660",
  "1987-07-01:451.140",
  "1987-08-01:460.660",
  "1987-09-01:460.230",
  "1987-10-01:465.690",
  "1987-11-01:468.010",
  "1987-12-01:486.740",
  "1988-01-01:475.890",
  "1988-02-01:441.520",
  "1988-03-01:443.630",
  "1988-04-01:451.620",
  "1988-05-01:451.140",
  "1988-06-01:450.880",
  "1988-07-01:437.560",
  "1988-08-01:431.180",
  "1988-09-01:412.020",
  "1988-10-01:407.140",
  "1988-11-01:420.480",
  "1988-12-01:418.920",
  "1989-01-01:403.570",
  "1989-02-01:387.550",
  "1989-03-01:390.020",
  "1989-04-01:384.370",
  "1989-05-01:370.620",
  "1989-06-01:367.900",
  "1989-07-01:374.910",
  "1989-08-01:365.150",
  "1989-09-01:361.910",
  "1989-10-01:367.030",
  "1989-11-01:395.190",
  "1989-12-01:409.250",
  "1990-01-01:410.490",
  "1990-02-01:416.580",
  "1990-03-01:392.210",
  "1990-04-01:374.290",
  "1990-05-01:369.050",
  "1990-06-01:352.190",
  "1990-07-01:362.850",
  "1990-08-01:395.470",
  "1990-09-01:388.820",
  "1990-10-01:380.390",
  "1990-11-01:381.730",
  "1990-12-01:377.690",
  "1991-01-01:383.040",
  "1991-02-01:363.890",
  "1991-03-01:363.230",
  "1991-04-01:358.370",
  "1991-05-01:356.970",
  "1991-06-01:366.870",
  "1991-07-01:367.570",
  "1991-08-01:355.880",
  "1991-09-01:348.880",
  "1991-10-01:358.770",
  "1991-11-01:360.420",
  "1991-12-01:361.080",
  "1992-01-01:354.570",
  "1992-02-01:353.730",
  "1992-03-01:344.200",
  "1992-04-01:338.340",
  "1992-05-01:337.210",
  "1992-06-01:340.960",
  "1992-07-01:353.290",
  "1992-08-01:342.670",
  "1992-09-01:345.710",
  "1992-10-01:344.170",
  "1992-11-01:334.920",
  "1992-12-01:334.810",
  "1993-01-01:329.050",
  "1993-02-01:329.310",
  "1993-03-01:330.250",
  "1993-04-01:341.890",
  "1993-05-01:367.740",
  "1993-06-01:371.930",
  "1993-07-01:392.790",
  "1993-08-01:377.970",
  "1993-09-01:354.930",
  "1993-10-01:364.400",
  "1993-11-01:374.050",
  "1993-12-01:383.630",
  "1994-01-01:386.560",
  "1994-02-01:381.900",
  "1994-03-01:384.080",
  "1994-04-01:377.290",
  "1994-05-01:381.540",
  "1994-06-01:385.600",
  "1994-07-01:385.470",
  "1994-08-01:380.400",
  "1994-09-01:391.740",
  "1994-10-01:389.570",
  "1994-11-01:384.290",
  "1994-12-01:379.260",
  "1995-01-01:378.440",
  "1995-02-01:376.630",
  "1995-03-01:382.480",
  "1995-04-01:390.890",
  "1995-05-01:385.040",
  "1995-06-01:387.580",
  "1995-07-01:386.190",
  "1995-08-01:383.780",
  "1995-09-01:383.100",
  "1995-10-01:383.250",
  "1995-11-01:385.190",
  "1995-12-01:387.350",
  "1996-01-01:400.490",
  "1996-02-01:404.530",
  "1996-03-01:396.150",
  "1996-04-01:392.790",
  "1996-05-01:391.960",
  "1996-06-01:385.040",
  "1996-07-01:383.580",
  "1996-08-01:387.460",
  "1996-09-01:382.900",
  "1996-10-01:381.040",
  "1996-11-01:377.690",
  "1996-12-01:368.950",
  "1997-01-01:353.870",
  "1997-02-01:347.030",
  "1997-03-01:351.490",
  "1997-04-01:344.230",
  "1997-05-01:344.090",
  "1997-06-01:340.510",
  "1997-07-01:323.900",
  "1997-08-01:324.020",
  "1997-09-01:323.110",
  "1997-10-01:324.360",
  "1997-11-01:305.550",
  "1997-12-01:288.590",
  "1998-01-01:289.150",
  "1998-02-01:297.490",
  "1998-03-01:295.940",
  "1998-04-01:308.290",
  "1998-05-01:299.100",
  "1998-06-01:292.320",
  "1998-07-01:292.870",
  "1998-08-01:284.110",
  "1998-09-01:288.980",
  "1998-10-01:295.930",
  "1998-11-01:294.170",
  "1998-12-01:291.680",
  "1999-01-01:287.070",
  "1999-02-01:287.330",
  "1999-03-01:285.960",
  "1999-04-01:282.620",
  "1999-05-01:276.440",
  "1999-06-01:261.310",
  "1999-07-01:256.080",
  "1999-08-01:256.690",
  "1999-09-01:264.740",
  "1999-10-01:310.720",
  "1999-11-01:293.180",
  "1999-12-01:283.070",
  "2000-01-01:284.320",
  "2000-02-01:299.860",
  "2000-03-01:286.390",
  "2000-04-01:279.690",
  "2000-05-01:275.190",
  "2000-06-01:285.730",
  "2000-07-01:281.590",
  "2000-08-01:274.470",
  "2000-09-01:273.680",
  "2000-10-01:270.000",
  "2000-11-01:266.010",
  "2000-12-01:271.450",
  "2001-01-01:265.490",
  "2001-02-01:261.870",
  "2001-03-01:263.030",
  "2001-04-01:260.480",
  "2001-05-01:272.360",
  "2001-06-01:269.820",
  "2001-07-01:267.530",
  "2001-08-01:272.390",
  "2001-09-01:283.420",
  "2001-10-01:283.060",
  "2001-11-01:276.160",
  "2001-12-01:275.850",
  "2002-01-01:281.510",
  "2002-02-01:295.500",
  "2002-03-01:294.060",
  "2002-04-01:302.680",
  "2002-05-01:314.580",
  "2002-06-01:321.180",
  "2002-07-01:313.290",
  "2002-08-01:310.250",
  "2002-09-01:319.140",
  "2002-10-01:316.560",
  "2002-11-01:319.070",
  "2002-12-01:331.920",
  "2003-01-01:356.860",
  "2003-02-01:358.970",
  "2003-03-01:340.550",
  "2003-04-01:328.180",
  "2003-05-01:355.680",
  "2003-06-01:356.350",
  "2003-07-01:350.990",
  "2003-08-01:359.770",
  "2003-09-01:378.950",
  "2003-10-01:378.920",
  "2003-11-01:389.910",
  "2003-12-01:406.110",
  "2004-01-01:413.790",
  "2004-02-01:404.950",
  "2004-03-01:406.670",
  "2004-04-01:403.260",
  "2004-05-01:383.780",
  "2004-06-01:392.480",
  "2004-07-01:398.090",
  "2004-08-01:400.510",
  "2004-09-01:405.280",
  "2004-10-01:420.460",
  "2004-11-01:439.380",
  "2004-12-01:442.080",
  "2005-01-01:424.030",
  "2005-02-01:423.350",
  "2005-03-01:434.320",
  "2005-04-01:429.230",
  "2005-05-01:421.870",
  "2005-06-01:430.660",
  "2005-07-01:424.480",
  "2005-08-01:437.930",
  "2005-09-01:456.050",
  "2005-10-01:469.900",
  "2005-11-01:476.670",
  "2005-12-01:510.100",
  "2006-01-01:549.860",
  "2006-02-01:555.000",
  "2006-03-01:557.090",
  "2006-04-01:610.650",
  "2006-05-01:675.390",
  "2006-06-01:596.150",
  "2006-07-01:633.710",
  "2006-08-01:632.330",
  "2006-09-01:598.060",
  "2006-10-01:585.780",
  "2006-11-01:627.830",
  "2006-12-01:629.420",
  "2007-01-01:631.170",
  "2007-02-01:664.750",
  "2007-03-01:654.900",
  "2007-04-01:679.370",
  "2007-05-01:666.920",
  "2007-06-01:655.490",
  "2007-07-01:665.300",
  "2007-08-01:665.410",
  "2007-09-01:712.650",
  "2007-10-01:754.600",
  "2007-11-01:806.250",
  "2007-12-01:803.200",
  "2008-01-01:889.600",
  "2008-02-01:922.300",
  "2008-03-01:968.430",
  "2008-04-01:909.700",
  "2008-05-01:890.510",
  "2008-06-01:930.000",
  "2008-07-01:920.000",
  "2008-08-01:835.000",
  "2008-09-01:888.500",
  "2008-10-01:730.750",
  "2008-11-01:814.500",
  "2008-12-01:869.750",
  "2009-01-01:919.500",
  "2009-02-01:952.000",
  "2009-03-01:897.750",
  "2009-04-01:883.250",
  "2009-05-01:975.500",
  "2009-06-01:934.500",
  "2009-07-01:939.000",
  "2009-08-01:955.500",
  "2009-09-01:1015.750",
  "2009-10-01:1040.000",
  "2009-11-01:1175.750",
  "2009-12-01:1087.500",
  "2010-01-01:1078.500",
  "2010-02-01:1108.250",
  "2010-03-01:1115.500",
  "2010-04-01:1179.250",
  "2010-05-01:1207.500",
  "2010-06-01:1234.500",
  "2010-07-01:1169.000",
  "2010-08-01:1235.000",
  "2010-09-01:1294.000",
  "2010-10-01:1346.750",
  "2010-11-01:1383.500",
  "2010-12-01:1405.500",
  "2011-01-01:1327.000",
  "2011-02-01:1411.000",
  "2011-03-01:1439.000",
  "2011-04-01:1535.500",
  "2011-05-01:1533.000",
  "2011-06-01:1504.250",
  "2011-07-01:1613.500",
  "2011-08-01:1825.000",
  "2011-09-01:1620.000",
  "2011-10-01:1722.000",
  "2011-11-01:1746.000",
  "2011-12-01:1531.000",
  "2012-01-01:1744.000",
  "2012-02-01:1770.000",
  "2012-03-01:1662.500",
  "2012-04-01:1651.250",
  "2012-05-01:1558.000",
  "2012-06-01:1598.500",
  "2012-07-01:1622.000",
  "2012-08-01:1648.500",
  "2012-09-01:1776.000",
  "2012-10-01:1719.000",
  "2012-11-01:1726.000",
  "2012-12-01:1657.500",
  "2013-01-01:1664.750",
  "2013-02-01:1588.500",
  "2013-03-01:1598.250",
  "2013-04-01:1469.000",
  "2013-05-01:1394.500",
  "2013-06-01:1192.000",
  "2013-07-01:1314.500",
  "2013-08-01:1394.750",
  "2013-09-01:1326.500",
  "2013-10-01:1324.000",
  "2013-11-01:1253.000",
  "2013-12-01:1204.500",
  "2014-01-01:1251.000",
  "2014-02-01:1326.500",
  "2014-03-01:1291.750",
  "2014-04-01:1288.500",
  "2014-05-01:1250.500",
  "2014-06-01:1315.000",
  "2014-07-01:1285.250",
  "2014-08-01:1285.750",
  "2014-09-01:1216.500",
  "2014-10-01:1164.250",
  "2014-11-01:1182.750",
  "2014-12-01:1206.000",
  "2015-01-01:1260.250",
  "2015-02-01:1214.000",
  "2015-03-01:1187.000",
  "2015-04-01:1180.250",
  "2015-05-01:1191.400",
  "2015-06-01:1171.000",
  "2015-07-01:1098.400",
  "2015-08-01:1135.000",
  "2015-09-01:1114.000",
  "2015-10-01:1142.350",
  "2015-11-01:1061.900",
  "2015-12-01:1069.250",
  "2016-01-01:1114.700",
  "2016-02-01:1122.000",
  "2016-03-01:1240.000",
  "2016-04-01:1230.850",
  "2016-05-01:1217.500",
  "2016-06-01:1320.600",
  "2016-07-01:1357.500",
  "2016-08-01:1311.400",
  "2016-09-01:1317.100",
  "2016-10-01:1273.100",
  "2016-11-01:1173.900",
  "2016-12-01:1151.700",
  "2017-01-01:1211.400",
  "2017-02-01:1253.900",
  "2017-03-01:1251.200",
  "2017-04-01:1268.300",
  "2017-05-01:1275.400",
  "2017-06-01:1242.300",
  "2017-07-01:1273.400",
  "2017-08-01:1322.200",
  "2017-09-01:1284.800",
  "2017-10-01:1270.500",
  "2017-11-01:1282.150",
  "2017-12-01:1296.500",
  "2018-01-01:1343.350",
  "2018-02-01:1320.300",
  "2018-03-01:1323.900",
  "2018-04-01:1316.250",
  "2018-05-01:1303.500",
  "2018-06-01:1250.550",
  "2018-07-01:1219.200",
  "2018-08-01:1206.850",
  "2018-09-01:1183.500",
  "2018-10-01:1217.700",
  "2018-11-01:1220.450",
  "2018-12-01:1281.650",
  "2019-01-01:1322.500",
  "2019-02-01:1325.450",
  "2019-03-01:1291.150",
  "2019-04-01:1285.150",
  "2019-05-01:1296.000",
  "2019-06-01:1413.200",
  "2019-07-01:1430.550",
  "2019-08-01:1526.550",
  "2019-09-01:1487.600",
  "2019-10-01:1506.400",
  "2019-11-01:1456.350",
  "2019-12-01:1523.000",
  "2020-01-01:1580.850",
  "2020-02-01:1626.350",
  "2020-03-01:1604.650",
  "2020-04-01:1716.750",
  "2020-05-01:1725.650",
  "2020-06-01:1770.700",
  "2020-07-01:1971.680",
  "2020-08-01:1970.500",
  "2020-09-01:1893.900",
  "2020-10-01:1879.900",
  "2020-11-01:1779.860",
  "2020-12-01:1895.100",
  "2021-01-01:1849.700",
  "2021-02-01:1728.800",
  "2021-03-01:1715.240",
  "2021-04-01:1767.700",
  "2021-05-01:1904.740",
  "2021-06-01:1771.600",
  "2021-07-01:1814.120",
  "2021-08-01:1815.800",
  "2021-09-01:1756.660",
  "2021-10-01:1783.900",
  "2021-11-01:1775.920",
  "2021-12-01:1828.600",
  "2022-01-01:1796.120",
  "2022-02-01:1900.700",
  "2022-03-01:1953.040",
  "2022-04-01:1911.700",
  "2022-05-01:1847.260",
  "2022-06-01:1829.338",
  "2022-07-01:1766.431",
  "2022-08-01:1708.580",
  "2022-09-01:1660.880",
  "2022-10-01:1632.380",
  "2022-11-01:1768.610",
  "2022-12-01:1824.323",
  "2023-01-01:1928.120",
  "2023-02-01:1826.740",
  "2023-03-01:1969.546",
  "2023-04-01:1990.600",
  "2023-05-01:1965.200",
  "2023-06-01:1919.569",
  "2023-07-01:1964.339",
  "2023-08-01:1939.828",
  "2023-09-01:1848.490",
  "2023-10-01:1984.011",
  "2023-11-01:2001.900",
  "2023-12-01:2062.923",
  "2024-01-01:2039.154",
  "2024-02-01:2044.200",
  "2024-03-01:2190.777"]

dates = []
prices = []
calc5YRates = []
calc10YRates = []
calc20YRates = []
calc30YRates = []
for dataRowStr in inputData:
  dataRow = dataRowStr.split(":")
  #date = datetime.datetime.strptime("1 1 " + dataRow[0], "%d %m %Y").date()
  date = datetime.datetime.strptime(dataRow[0], "%Y-%m-%d").date()
  price = float(dataRow[1])
  dates.append(date)
  prices.append(price)
  mInY = 12 # Month count in year
  if len(prices) > 5 * mInY:
    calc5YRates.append((float(prices[-1]) / prices[-1 - 5 * mInY]) ** (1/5.0))
  else:
    calc5YRates.append(float("nan"))
  if len(prices) > 10 * mInY:
    calc10YRates.append((float(prices[-1]) / prices[-1 - 10 * mInY]) ** (1/10.0))
  else:
    calc10YRates.append(float("nan"))
  if len(prices) > 20 * mInY:
    calc20YRates.append((float(prices[-1]) / prices[-1 - 20 * mInY]) ** (1/20.0))
  else:
    calc20YRates.append(float("nan"))
  if len(prices) > 30 * mInY:
    calc30YRates.append((float(prices[-1]) / prices[-1 - 30 * mInY]) ** (1/30.0))
  else:
    calc30YRates.append(float("nan"))

if plotPrices:
  fig, biax = plt.subplots()
  figSize = fig.get_size_inches()#_
  fig.set_size_inches(figSize[0] * 4/3, figSize[1])
  biax.set(xlabel="Date (Label on 1 January)", ylabel="Gold Price (USD)", title="Gold price in USD per troy ounce, monthly step (per macrotrends.net)")
  xtickDates, xtickDatesStr = [], []
  for idx, date in enumerate(dates):
    if date.month == 1 and date.day == 1:
      xtickDates.append(date)
      xtickDatesStr.append(str(date.year) if date.year % 2 == 0 else "")
  plt.xticks(xtickDates, xtickDatesStr, rotation=70)
  plt.yticks([x * 250 for x in range(0, 10)])
  plt.plot(dates, prices, color="#6699CC")
  plt.grid(linewidth=0.25, color="#CCCCCC")
  plt.tight_layout()
  plt.savefig("GoldPriceUSD.svg")

if plot5YRates:
  fig, biax = plt.subplots()
  figSize = fig.get_size_inches()#_
  fig.set_size_inches(figSize[0] * 4/3, figSize[1])
  biax.set(xlabel="Withdrawal date (label on 1 January)", ylabel="Gold Price (USD) Change Rate",
           title="5-year change rate of gold price in USD, annualized (base data per macrotrends.net)\n" +
                 "The date of withdrawal, the date of deposit being 5 years before")
  xtickDates, xtickDatesStr = [], []
  for idx, date in enumerate(dates):
    if date.month == 1 and date.day == 1:
      xtickDates.append(date)
      xtickDatesStr.append(str(date.year) if date.year % 2 == 0 else "")
  plt.xticks(xtickDates, xtickDatesStr, rotation=70)
  plt.axhline(1, color='#BBBBBB', linewidth=0.75)
  plt.plot(dates, calc5YRates, color="#6699CC")
  plt.grid(linewidth=0.25, color="#CCCCCC")
  values = biax.get_yticks()
  biax.set_yticklabels(['{:,.1%}'.format(x - 1) for x in values])
  plt.tight_layout()
  plt.savefig("GoldPrice5YYield.svg")

if plot10YRates:
  fig, biax = plt.subplots()
  figSize = fig.get_size_inches()#_
  fig.set_size_inches(figSize[0] * 4/3, figSize[1])
  biax.set(xlabel="Withdrawal date (label on 1 January)", ylabel="Gold Price (USD) Change Rate",
           title="10-year change rate of gold price in USD, annualized (base data per macrotrends.net)\n" +
                 "The date of withdrawal, the date of deposit being 10 years before")
  xtickDates, xtickDatesStr = [], []
  for idx, date in enumerate(dates):
    if date.month == 1 and date.day == 1:
      xtickDates.append(date)
      xtickDatesStr.append(str(date.year) if date.year % 2 == 0 else "")
  plt.xticks(xtickDates, xtickDatesStr, rotation=70)
  plt.axhline(1, color='#BBBBBB', linewidth=0.75)
  plt.plot(dates, calc10YRates, color="#6699CC")
  plt.grid(linewidth=0.25, color="#CCCCCC")
  values = biax.get_yticks()
  biax.set_yticklabels(['{:,.1%}'.format(x - 1) for x in values])
  plt.tight_layout()
  plt.savefig("GoldPrice10YYield.svg")
 
if plot20YRates:
  fig, biax = plt.subplots()
  figSize = fig.get_size_inches()#_
  fig.set_size_inches(figSize[0] * 4/3, figSize[1])
  biax.set(xlabel="Withdrawal date (label on 1 January)", ylabel="Gold Price (USD) Change Rate",
           title="20-year change rate of gold price in USD, annualized (base data per macrotrends.net)\n" +
                 "The date of withdrawal, the date of deposit being 20 years before")
  xtickDates, xtickDatesStr = [], []
  for idx, date in enumerate(dates):
    if date.month == 1 and date.day == 1:
      xtickDates.append(date)
      xtickDatesStr.append(str(date.year) if date.year % 2 == 0 else "")
  plt.xticks(xtickDates, xtickDatesStr, rotation=70)
  plt.axhline(1, color='#BBBBBB', linewidth=0.75)
  plt.plot(dates, calc20YRates, color="#6699CC")
  plt.grid(linewidth=0.25, color="#CCCCCC")
  values = biax.get_yticks()
  biax.set_yticklabels(['{:,.1%}'.format(x - 1) for x in values])
  plt.tight_layout()
  plt.savefig("GoldPrice20YYield.svg")

if plot30YRates:
  fig, biax = plt.subplots()
  figSize = fig.get_size_inches()#_
  fig.set_size_inches(figSize[0] * 4/3, figSize[1])
  biax.set(xlabel="Withdrawal date (label on 1 January)", ylabel="Gold Price (USD) Change Rate",
           title="30-year change rate of gold price in USD, annualized (base data per macrotrends.net)\n" +
                 "The date of withdrawal, the date of deposit being 30 years before")
  xtickDates, xtickDatesStr = [], []
  for idx, date in enumerate(dates):
    if date.month == 1 and date.day == 1:
      xtickDates.append(date)
      xtickDatesStr.append(str(date.year) if date.year % 2 == 0 else "")
  plt.xticks(xtickDates, xtickDatesStr, rotation=70)
  plt.axhline(1, color='#BBBBBB', linewidth=0.75)
  plt.plot(dates, calc30YRates, color="#6699CC")
  plt.grid(linewidth=0.25, color="#CCCCCC")
  values = biax.get_yticks()
  biax.set_yticklabels(['{:,.1%}'.format(x - 1) for x in values])
  plt.tight_layout()
  plt.savefig("GoldPrice30YYield.svg")

Captions

Gold price in USD per troy ounce

Items portrayed in this file

depicts

29 March 2024

image/svg+xml

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current07:53, 29 March 2024Thumbnail for version as of 07:53, 29 March 2024768 × 432 (84 KB)Dan PolanskyUploaded own work with UploadWizard

The following page uses this file:

Global file usage

The following other wikis use this file:

Metadata