Skip to Content
GuidesConfiguration

πŸ”§ Configuration Guide

Complete reference for configuring the GoCharting SDK to meet your application’s needs.

πŸš€ Basic Configuration

Required Parameters

const chart = GoChartingSDK.createChart("#chart-container", { // Required parameters datafeed: myDatafeed, // Your data provider symbol: "NASDAQ:AAPL", // Initial symbol interval: "1D", // Initial interval licenseKey: "YOUR_KEY", // Your license key });

Optional Parameters

ParameterTypeDefaultDescription
themestringlightChart theme (β€˜light’ or β€˜dark’)
autosizebooleantrueEnable automatic sizing
widthnumber | string100%Chart width (overridden by autosize)
heightnumber | string100%Chart height (overridden by autosize)
autoSavebooleantrueAuto-save chart state to sessionStorage for refresh persistence
onReadyfunctionnullCallback when chart is ready
onErrorfunctionnullCallback for errors

πŸ“ˆ Trading Configuration

Enable Trading Features

The trading.enableTrading parameter controls whether trading functionality is available in the chart:

const chart = GoChartingSDK.createChart("#chart-container", { symbol: "BYBIT:FUTURE:BTCUSDT", interval: "1m", datafeed: myDatafeed, licenseKey: "YOUR_LICENSE_KEY", trading: { enableTrading: true, // 🎯 Enable trading features }, appCallback: handleTradingEvents, });

Trading Features Enabled

When trading.enableTrading: true, the following features become available:

Context Menu Trading

  • Right-click on chart β†’ Buy/Sell options appear
  • Hover over price levels β†’ Trading options in CrossHair menu

Settings Panel

  • Settings > Trading tab β†’ Trading configuration options
  • Configure order display, notifications, and defaults

Event Callbacks

  • Trading events β†’ Handled through appCallback parameter
  • Order placement, cancellation, and modification events

Trading Event Handler

function handleTradingEvents(eventType, eventData) { switch (eventType) { case "PLACE_ORDER": console.log("Place order:", eventData); // { symbol, side, quantity, price, orderType } break; case "CANCEL_ORDER": console.log("Cancel order:", eventData); // { orderId, symbol } break; case "MODIFY_ORDER": console.log("Modify order:", eventData); // { orderId, quantity, price } break; } }

🎨 Theme Configuration

Light Theme (Default)

const chart = GoChartingSDK.createChart("#chart-container", { // ... other config theme: "light", });

Dark Theme

const chart = GoChartingSDK.createChart("#chart-container", { // ... other config theme: "dark", });

πŸ“ Sizing Configuration

const chart = GoChartingSDK.createChart("#chart-container", { // ... other config autosize: true, // Default - automatically fits container });

Fixed Dimensions

const chart = GoChartingSDK.createChart("#chart-container", { // ... other config autosize: false, width: 800, height: 600, });

πŸ”„ Event Handling

Chart Ready Callback

const chart = GoChartingSDK.createChart("#chart-container", { // ... other config onReady: (chartInstance) => { console.log("Chart is ready!", chartInstance); // Chart is fully loaded and interactive }, });

Error Handling

const chart = GoChartingSDK.createChart("#chart-container", { // ... other config onError: (error) => { console.error("Chart error:", error); // Handle chart initialization errors }, });
Last updated on