### Generate Protobuf Files with Protoc (Shell) Source: https://github.com/tigerfintech/openapi-python-sdk/blob/master/tigeropen/push/pb/readme.md This command generates Python protobuf files (.py) and type stubs (.pyi) from .proto definition files located in the specified directory. It requires the protobuf compiler (protoc) to be installed and accessible in the system's PATH. ```shell cd openapi-python-sdk protoc --proto_path=. --python_out=. --pyi_out=. tigeropen/push/pb/*.proto ``` -------------------------------- ### Tiger Fintech Push Client Connection and Subscription Source: https://github.com/tigerfintech/openapi-python-sdk/blob/master/README.md This snippet demonstrates how to configure the Tiger Fintech client, establish a connection to the push client, set up callbacks for quote changes and subscribed symbols, and subscribe to real-time market data and asset updates. It includes connecting, querying, subscribing, and disconnecting the push client. ```python from tigeropen.common.consts import Language from tigeropen.push.push_client import PushClient # Assuming client_config is already initialized and configured # Example configuration (replace with your actual values): class MockClientConfig: def __init__(self): self.tiger_id = 'your tiger id' self.account = 'your account' self.language = Language.en_US self.private_key = 'your_private_key' self.socket_host_port = ('ssl', 'api.itiger.com', 443) # Example values client_config = MockClientConfig() # Define callback functions (placeholders) def on_quote_changed(quote_data): print("Quote changed:", quote_data) def on_query_subscribed_quote(subscribed_data): print("Subscribed quotes:", subscribed_data) # Get host and port from client configuration protocol, host, port = client_config.socket_host_port # Initialize PushClient push_client = PushClient(host, port, use_ssl=(protocol == 'ssl')) # Assign callback functions push_client.quote_changed = on_quote_changed push_client.subscribed_symbols = on_query_subscribed_quote # Connect to the push service try: push_client.connect(client_config.tiger_id, client_config.private_key) print("Connected to push service.") # Query subscribed quotes (example) push_client.query_subscribed_quote() # Subscribe to specific quotes push_client.subscribe_quote(['AAPL', 'GOOG']) print("Subscribed to AAPL and GOOG quotes.") # Subscribe to asset updates push_client.subscribe_asset() print("Subscribed to asset updates.") # Keep the connection alive for a duration (e.g., 10 minutes) import time print("Keeping connection alive for 600 seconds...") time.sleep(600) except Exception as e: print(f"An error occurred: {e}") finally: # Disconnect from the push service push_client.disconnect() print("Disconnected from push service.") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.