trade29.sc.SCBridge.subscribe_to_tpo_profile#
- SCBridge.subscribe_to_tpo_profile(key: str, study_id: int, number_historical_profiles: int = -1, number_update_profiles: int = -1, update_frequency=-1, include_live_profile: bool = False, include_profile: bool = False, include_peak_valley: bool = False) int #
Subscribes to constant updates on TPO Profile data.
For this method to work, the Sierra Chart ‘TPO Profile Chart’ study needs to be added to the chart.
- Parameters:
- keystr
A string key that matches the key given to the target Study in SierraChart.
- study_idint
ID of the TPO study.
- number_historical_profilesint, default -1
Number of historical profiles to fetch on the first update. If this is -1 then all available profiles will be returned.
- number_update_profilesint, default -1
Number of profiles to fetch on each update. If this is -1 then all available profiles will be returned.
- update_frequencyint, default -1
The minimum interval between updates. If -1 the update frequency is based on the SC update interval settings
- include_live_profilebool, default False
Whether or not to include the profile for the live bar. If this is False, an update will be sent when the bar is closed
- include_profilebool, default False
Whether or not to include detailed profile data (the histogram that is seen in Sierra Chart).
- include_peak_valleybool, default False
Whether or not to include peak valley data. ‘Draw Peaks & Valleys needs to be enabled in study settings. Peaks are 1 and valleys are 2.
- Returns:
- int
A request ID that can be used to filter the bridge response queue for relevant data.
Examples
>>> from trade29.sc import SCBridge >>> bridge = SCBridge() running bridge v0.17.0--------2024/08/06 19:45:48 connecting to sc starting receiver starting sender sc version: 2666, scdx version 208, connection: t29scdx2, keys: xx >>> id = bridge.subscribe_to_tpo_profile(key="xx", study_id=2) >>> response_queue = bridge.get_response_queue() >>> ret = response_queue.get() >>> df = ret.as_df() >>> # by default the request does not include detailed TPO profile data. See the documentation for for get_tpo_profile for examples of parsing detailed data.