Gold Prices (Monthly in USD)

core

Files Size Format Created Updated License Source
2 379kB csv zip 5 months ago 1 month ago Open Data Commons Public Domain Dedication and License v1.0 Bundesbank statistics
Monthly gold prices since 1950 in USD (London market). Data is sourced from the Bundesbank. Data Bundesbank statistic page Notes from the Source General: 1 ounce of fine gold = 31.1034768g. Method of calculation: Since 1 April 1968, calculated from the daily morning fixing; From January 1950 to 21 read more
Download

Data Files

File Description Size Last changed Download
data 16kB csv (16kB) , json (32kB)
gold-prices_zip Compressed versions of dataset. Includes normalized CSV and JSON data with original data and datapackage.json. 17kB zip (17kB)

data  

This is a preview version. There might be more data in the original version.

Field information

Field Name Order Type (Format) Description
date 1 date (%Y-%m-%d)
price 2 number

Read me

Monthly gold prices since 1950 in USD (London market). Data is sourced from the Bundesbank.

Data

Notes from the Source

General: 1 ounce of fine gold = 31.1034768g. Method of calculation:

  • Since 1 April 1968, calculated from the daily morning fixing;
  • From January 1950 to 21 March 1954, calculated using the Bank of England’s gold purchasing price (1 ounce of fine = pound 12.40) in connection with the average exchange rate for the pound in New York (up to the end of 1952; source: Federal Reserve Bulletin) and, from January 1953, midpoint exchange rates for the US dollar in London (source: Financial Times (FT)).
  • From 22 March 1954 to December 1959, calculated using the fixing price for gold bars of approx. 12 1/2 kg and 995/1000 fineness and over (so-called standard bars) according to data from Metallgesellschaft AG, Frankfurt am Main, in connection with the average midpoint exchange rates for the US dollar in London (source: FT).
  • From January 1960 to 14 March 1968, average fixing price for standard bars as specified in the Bank of England’s Quarterly Bulletin.
  • On 15 March 1968, fixing price suspended. Gold market split into an official (reserved for central banks) and a free market as a result of the Washington Communique of 17 March 1968. Gold trading suspended from 18 to 29 March 1968.
  • Sources for daily prices: April 1968 - March 1974: FT; April 1974 - December 1980: Samuel Montagu & Co. Ltd.; January 1981 - December 2005: FT; January 2006 - present: Reuters.
  • Comment on 1968-03: Average from 1 to 14 March 1968.

Automation

This dataset is automatically updates every month on the datahub.io site: http://datahub.io/core/gold-prices

License

The maintainers have licensed under the Public Domain Dedication and License. The source at the Bundesbank indicates no obvious restrictions on the data and the amount means that database rights are doubtful.

Import into your tool

Data-cli or just data is the program to get and post your data with the datahub.
Use data with the datahub.io almost like you use git with the github. Here are installation instructions.

data get https://datahub.io/core/gold-prices
tree core/gold-prices
# Get a list of dataset's resources
curl -L -s https://datahub.io/core/gold-prices/datapackage.json | grep path

# Get resources

curl -L https://datahub.io/core/gold-prices/r/0.csv

curl -L https://datahub.io/core/gold-prices/r/1.zip

If you are using R here's how to get the data you want quickly loaded:

install.packages("jsonlite", repos="https://cran.rstudio.com/")
library("jsonlite")

json_file <- 'https://datahub.io/core/gold-prices/datapackage.json'
json_data <- fromJSON(paste(readLines(json_file), collapse=""))

# get list of all resources:
print(json_data$resources$name)

# print all tabular data(if exists any)
for(i in 1:length(json_data$resources$datahub$type)){
  if(json_data$resources$datahub$type[i]=='derived/csv'){
    path_to_file = json_data$resources$path[i]
    data <- read.csv(url(path_to_file))
    print(data)
  }
}

Note: You might need to run the script with root permissions if you are running on Linux machine

Install the Frictionless Data data package library and the pandas itself:

pip install datapackage
pip install pandas

Now you can use the datapackage in the Pandas:

import datapackage
import pandas as pd

data_url = 'https://datahub.io/core/gold-prices/datapackage.json'

# to load Data Package into storage
package = datapackage.Package(data_url)

# to load only tabular data
resources = package.resources
for resource in resources:
    if resource.tabular:
        data = pd.read_csv(resource.descriptor['path'])
        print (data)

For Python, first install the `datapackage` library (all the datasets on DataHub are Data Packages):

pip install datapackage

To get Data Package into your Python environment, run following code:

from datapackage import Package

package = Package('https://datahub.io/core/gold-prices/datapackage.json')

# print list of all resources:
print(package.resource_names)

# print processed tabular data (if exists any)
for resource in package.resources:
    if resource.descriptor['datahub']['type'] == 'derived/csv':
        print(resource.read())

If you are using JavaScript, please, follow instructions below:

Install data.js module using npm:

  $ npm install data.js

Once the package is installed, use the following code snippet:

const {Dataset} = require('data.js')

const path = 'https://datahub.io/core/gold-prices/datapackage.json'

// We're using self-invoking function here as we want to use async-await syntax:
;(async () => {
  const dataset = await Dataset.load(path)
  // get list of all resources:
  for (const id in dataset.resources) {
    console.log(dataset.resources[id]._descriptor.name)
  }
  // get all tabular data(if exists any)
  for (const id in dataset.resources) {
    if (dataset.resources[id]._descriptor.format === "csv") {
      const file = dataset.resources[id]
      // Get a raw stream
      const stream = await file.stream()
      // entire file as a buffer (be careful with large files!)
      const buffer = await file.buffer
      // print data
      stream.pipe(process.stdout)
    }
  }
})()
Datapackage.json