getClosePrice API

Get the close price for given instruments for the given date.

All APIs

Contact Us to Get Access

Inputs

symbols required

A symbol or code that identifies a financial instrument. Multiple symbols separated by a comma may be used.

Type
list (A comma or semi-colon delimited string.) 
Example
IBM,AAPL,GOOG 

date optional

The date of the historical data query. The value should conform to the format yyyymmdd.

Type
date (A date in the format of YYYY-MM-DD.) 
Example
2010-01-01 

splits optional

An adjustment of stock value due to corporate action. This parameter only applies to stocks and specifies whether the data returned should be adjusted for splits or not. Set to true to query for adjusted the data, or to false for non-adjusted data.

Type
boolean (A logical type representing the truth of a value as 'true' or 'false'.) 
Example
true 
Default

dividends optional

A distribution of a portion of a company's earnings. This parameter only applies to stocks and specifies whether the data returned should be adjusted for dividends or not. Set to true to query for adjusted the data, or to false for non-adjusted data.

Type
boolean (A logical type representing the truth of a value as 'true' or 'false'.) 
Example
true 
Default

Outputs

Name / Requirement
Description
Type
symbol
always returned
The symbol or code that identifies a financial instrument
string
A sequence of characters. (example: GOOG)
closePrice
always returned
The last price the instrument traded.
double
A numeric type defining a number with fractional parts. (example: 2.14)
date
always returned
The date of the price.
date
A date in the format of YYYY-MM-DD.

Status Code Responses

200
OK
Success
400
Bad Request
The request was invalid, please see the message for more information.
500
Internal Server Error
Something is not working correctly, please contact support.


JSON

GET

GET https://ondemand.websol.barchart.com/getClosePrice.json?apikey=<YOUR API KEY>&symbols=IBM%2CAAPL%2CGOOG&date=2010-01-01&splits=true&dividends=true
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getClosePrice.json
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&symbols=IBM%2CAAPL%2CGOOG&date=2010-01-01&splits=true&dividends=true

Response

{
    "status": {
        "code": 200,
        "message": "Success."
    },
    "results": [
        {
            "symbol": "IBM",
            "closePrice": 106.8284,
            "date": "2009-12-31"
        },
        {
            "symbol": "AAPL",
            "closePrice": 26.98648,
            "date": "2009-12-31"
        }
    ]
}

XML

GET

GET https://ondemand.websol.barchart.com/getClosePrice.xml?apikey=<YOUR API KEY>&symbols=IBM%2CAAPL%2CGOOG&date=2010-01-01&splits=true&dividends=true
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getClosePrice.xml
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&symbols=IBM%2CAAPL%2CGOOG&date=2010-01-01&splits=true&dividends=true

Response


<?xml version="1.0" encoding="utf-8"?>
 <getClosePrice>
  <status>
   <code>200</code>
   <message>Success.</message>
  </status>
  <item>
   <symbol>IBM</symbol>
   <closePrice>106.8284</closePrice>
   <date>2009-12-31</date>
  </item>
  <item>
   <symbol>AAPL</symbol>
   <closePrice>26.98648</closePrice>
   <date>2009-12-31</date>
  </item>
 </getClosePrice>

CSV

GET

GET https://ondemand.websol.barchart.com/getClosePrice.csv?apikey=<YOUR API KEY>&symbols=IBM%2CAAPL%2CGOOG&date=2010-01-01&splits=true&dividends=true
Host: ondemand.websol.barchart.com

POST

POST https://ondemand.websol.barchart.com/getClosePrice.csv
Host: ondemand.websol.barchart.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

apikey=<YOUR API KEY>&symbols=IBM%2CAAPL%2CGOOG&date=2010-01-01&splits=true&dividends=true

Response

symbol,closePrice,date
"IBM","106.8284","2009-12-31"
"AAPL","26.98648","2009-12-31"


PHP

<?php

$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');

$params = [
    'symbols' => 'IBM,AAPL,GOOG',
    'date' => '2010-01-01',
    'splits' => 'true',
    'dividends' => 'true',
];

$result = $ondemand->getClosePrice($params);
var_dump($result);

Classic ASP

Dim ondemand
Dim result

Set ondemand = Server.CreateObject("MSSOAP.SoapClient30")
ondemand.ClientProperty("ServerHTTPRequest") = True
ondemand.MSSoapInit("https://ondemand.websol.barchart.com/service?wsdl")

Set result = ondemand.getClosePrice("IBM,AAPL,GOOG", "2010-01-01", "true", "true")

Perl

use SOAP::Lite;
use SOAP::WSDL;

my $ondemand = SOAP::Lite
    -> service('https://ondemand.websol.barchart.com/service?wsdl');

my $result = $ondemand->getClosePrice('IBM,AAPL,GOOG', '2010-01-01', 'true', 'true');

print $result;

Python

from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')

result = client.service.getClosePrice('IBM,AAPL,GOOG', '2010-01-01', 'true', 'true')

print result

Ruby

require 'savon'

ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')

response = ondemand.call(
    :getClosePrice,
    message: {
        symbols: 'IBM,AAPL,GOOG',
        date: '2010-01-01',
        splits: 'true',
        dividends: 'true',
    }
)

response.body