This repo is regenerated by OpenXAPI, so customize specs/templates upstream and re-run generation instead of hand-editing clients. Two top-level modules mirror REST and WebSocket surfaces: rest/ (HTTP clients for spot, umfutures, cmfutures, options, pmargin) and ws/ (streaming clients plus *-streams). Each module owns its go.mod and README; keep artifacts scoped to the product directory so go get github.com/openxapi/binance-go/<module> stays valid.
cd rest && go build ./...– compiles every REST product.cd ws && go build ./spot(swap package) – quick streaming sanity check.go test ./rest/...andgo test ./ws/...– unit suites per module.BINANCE_API_KEY=xxx BINANCE_SECRET_KEY=yyy go test -v ./ws/spot-streams -run Live– guarded integration run; unset keys afterward.go vet ./...– static checks that regularly catch spec drift.
Format with gofmt/goimports (tabs, idiomatic spacing). Exported identifiers keep Binance terminology in PascalCase (MarkPriceEvent, GetExchangeInfoV3Request); helpers stay camelCase. Generated builders and handler names should remain untouched so diffs against regenerated output stay minimal. Match existing doc-comment tense if you add clarifications.
Use Go’s testing package with table-driven cases for signing, serialization, and reconnection helpers. Limit live coverage to flows that truly require Binance connectivity and protect them with env checks (BINANCE_API_KEY, BINANCE_SECRET_KEY, listen keys). Name tests Test<Product><Behavior> (e.g., TestSpotClientBuildsSignature) and ensure go test ./... passes before opening a PR.
Keep commit messages short and imperative with the package prefix up front (spot: adjust api params, ws: fix reconnection). PR descriptions should link to the OpenXAPI spec/template change, summarize observable SDK diffs, and paste relevant build/test output. Because the tree is regenerated, detail any local generation command so reviewers can reproduce identical binaries.
Never commit credentials; load them from env vars or ignored dotfiles. Use configuration helpers (cfg := spot.NewConfiguration()) to point clients at Binance testnet when iterating. Respect documented REST throttling and enforce WebSocket send limits (5 msgs/sec) inside demos or tests to avoid bans.