Chart API
getChart
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.
View All APIssymbolsrequired
A symbol or code that identifies a financial instrument.
YHOO,MSFT
typeoptional
The type of chart, includes: bar chart ("BAR"), candlestick ("CANDLE"), area ("AREA") or line ("LINE") chart.
LINE
widthoptional
The width of chart in pixels.
700
heightoptional
The height of the chart, in pixels, with no indicators in pixels.
550
volumeoptional
An option to display the volume indicator on the chart.
false
periodoptional
The period to display the chart.
1d
intervaloptional
Period type: DO (Daily Contract), DN (Daily Nearest), WO (Weekly Contract), WN (Weekly Nearest), MO (Monthly Contract), MN (Monthly Nearest).
DO
indicatorsoptional
A semi-colon delimited list of indicators.
BBANDS(20,2);MACD(12,26,9)
frequencyTypeoptional
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)
always returned
A sequence of characters. (example: GOOG)
always returned
A sequence of characters. (example: GOOG)
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=1734674400&endDate=1734717599&ondemandkey=ondemand"
}
]
}
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=1734674400&endDate=1734717599&ondemandkey=ondemand</imageURL>
</item>
</getChart>
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=1734674400&endDate=1734717599&ondemandkey=ondemand"
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'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);
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("YOUR_API_KEY", "YHOO,MSFT", "LINE", "700", "550", "false", "1d", "DO", "BBANDS(20,2);MACD(12,26,9)")
use SOAP::Lite;
use SOAP::WSDL;
my $ondemand = SOAP::Lite
-> service('https://ondemand.websol.barchart.com/service?wsdl');
my $result = $ondemand->getChart('YOUR_API_KEY', 'YHOO,MSFT', 'LINE', '700', '550', 'false', '1d', 'DO', 'BBANDS(20,2);MACD(12,26,9)');
print $result;
from suds.client import Client
ondemand = Client('https://ondemand.websol.barchart.com/service?wsdl')
result = ondemand.service.getChart('YOUR_API_KEY', 'YHOO,MSFT', 'LINE', '700', '550', 'false', '1d', 'DO', 'BBANDS(20,2);MACD(12,26,9)')
print(result)
require 'savon'
ondemand = Savon.client(wsdl: 'https://ondemand.websol.barchart.com/service?wsdl')
response = ondemand.call(
:getChart,
message: {
apikey: 'YOUR_API_KEY',
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