Server Endpoint
| Parameter | Value |
|---|
| Host | tcp-v1.benzinga.io |
| Port | 11337 |
| Protocol | TCP |
| TLS | Optional (disabled by default) |
Authentication
Connect using your username and API key:
bztcp -v -user YOUR_USERNAME -key YOUR_API_KEY
Command Line Options
| Option | Description |
|---|
-user | Your Benzinga TCP username |
-key | Your API access key |
-v | Enable verbose output |
Connection Flow
Connection States
Once connected, youโll see initialization messages:
Benzinga TCP Client initializing.
Connecting to 'tcp-v1.benzinga.io:11337' as user 'YOUR_USERNAME' (w/TLS: false)
Connected. Waiting for events.
After the connection is established, JSON messages begin streaming automatically.
TLS Configuration
By default, connections are made without TLS. To enable TLS encryption, use the appropriate flag provided by your client library.
Connection Best Practices
Keep your connection alive to receive continuous updates. Implement reconnection logic to handle network interruptions gracefully.
Recommended Practices
- Implement Reconnection Logic: Network interruptions can occur; implement exponential backoff for reconnection attempts
- Handle Disconnections: Monitor connection state and reconnect when needed
- Buffer Messages: Process messages asynchronously to avoid blocking the receive loop
- Log Connection Events: Track connection status for debugging and monitoring
Example Connection
conn, err := bztcp.Dial("tcp-v1.benzinga.io:11337", "USERNAME", "API_KEY")
if err != nil {
log.Fatal(err)
}
from bztcp.client import Client
client = Client(username='USERNAME', key='API_KEY')
Next Steps