Go client library for the Ramaris API — Base-focused wallet analytics and strategy tracking.
go get github.com/ramaris-app/go-sdkRequires Go 1.22+. Zero external dependencies (stdlib only).
package main
import (
"context"
"fmt"
"log"
ramaris "github.com/ramaris-app/go-sdk"
)
func main() {
client := ramaris.NewClient("rms_your_api_key")
ctx := context.Background()
// List strategies
strategies, err := client.ListStrategies(ctx, &ramaris.ListOptions{Page: 1, PageSize: 10})
if err != nil {
log.Fatal(err)
}
for _, s := range strategies.Data {
fmt.Printf("%s — %d wallets tracked\n", s.Name, s.Stats.WalletsTracked)
}
}// Default client — connects to https://api.ramaris.app/api/v1
client := ramaris.NewClient("rms_your_api_key")
// Custom base URL — useful for local development or running your own instance
client := ramaris.NewClient("rms_key", ramaris.WithBaseURL("http://localhost:3000/api/v1"))
// Custom HTTP client
client := ramaris.NewClient("rms_key", ramaris.WithHTTPClient(&http.Client{Timeout: 10 * time.Second}))The default base URL points to the production Ramaris API at https://api.ramaris.app/api/v1. The WithBaseURL option is only needed if you're testing against a local server or a custom deployment.
// List strategies with pagination
resp, err := client.ListStrategies(ctx, &ramaris.ListOptions{Page: 1, PageSize: 50})
// Get a single strategy by share ID
strategy, err := client.GetStrategy(ctx, "shareId")
// List your watchlist
watchlist, err := client.ListWatchlist(ctx, nil) // nil = default pagination// List wallets
resp, err := client.ListWallets(ctx, nil)
// Get a single wallet by ID
wallet, err := client.GetWallet(ctx, 456)// Get your profile
profile, err := client.GetProfile(ctx)
// Get your subscription
sub, err := client.GetSubscription(ctx)health, err := client.Health(ctx)import "errors"
strategy, err := client.GetStrategy(ctx, "invalid")
if err != nil {
var apiErr *ramaris.Error
if errors.As(err, &apiErr) {
fmt.Printf("API error: %s (HTTP %d)\n", apiErr.Code, apiErr.StatusCode)
}
var rlErr *ramaris.RateLimitError
if errors.As(err, &rlErr) {
fmt.Printf("Rate limited, retry after %d seconds\n", rlErr.RetryAfter)
}
}Rate limit info is updated after every successful request:
client.Health(ctx)
if rl := client.RateLimit(); rl != nil {
fmt.Printf("%d/%d requests remaining (resets at %d)\n", rl.Remaining, rl.Limit, rl.Reset)
}- 5xx errors: Retried up to 3 times with exponential backoff (500ms, 1s, 2s)
- 429 rate limit: Returns
*RateLimitErrorimmediately withRetryAfter— caller decides when to retry - 4xx errors: Returns
*Errorimmediately (no retry) - All methods respect
context.Contextfor cancellation and timeouts
# Unit tests
go test -v -race ./...
# Integration tests (requires API key)
RAMARIS_API_KEY=rms_... go test -tags=integration -v ./...
# Coverage
go test -coverprofile=c.out ./... && go tool cover -func=c.outMIT