Skip to content

Go SDK

grpc-go-based Go client for every service in sweetspot.api.v1. Includes AuthFlow for the signed-nonce session-token flow, ResilientStream for auto-reconnecting server streams, and QuotingCore for tx batching + status tracking. Strategy clients (OracleOffset / OrderList / LinearDistribution) are Rust-only — see Quoting for the Go integration shape.

Install

sh
go get github.com/superis/sweetspot-maker-client/go/superis

Quickstart

go
package main

import (
    "context"
    "fmt"
    "log"

    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials"

    "github.com/superis/sweetspot-maker-client/go/superis"
    pb "github.com/superis/sweetspot-maker-client/go/sweetspot/api/v1"
)

func main() {
    ctx := context.Background()
    conn, err := grpc.NewClient("api.superis.exchange:443",
        grpc.WithTransportCredentials(credentials.NewTLS(nil)))
    if err != nil { log.Fatal(err) }
    defer conn.Close()

    // Public RPC — no auth needed.
    market := pb.NewMarketDataServiceClient(conn)
    pairs, err := market.ListPairs(ctx, &pb.ListPairsRequest{})
    if err != nil { log.Fatal(err) }
    for _, p := range pairs.Pairs {
        fmt.Printf("%v / %v\n", p.Base, p.Quote)
    }

    // Authenticated path: AuthService.Challenge → sign → Authenticate.
    auth := superis.NewAuthFlowOnConn(conn, mySigner)
    session, err := auth.Token(ctx)
    if err != nil { log.Fatal(err) }
    fmt.Printf("authenticated as maker_id=%d\n", session.MakerID)
}

Where to go from here

You wantPage
Boot a maker botQuoting
Stream books and fillsMarket data
Survive transient disconnectsResilience
Pull historical trades / candlesHistorical queries
Sign-in flow detailAuth flow

Decimal handling

price, size, and OHLCV fields come back as *pb.Decimal{Value: string}. Parse with shopspring/decimal:

go
import "github.com/shopspring/decimal"

price, _ := decimal.NewFromString(trade.Price.GetValue())
size,  _ := decimal.NewFromString(trade.Size.GetValue())
notional := price.Mul(size)

Errors

The SDK returns standard error values. Branch on the gRPC status code via google.golang.org/grpc/status — see Errors.

Source

Apache 2.0