# StreamAllMids - Stream All Perp Mid Prices

`StreamAllMids` sends the complete default-DEX perp mid-price map as a live Info-derived view rather than a block-cadence stream.

## Request and opening behavior

The request has no fields. A warm subscription immediately receives the current map, then receives a complete replacement when its values change. `time` identifies when the endpoint made the update available, not a block or upstream timestamp.

For a bookless market, the map uses the last-trade fallback. Every frame supersedes the previous map.

## Request Parameters

This method accepts no parameters.

## Request Example

```go
package main

import (
    "context"
    "crypto/tls"
    "log"
    "os"

    pb "example.com/hyperliquid-v3-client/gen/v3"
    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials"
    "google.golang.org/grpc/metadata"
)

func main() {
    endpoint, apiKey := os.Getenv("HYPERLIQUID_GRPC_ENDPOINT"), os.Getenv("DWELLIR_API_KEY")
    if endpoint == "" || apiKey == "" {
        log.Fatal("set HYPERLIQUID_GRPC_ENDPOINT and DWELLIR_API_KEY")
    }
    conn, err := grpc.NewClient(endpoint, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{MinVersion: tls.VersionTLS12})))
    if err != nil {
        log.Fatal(err)
    }
    defer conn.Close()
    ctx := metadata.AppendToOutgoingContext(context.Background(), "x-api-key", apiKey)
    stream, err := pb.NewMarketStreamingClient(conn).StreamAllMids(ctx, &pb.AllMidsRequest{})
    if err != nil {
        log.Fatal(err)
    }
    for {
        update, err := stream.Recv()
        if err != nil {
            log.Fatal(err)
        }
        log.Printf("update_time=%d mids=%v", update.GetTime(), update.GetMids())
    }
}
```

## Response Fields

- `time` (`int64, required`): Endpoint update time in Unix milliseconds, not block or upstream time.
- `mids` (`map<string, string>, required`): Complete default-DEX perp map from coin to decimal mid price or last-trade fallback.

## Successful Response

```protobuf
time: 1785736814057
mids: { key: "BTC" value: "114250.5" }
mids: { key: "ETH" value: "3650.25" }
```

## Error Responses

### Invalid request

- Code: `INVALID_ARGUMENT`
- Description: The request is malformed.

### Feature unavailable

- Code: `FAILED_PRECONDITION`
- Description: This stream is unavailable on the selected endpoint.

### Current data unavailable

- Code: `UNAVAILABLE`
- Description: No current map is available, or the latest data is stale.

### Stream state reset

- Code: `ABORTED`
- Description: The stream state reset; reconnect after it recovers.

### Slow consumer

- Code: `DEADLINE_EXCEEDED`
- Description: The consumer was too slow; reconnect.

### Unauthenticated

- Code: `UNAUTHENTICATED`
- Description: Usable x-api-key metadata was not supplied.

### Permission denied

- Code: `PERMISSION_DENIED`
- Description: The supplied credential cannot call this service.

## Delivery and recovery

Subscriber lag drops obsolete maps in-band. An upstream outage produces silence rather than closing an established stream. `UNAVAILABLE` means a new subscription has no fresh data, `FAILED_PRECONDITION` means the stream is unavailable on this endpoint, and `ABORTED` means its state reset. See the [shared market-stream contract](https://www.dwellir.com/docs/hyperliquid/grpc#v3-market-streaming-service) for common errors.

Related reference: [StreamActiveAssetCtx](https://www.dwellir.com/docs/hyperliquid/stream_active_asset_ctx).
