GitHub Repository
View source code and contribute
Features
- Tested with Go 1.13+
- High performance implementation
- No external dependencies
- Uses Goโs context library for cancellation
Installation
Install the library and example client:bztcp binary will be installed to $GOPATH/bin.
Quick Start
Test the client using the included binary:Command Line Options
| Option | Description |
|---|---|
-user | Your Benzinga TCP username |
-key | Your API access key |
-v | Enable verbose output |
Library Usage
Core Functions
The library exposes two primary functions:| Function | Description |
|---|---|
bztcp.Dial(addr, user, key) | Establish connection to the TCP server |
Conn.Stream(ctx, callback) | Start streaming messages with a callback |
Basic Example
Advanced Usage
Context-Based Cancellation
Use Goโs context for graceful shutdown:Processing Stream Data
TheStreamData struct contains the parsed message:
Error Handling
Complete Example
Requirements
- Go 1.13 or later (uses context library, requires Go 1.8+)
- Network access to
tcp-v1.benzinga.io:11337
See Also
- Connection Guide - Server details and authentication
- Message Format - JSON structure reference
- Python Client - Alternative Python implementation