trade29.sc.SCBridge.post_data_to_subgraph#

SCBridge.post_data_to_subgraph(key: str, subgraph_id: int, index_type: IndexType, data: dict[int | datetime, float]) None#

Sends data to a subgraph of an SC-dX study with a key.

Given a key and a subgraph ID, this method will propulate the subgraph with the given ID belonging to the study with the given key.

Parameters:
keystr

The key of the SC-dX study who’s subgraph to populate.

subgraph_idint

The ID of the subgraph to send data to. This must be an existing subgraph on the target SC-dX study. By default the SC-dX will create 60 subgraphs so that IDs 1-60 are all valid.

index_typeconstants.IndexType

The type of index to use.

datadict[int | datetime, float]

A dictionary mapping subgraph values to indices.

Returns:
None

Examples

>>> from trade29.sc import constants, SCBridge
>>> import datetime
>>> bridge = SCBridge()
running bridge v0.17.0--------2024/08/13 18:16:18
connecting to sc
starting receiver
starting sender
sc version: 2666, scdx version 208, connection: t29scdx2, keys: xx
>>> bridge.post_data_to_subgraph(key="xx", subgraph_id = 1, index_type = constants.IndexType.BARS_AGO, data = {1: 2470, 2: 2460}) 
>>> bridge.post_data_to_subgraph(key="xx", subgraph_id = 2, index_type = constants.IndexType.DATE_TIME, data = {datetime.datetime.now(): 2470})