getChart API

The getChart API is used to request a custom chart image with variables such as chart type, size, period and technical indicators, based on a symbol.

All APIs

Contact Us to Get Access

Inputs

symbols required

A symbol or code that identifies a financial instrument.

Type
list (A comma or semi-colon delimited string.) 
Example
YHOO,MSFT 

type optional

The type of chart, includes: bar chart ("BAR"), candlestick ("CANDLE"), area ("AREA") or line ("LINE") chart.

Type
enum (A type which includes a list of valid possible values.) 
Example
LINE 
Default
BAR 

Valid Values:
BAR, LINE, CANDLE, AREA

width optional

The width of chart in pixels.

Type
int (A numeric type defining a whole number. (example: 2)) 
Example
700 
Default
700 

height optional

The height of the chart, in pixels, with no indicators in pixels.

Type
int (A numeric type defining a whole number. (example: 2)) 
Example
550 
Default
550 

volume optional

An option to display the volume indicator on the chart.

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

period optional

The period to display the chart.

Type
enum (A type which includes a list of valid possible values.) 
Example
1d 
Default
6m 

Valid Values:
1d, 5d, 3d, 10d, 1m, 3m, 6m, 1y, 2y, 3y, 5y, 10y, 15y, 20y, 25y, ytd

interval optional

Type
enum (A type which includes a list of valid possible values.) 
Example
DO 

Valid Values:
DO, DN, WO, WN, MO, MN

indicators optional

A semi-colon delimited list of indicators.

Type
list (A comma or semi-colon delimited string.) 
Example
BBANDS(20,2);MACD(12,26,9) 

frequencyType optional

Frequency type: DO (Daily Contract), DN (Daily Nearest), DC (Daily Continuation), WO (Weekly Contract), WN (Weekly Nearest), WC (Weekly Continuation), MO (Monthly Contract), MN (Monthly Nearest), MC (Monthly Continuation)

Type
string (A sequence of characters. (example: GOOG)) 

Outputs

Name / Requirement
Description
Type
symbol
always returned
A symbol or code that identifies a financial instrument.
string
A sequence of characters. (example: GOOG)
imageURL
always returned
The URL for the chart image.
string
A sequence of characters. (example: GOOG)

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/getChart.json?apikey=<YOUR API KEY>&symbols=YHOO%2CMSFT&type=LINE&width=700&height=550&volume=false&period=1d&interval=DO&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29
Host: ondemand.websol.barchart.com

POST

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

apikey=<YOUR API KEY>&symbols=YHOO%2CMSFT&type=LINE&width=700&height=550&volume=false&period=1d&interval=DO&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29

Response

{
    "status": {
        "code": 200,
        "message": "Success."
    },
    "results": [
        {
            "symbol": "YHOO",
            "imageURL": "\/\/ondemand.websol.barchart.com\/chart.png?symbol=YHOO&barType=LINE&time=1d&width=700&height=550&volume=0&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1499058000&endDate=1499101199&ondemandkey=ondemand"
        },
        {
            "symbol": "MSFT",
            "imageURL": "\/\/ondemand.websol.barchart.com\/chart.png?symbol=MSFT&barType=LINE&time=1d&width=700&height=550&volume=0&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1511244000&endDate=1511287199&ondemandkey=ondemand"
        }
    ]
}

XML

GET

GET https://ondemand.websol.barchart.com/getChart.xml?apikey=<YOUR API KEY>&symbols=YHOO%2CMSFT&type=LINE&width=700&height=550&volume=false&period=1d&interval=DO&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29
Host: ondemand.websol.barchart.com

POST

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

apikey=<YOUR API KEY>&symbols=YHOO%2CMSFT&type=LINE&width=700&height=550&volume=false&period=1d&interval=DO&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29

Response


<?xml version="1.0" encoding="utf-8"?>
 <getChart>
  <status>
   <code>200</code>
   <message>Success.</message>
  </status>
  <item>
   <symbol>YHOO</symbol>
   <imageURL>//ondemand.websol.barchart.com/chart.png?symbol=YHOO&barType=LINE&time=1d&width=700&height=550&volume=0&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1499058000&endDate=1499101199&ondemandkey=ondemand</imageURL>
  </item>
  <item>
   <symbol>MSFT</symbol>
   <imageURL>//ondemand.websol.barchart.com/chart.png?symbol=MSFT&barType=LINE&time=1d&width=700&height=550&volume=0&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1511244000&endDate=1511287199&ondemandkey=ondemand</imageURL>
  </item>
 </getChart>

CSV

GET

GET https://ondemand.websol.barchart.com/getChart.csv?apikey=<YOUR API KEY>&symbols=YHOO%2CMSFT&type=LINE&width=700&height=550&volume=false&period=1d&interval=DO&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29
Host: ondemand.websol.barchart.com

POST

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

apikey=<YOUR API KEY>&symbols=YHOO%2CMSFT&type=LINE&width=700&height=550&volume=false&period=1d&interval=DO&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29

Response

symbol,imageURL
"YHOO","//ondemand.websol.barchart.com/chart.png?symbol=YHOO&barType=LINE&time=1d&width=700&height=550&volume=0&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1499058000&endDate=1499101199&ondemandkey=ondemand"
"MSFT","//ondemand.websol.barchart.com/chart.png?symbol=MSFT&barType=LINE&time=1d&width=700&height=550&volume=0&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1511244000&endDate=1511287199&ondemandkey=ondemand"


PHP

<?php

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

$params = [
    'symbols' => 'YHOO,MSFT',
    'type' => 'LINE',
    'width' => '700',
    'height' => '550',
    'volume' => 'false',
    'period' => '1d',
    'interval' => 'DO',
    'indicators' => 'BBANDS(20,2);MACD(12,26,9)',
];

$result = $ondemand->getChart($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.getChart("YHOO,MSFT", "LINE", "700", "550", "false", "1d", "DO", "BBANDS(20,2);MACD(12,26,9)")

Perl

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

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

my $result = $ondemand->getChart('YHOO,MSFT', 'LINE', '700', '550', 'false', '1d', 'DO', 'BBANDS(20,2);MACD(12,26,9)');

print $result;

Python

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

result = client.service.getChart('YHOO,MSFT', 'LINE', '700', '550', 'false', '1d', 'DO', 'BBANDS(20,2);MACD(12,26,9)')

print result

Ruby

require 'savon'

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

response = ondemand.call(
    :getChart,
    message: {
        symbols: 'YHOO,MSFT',
        type: 'LINE',
        width: '700',
        height: '550',
        volume: 'false',
        period: '1d',
        interval: 'DO',
        indicators: 'BBANDS(20,2);MACD(12,26,9)',
    }
)

response.body