This toy client demonstrates how API Quant users connect to Gexbot real-time sockets:
- Build the unprefixed websocket groups you want, e.g.
ES_SPX_classic_gex_full. POST /v2/negotiatewith{"groups": [...]}.- Open the returned Azure Web PubSub URLs. The negotiated token already includes the requested groups, so the client does not call
join_group.
.
├── proto/ # Source .proto definitions (e.g., gex.proto)
├── generated_proto/ # Compiled _pb2.py files
├── main.py # Main client script
├── decompression_utils.py # Decompression helper functions
├── requirements.txt # Python dependencies
├── .gitignore
└── README.md
-
Clone Repository Clone this repository to your local machine.
-
Create Virtual Environment It's highly recommended to use a virtual environment.
python3 -m venv venv source venv/bin/activate -
Install Dependencies
pip install -r requirements.txt
This client reads data from Protobuf messages. Compile the source .proto files in proto/ into Python modules.
mkdir -p generated_proto
touch generated_proto/__init__.py
python3 -m grpc_tools.protoc -I=proto --python_out=generated_proto --pyi_out=generated_proto proto/*.protoSet the required environment variables:
export GEXBOT_API_KEY="your_api_key_here"
export GEXBOT_USER_AGENT="YourClientApp/1.0"Then open main.py and edit the USER SELECTION section:
ACTIVE_TICKERSACTIVE_CLASSIC_CATEGORIESACTIVE_STATE_GEX_CATEGORIESACTIVE_STATE_GREEKS_ZERO_CATEGORIESACTIVE_STATE_GREEKS_ONE_CATEGORIESACTIVE_ORDERFLOW_CATEGORIES
Groups sent to negotiate are as follows:
{ticker}_{package}_{category}
Examples:
SPX_classic_gex_full
ES_SPX_state_gamma_zero
SPX_orderflow_orderflow
python main.py