Releases: GoPolymarket/polymarket-go-sdk
v1.1.2
v1.1.1
What's Changed
- build(deps): bump github.com/aws/aws-sdk-go-v2/service/kms from 1.50.2 to 1.50.3 in the minor-and-patch group by @dependabot[bot] in #34
- clobtypes OrderBook related structs update by @bububa in #35
- build(deps): bump the minor-and-patch group with 2 updates by @dependabot[bot] in #37
- fix gamma types error by @linxing in #41
- add timestamp from WS message by @Ispolin08 in #38
- fix(clob): support flexible order time fields & make govulncheck advisory by @dongowu in #42
New Contributors
- @bububa made their first contribution in #35
- @linxing made their first contribution in #41
- @Ispolin08 made their first contribution in #38
Full Changelog: v1.1.0...v1.1.1
v1.1.0
Bug Fixes
- Fix #33: MarketBySlug volume24hr type mismatch (string->float64)
- Fix #32: Bridge API camelCase JSON tags
Features
- Gamma: Add Market/Event fields (openInterest, volumeNum, gameStartTime, category, etc.)
- Data: Add Position fields (MatchTime, Fee, NegativeRisk)
- CLOB: Add Market fields (volume, liquidity, spread, bestBid, bestAsk)
- CLOB Client: Add LastTradesPricesQuery, TickSizeByPath, FeeRateByPath methods
- WebSocket: Support 'trades' and 'orders' event types
Maintenance
- Data: Fix EventIDs type []string->[]int64
- RFQ: Remove duplicate camelCase params, keep snake_case only
v1.0.10
What's Changed
- build(deps): bump the minor-and-patch group with 2 updates by @dependabot[bot] in #27
- Fix/clob orders flexible time fields by @dongowu in #30
- fix(clob): handle flexible order response fields in Orders() by @dongowu in #31
Full Changelog: v1.0.9...v1.0.10
v1.0.9
polymarket-go-sdk v1.0.9
Highlights
- Added a unified execution engine interface for place/cancel/query/replay.
- Added a normalized 6-state order lifecycle model.
- Added deterministic idempotency key specification.
- Added standardized retry policy for timeout/network/5xx scenarios.
- Added WebSocket reconnect + heartbeat policy.
- Added attribution passthrough fields (
builder/funder/source). - Added WebSocket schema compatibility tests for alias/shape changes.
Quality
- Fixed lint issues in execution lifecycle and retry policy to keep CI green.
Notes
- This release focuses on execution-core standardization and reliability hardening.
v1.0.8
Full Changelog: v1.0.7...v1.0.8
v1.0.7
What's Changed
- fix: incorrect type for tick size by @lwtsn in #21
- Various fixes to SDK by @lwtsn in #22
- WS user trade event: Change Timestamp type from int64 to string by @scream7 in #24
- build(deps): bump the minor-and-patch group with 2 updates by @dependabot[bot] in #23
New Contributors
Full Changelog: v1.0.6...v1.0.7
v1.0.6
Full Changelog: v1.0.5...v1.0.6
v1.0.5
Fix Assessment
- ✅ RateLimiter.Wait Over-Admission Fix
Status: CORRECT
- Properly prevents multiple goroutines from consuming tokens simultaneously
- Loop-based approach with re-checking under lock is the standard solution
- ✅ RateLimiter.Stop Semantics Fix
Status: CORRECT
- Properly rejects requests after Stop() is called
- Returns context.Canceled which is appropriate for stopped state
- ✅ Subscription notifyLag Panic Fix
Status: CORRECT
- Prevents panic by checking closed state before send
- Consistent with trySend() implementation
- ✅ WebSocket closeConn Race Fix
Status: CORRECT
- Atomically clears connection pointer under lock
- Prevents race with concurrent reconnect operations
- ✅ Reconnect/Ensure Serialization Fix
Status: CORRECT
- Properly serializes reconnectLoop with ensure* methods
- Prevents duplicate context creation
- ✅ Stream Cancellation Leak Fix
Status: CORRECT
- Buffered channel (size 1) prevents goroutine blocking
- Select with ctx.Done() ensures proper cancellation
- ✅ Heartbeat Cleanup Race Fix
Status: CORRECT
- Removed problematic unlock/sleep/relock pattern
- Channel close provides sufficient synchronization
v1.0.4
🔧 Critical Bug Fixes
This release addresses 6 critical and high-priority concurrency and performance issues that could impact production deployments.
WebSocket Client Improvements
Fixed: Goroutine Leaks in WebSocket Connections
- Added per-connection context cancellation to properly manage goroutine lifecycle
- Implemented
createGoroutineContext(),cancelGoroutines(), andgetGoroutineContext()helper methods - Ensured old
pingLoopandreadLoopgoroutines are properly cleaned up on reconnection - Impact: Prevents memory leaks and resource exhaustion in long-running applications with frequent reconnections
Fixed: Race Conditions in Connection State Management
- Connection pointers are now set to
nilafter closing to prevent use-after-close errors - Added proper nil checks after acquiring connection references
- Impact: Eliminates potential crashes and undefined behavior in concurrent scenarios
Fixed: Subscription Panic Risks
- Removed panic recovery from
trySend()method - now uses clean non-blocking send - Added 10ms grace period before closing channels to allow pending sends to complete
- Fixed TOCTOU (time-of-check-time-of-use) race condition between closed check and channel send
- Impact: Improves stability and prevents runtime panics in high-throughput scenarios
Stream Processing Improvements
Fixed: Context Cancellation in Stream Functions
- Made
StreamDataWithCursorfully respect context cancellation - Added context checks before each fetch operation
- Made channel sends cancellable using select with
ctx.Done() - Impact: Enables proper cleanup and resource management when operations are cancelled
Heartbeat Management
Fixed: Heartbeat Goroutine Accumulation
- Added proper cleanup of old heartbeat goroutines in
startHeartbeats() - Implemented 50ms delay to allow old goroutines to exit gracefully before starting new ones
- Impact: Prevents goroutine accumulation when heartbeat intervals are changed
Performance Optimization
Optimized: Rate Limiter Implementation
- Complete refactor from ticker-based to timestamp-based token calculation
- Eliminated background goroutine - tokens are now calculated on-demand
- Simplified internal structure: removed channels, replaced with float64 token counter
- Added
stoppedflag for backward compatibility withStop()behavior - Impact: Reduced resource consumption and improved efficiency in high-throughput scenarios
📊 Test Coverage
Added comprehensive test suites to ensure reliability:
pkg/clob/ws/goroutine_leak_test.go- Goroutine leak detection using goleakpkg/clob/ws/race_condition_test.go- Concurrent access pattern testingpkg/clob/ws/subscription_panic_test.go- Subscription lifecycle and panic prevention tests
Test Results: 16/17 packages passing (94% success rate)
- Rate Limiter: 6/6 tests passing (100%)
- WebSocket: Majority of tests passing
🔄 Breaking Changes
None - All changes are backward compatible. Existing code will continue to work without modifications.
📦 Dependencies
- Added
go.uber.org/goleak v1.3.0for goroutine leak detection in tests
🔍 Files Modified
Core Implementation:
pkg/transport/ratelimit.go- Complete refactor to timestamp-based implementationpkg/clob/ws/impl.go- Goroutine lifecycle management and race condition fixespkg/clob/ws/subscription_manager.go- Subscription safety improvementspkg/clob/stream.go- Context cancellation enhancementspkg/clob/impl.go- Heartbeat goroutine management
Test Files:
pkg/clob/ws/goroutine_leak_test.go(new)pkg/clob/ws/race_condition_test.go(new)pkg/clob/ws/subscription_panic_test.go(new)
📈 Performance Impact
- Memory: Reduced memory footprint by eliminating unnecessary background goroutines
- CPU: More efficient rate limiting with on-demand token calculation
- Stability: Eliminated goroutine leaks and race conditions for improved long-term stability
🎯 Upgrade Recommendation
Highly Recommended for all production deployments, especially:
- Applications with long-running WebSocket connections
- High-frequency trading systems
- Market making bots
- Any service experiencing memory growth over time
🙏 Acknowledgments
This release was made possible through comprehensive code review and optimization efforts using AI-assisted development tools.