File:UsdCircVolume5YAvgChangeRate.svg

From Wikiversity
Jump to navigation Jump to search

Original file(SVG file, nominally 864 × 432 pixels, file size: 64 KB)

This is a file from the Wikimedia Commons. The description on its description page there is shown below.

Commons is a freely licensed media file repository. You can help.

Summary

Description
English: Plotting using the following Python code:
from matplotlib import pyplot as plt
import datetime
# data from https://fred.stlouisfed.org/series/CURRCIR
inputData=[
  "1918-01-01,4.019", 
  "1919-01-01,4.763", 
  "1920-01-01,4.944", 
  "1921-01-01,5.114", 
  "1922-01-01,4.240", 
  "1923-01-01,4.392", 
  "1924-01-01,4.560", 
  "1925-01-01,4.576", 
  "1926-01-01,4.604", 
  "1927-01-01,4.616", 
  "1928-01-01,4.498", 
  "1929-01-01,4.461", 
  "1930-01-01,4.365", 
  "1931-01-01,4.408", 
  "1932-01-01,5.358", 
  "1933-01-01,5.344", 
  "1934-01-01,5.382", 
  "1935-01-01,5.411", 
  "1936-01-01,5.757", 
  "1937-01-01,6.400", 
  "1938-01-01,6.397", 
  "1939-01-01,6.712", 
  "1940-01-01,7.443", 
  "1941-01-01,8.591", 
  "1942-01-01,11.105", 
  "1943-01-01,15.399", 
  "1944-01-01,20.428", 
  "1945-01-01,25.243", 
  "1946-01-01,28.158", 
  "1947-01-01,28.543", 
  "1948-01-01,28.394", 
  "1949-01-01,27.850", 
  "1950-01-01,27.220", 
  "1951-01-01,27.304", 
  "1952-01-01,28.637", 
  "1953-01-01,29.920", 
  "1954-01-01,30.282", 
  "1955-01-01,30.110", 
  "1956-01-01,30.620", 
  "1957-01-01,31.040", 
  "1958-01-01,31.059", 
  "1959-01-01,31.555", 
  "1960-01-01,32.041", 
  "1961-01-01,32.300", 
  "1962-01-01,33.327", 
  "1963-01-01,34.616", 
  "1964-01-01,36.873", 
  "1965-01-01,39.046", 
  "1966-01-01,41.618", 
  "1967-01-01,44.000", 
  "1968-01-01,46.434", 
  "1969-01-01,49.784", 
  "1970-01-01,52.737", 
  "1971-01-01,56.192", 
  "1972-01-01,60.224", 
  "1973-01-01,65.289", 
  "1974-01-01,70.987", 
  "1975-01-01,77.831", 
  "1976-01-01,84.744", 
  "1977-01-01,92.519", 
  "1978-01-01,102.041", 
  "1979-01-01,112.335", 
  "1980-01-01,123.088", 
  "1981-01-01,133.836", 
  "1982-01-01,142.941", 
  "1983-01-01,153.954", 
  "1984-01-01,169.89", 
  "1985-01-01,180.656", 
  "1986-01-01,194.166", 
  "1987-01-01,208.204", 
  "1988-01-01,226.968", 
  "1989-01-01,244.685", 
  "1990-01-01,257.126", 
  "1991-01-01,284.909", 
  "1992-01-01,304.146", 
  "1993-01-01,331.004", 
  "1994-01-01,363.472", 
  "1995-01-01,400.687", 
  "1996-01-01,418.642", 
  "1997-01-01,444.684", 
  "1998-01-01,474.597", 
  "1999-01-01,511.037", 
  "2000-01-01,594.679", 
  "2001-01-01,585.106", 
  "2002-01-01,635.429", 
  "2003-01-01,679.411", 
  "2004-01-01,713.752", 
  "2005-01-01,750.197", 
  "2006-01-01,786.823", 
  "2007-01-01,808.848", 
  "2008-01-01,817.367", 
  "2009-01-01,886.184", 
  "2010-01-01,921.235", 
  "2011-01-01,978.912", 
  "2012-01-01,1069.691", 
  "2013-01-01,1160.082", 
  "2014-01-01,1231.631", 
  "2015-01-01,1333.447", 
  "2016-01-01,1417.331", 
  "2017-01-01,1504.579", 
  "2018-01-01,1611.341", 
  "2019-01-01,1709.726", 
  "2020-01-01,1798.984", 
  "2021-01-01,2093.534", 
  "2022-01-01,2233.526", 
  "2023-01-01,2300.46", 
  "2024-01-01,2337.788"]

dates = []
volumes = []
alternativeVolumes = []
calcRatesRaw = []
calcRates = []
initVolume = 3.714
alternativeVolume = initVolume
rate = 1.062
for dataRowStr in inputData:
  dataRow = dataRowStr.split(",")
  date = datetime.datetime.strptime(dataRow[0], "%Y-%m-%d").date()
  volume = float(dataRow[1])
  dates.append(date)
  volumes.append(volume)
  alternativeVolumes.append(alternativeVolume)
  alternativeVolume *= rate
  if len(volumes) > 1:
    calcRatesRaw.append(volumes[-1] / volumes[-1 - 1])
  else:
    calcRatesRaw.append(float("nan"))
  if len(volumes) > 5:
    calcRates.append((volumes[-1] / volumes[-1 - 5]) ** (1/5.0))
  else:
    calcRates.append(float("nan"))
fig, biax = plt.subplots()
figSize = fig.get_size_inches()
fig.set_size_inches(figSize[0] * 3/2, figSize[1])
biax.set(xlabel="Date", ylabel="Volume (billions of dollars)", title="USD circulation volume (per stlouisfed.org)\n"
         "2nd value: 6.2% annually growth curve")
plt.plot(dates, volumes, color="#6699CC")
plt.plot(dates, alternativeVolumes, color="#CC9933")
plt.grid(linewidth=0.25, color="#DDDDDD")
plt.savefig("UsdCircVolume.svg")

# Plot annual rate of change
fig, biax = plt.subplots()
figSize = fig.get_size_inches()
fig.set_size_inches(figSize[0] * 3/2, figSize[1])
title="USD circulation volume\nAnnual rate of change (base data per stlouisfed.org)"
biax.set(xlabel="Date (1 Jan)", ylabel="Rate of change", title=title)
xtickDates = []
xtickDatesStr = []
for idx, date in enumerate(dates):
  if idx % 5 == 2:
    xtickDates.append(date)
    xtickDatesStr.append(str(date.year))
plt.xticks(xtickDates, xtickDatesStr, rotation=70)
plt.axhline(1, color='#BBBBBB', linewidth=0.75)
plt.plot(dates, calcRatesRaw, color="#6699CC")
plt.grid(linewidth=0.25, color="#DDDDDD")
values = biax.get_yticks()
biax.set_yticklabels(['{:,.0%}'.format(x - 1) for x in values])
plt.tight_layout()
plt.savefig("UsdCircVolumeChangeRate.svg")

# Plot 5Y average annual rate of change
fig, biax = plt.subplots()
figSize = fig.get_size_inches()
fig.set_size_inches(figSize[0] * 3/2, figSize[1])
title="USD circulation volume\n5-year average of annual rate of change (base data per stlouisfed.org)"
biax.set(xlabel="Date (1 Jan)", ylabel="Rate of change", title=title)
xtickDates = []
xtickDatesStr = []
for idx, date in enumerate(dates):
  if idx % 5 == 2:
    xtickDates.append(date)
    xtickDatesStr.append(str(date.year))
plt.xticks(xtickDates, xtickDatesStr, rotation=70)
plt.axhline(1, color='#BBBBBB', linewidth=0.75)
plt.plot(dates, calcRates, color="#6699CC")
plt.grid(linewidth=0.25, color="#DDDDDD")
plt.yticks([1 + x * 0.025 for x in range(-1, 12)])
values = biax.get_yticks()
biax.set_yticklabels(['{:,.1%}'.format(x - 1) for x in values])
plt.tight_layout()
plt.savefig("UsdCircVolume5YAvgChangeRate.svg")
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.

Captions

USD circulation volume - 5-year average of the change rate

Items portrayed in this file

depicts

26 March 2024

image/svg+xml

File history

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

Date/TimeThumbnailDimensionsUserComment
current12:22, 26 March 2024Thumbnail for version as of 12:22, 26 March 2024864 × 432 (64 KB)Dan PolanskyUpdate
11:18, 26 March 2024Thumbnail for version as of 11:18, 26 March 2024864 × 432 (64 KB)Dan PolanskyUploaded own work with UploadWizard

The following page uses this file:

Metadata