https://github.com/ivanzzeth/opinion-go-clob-client
CLOB client for opinion.trade written in Go
https://github.com/ivanzzeth/opinion-go-clob-client
Last synced: about 1 month ago
JSON representation
CLOB client for opinion.trade written in Go
- Host: GitHub
- URL: https://github.com/ivanzzeth/opinion-go-clob-client
- Owner: ivanzzeth
- License: mit
- Created: 2025-12-12T17:14:45.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2026-03-06T07:54:15.000Z (5 months ago)
- Last Synced: 2026-05-31T14:05:46.422Z (about 2 months ago)
- Language: Go
- Size: 295 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Opinion CLOB Go Client
Go client library for interacting with the Opinion CLOB (Central Limit Order Book) API.
## Features
- Market operations (list markets, get market details)
- Token operations (get orderbook, latest price)
- User operations (get balances, positions, orders, trades)
- Order operations (place orders, cancel orders, batch operations)
- Quote token management
## Installation
```bash
go get github.com/ivanzzeth/opinion-go-clob-client
```
## Quick Start
1. Get your API key from Opinion platform
2. Configure your environment (see Examples section below)
3. Start using the client in your Go application
## Examples
This library includes comprehensive examples demonstrating all available functionality. **All examples should be run from the project root directory.**
For detailed usage instructions and example code, please see the [examples directory](./examples/README.md). The examples cover:
- **Market operations**: Listing markets, getting market details
- **Token operations**: Getting orderbooks and latest prices
- **User operations**: Querying balances, positions, orders, and trade history
- **Order operations**: Placing and canceling orders
Each example is a complete, runnable program that demonstrates how to use specific API endpoints. They serve as both documentation and starting points for your own implementations.
## Configuration
Examples require a `.env` file in the project root directory. Copy `.env.example` to `.env` and fill in your credentials:
- `API_KEY`: Your Opinion API key (required for all operations)
- `PRIVATE_KEY`: Your private key (required for trading operations)
- `MULTI_SIG_ADDRESS`: Your multi-sig wallet address (required for trading operations)
- `RPC_URL`: RPC endpoint URL (required for trading operations)
- `CHAIN_ID`: Chain ID (defaults to 56 for BNB Chain)
## Running Examples
**Important**: All examples must be run from the **project root directory**. They automatically load the `.env` file from the project root.
Navigate to the project root directory, then run any example:
```bash
# From project root directory
go run examples/market/list/main.go
go run examples/user/balance/main.go
go run examples/order/place/main.go
```
See the [examples README](./examples/README.md) for complete usage instructions for each example.
## Signer Configuration
The client uses a signer-based architecture for order operations. You need to provide a signer when creating the client:
- Use `WithSigner()` option to provide a signer, funder address, and signature type
- The signer is used for EIP-712 signing of orders
- See the examples for how to create a signer from a private key
## API Documentation
For detailed API documentation, refer to the Opinion API documentation. This client library provides Go bindings for the Opinion CLOB API endpoints.
## License
See [LICENSE](LICENSE) file for details.