Chart API
getChartThe 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.
TSLA,MSFTtypeoptional
The type of chart, includes: bar chart ("BAR"), candlestick ("CANDLE"), area ("AREA") or line ("LINE") chart.
LINEwidthoptional
The width of chart in pixels.
700heightoptional
The height of the chart, in pixels, with no indicators in pixels.
550volumeoptional
An option to display the volume indicator on the chart.
falseperiodoptional
The period to display the chart.
1dintervaloptional
Period type: DO (Daily Contract), DN (Daily Nearest), WO (Weekly Contract), WN (Weekly Nearest), MO (Monthly Contract), MN (Monthly Nearest).
DOindicatorsoptional
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)
gradientTopoptional
The HTML color code without the preceding hashtag for the AREA chart.
gradientBottomoptional
The HTML color code without the preceding hashtag for the AREA chart.
bgColoroptional
The HTML color code without the preceding hashtag for chart background color.
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=TSLA%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=TSLA%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": "TSLA",
"imageURL": "\/\/ondemand.websol.barchart.com\/chart.png?symbol=TSLA&barType=LINE&time=1d&width=700&height=550&volume=0&bgColor=1728053247&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1765404000&endDate=1765562399&ondemandkey=ondemand"
},
{
"symbol": "MSFT",
"imageURL": "\/\/ondemand.websol.barchart.com\/chart.png?symbol=MSFT&barType=LINE&time=1d&width=700&height=550&volume=0&bgColor=1728053247&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1765404900&endDate=1765562399&ondemandkey=ondemand"
}
]
}
GET
GET https://ondemand.websol.barchart.com/getChart.xml?apikey=YOUR_API_KEY&symbols=TSLA%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=TSLA%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>TSLA</symbol>
<imageURL>//ondemand.websol.barchart.com/chart.png?symbol=TSLA&barType=LINE&time=1d&width=700&height=550&volume=0&bgColor=1728053247&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1765404000&endDate=1765562399&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&bgColor=1728053247&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1765404900&endDate=1765562399&ondemandkey=ondemand</imageURL>
</item>
</getChart>
GET
GET https://ondemand.websol.barchart.com/getChart.csv?apikey=YOUR_API_KEY&symbols=TSLA%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=TSLA%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
"TSLA","//ondemand.websol.barchart.com/chart.png?symbol=TSLA&barType=LINE&time=1d&width=700&height=550&volume=0&bgColor=1728053247&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1765404000&endDate=1765562399&ondemandkey=ondemand"
"MSFT","//ondemand.websol.barchart.com/chart.png?symbol=MSFT&barType=LINE&time=1d&width=700&height=550&volume=0&bgColor=1728053247&indicators=BBANDS%2820%2C2%29%3BMACD%2812%2C26%2C9%29&period=DO&startDate=1765404900&endDate=1765562399&ondemandkey=ondemand"
<?php
$ondemand = new SoapClient('https://ondemand.websol.barchart.com/service?wsdl');
$params = [
'apikey' => 'YOUR_API_KEY',
'symbols' => 'TSLA,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", "TSLA,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', 'TSLA,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', 'TSLA,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: 'TSLA,MSFT',
type: 'LINE',
width: '700',
height: '550',
volume: 'false',
period: '1d',
interval: 'DO',
indicators: 'BBANDS(20,2);MACD(12,26,9)',
}
)
response.body