trade29.sc.SCBridge.subscribe_to_chart_data#

SCBridge.subscribe_to_chart_data(key: str, sg_data: list[SubgraphQuery] = [], base_data: list[SCBaseData] = [], historical_init_bars: int = 0, realtime_update_bars: int = 1, on_bar_close: bool = False, update_frequency: int = -1, include_volume_by_price: bool = False, volume_by_price_include_empty_price_levels: bool = False) int#

Subscribes to constant updates on base or subgraph data from a chart

Subscribes to recieve updates on given subgraph (sg_data) and base (base_data) data from a chart. The returned request ID can be used to filter the bridge response queue to find the desired data.

Parameters:
keyint

A string key that matches the key given to the target Study in SierraChart.

sg_datalist of SubgraphQuery, default []

A list of studies’ subgraphs to get.

base_datalist of BaseData, default [constants.SCBaseData.SC_LAST]

A list of base SC data to get.

historical_init_barsint, default 0

Amount of historical bars to get along with current bar.

realtime_update_barsint, default 1

Amount of realtime bars to send to the response queue.

on_bar_closebool, default False

Whether to send live bar data, or wait for bar close to send data.

update_frequencyint, default -1

Frequency at which to send updates in milliseconds. Any value less than the chart update frequency will use the chart update frequency.

include_volume_by_pricebool, default False

Whether or not to include the volume by price data.

volume_by_price_include_empty_price_levelsbool, default False

Whether or not to include vbp entries for prices with no volume.

Returns:
int

A request ID that can be used to filter the bridge response queue for relevant data.

Examples

from trade29.sc import SCBridge, constants

bridge = SCBridge()

request_id = bridge.subscribe_to_chart_data('xx', base_data=[constants.SCBaseData.SC_LAST])

response_queue = bridge.get_response_queue()

while True:

    msg = response_queue.get()

    if msg.request_id == request_id:
        # do something
        pass