Files
gocryptotrader/exchanges/subscription/testdata/errors.tmpl
Gareth Kirwan d069ff2bf4 Subscriptions: Fix no enabled pairs for one asset (#1792)
If one asset is enabled but has no enabled pairs, we should ignore that
asset, even for non-pair related subscriptions.
That matches the existing code, but wasn't happening in the context of
asset.All subscriptions with just one asset in this state.
If a user wanted to have non-pair subscriptions, they should use
asset.Empty. Would expect other breakages with no pairs enabled, too.

Note: No enabled pairs for an enabled asset is a transient issue which
can occur due to enableOnePair racing against no available pairs. The
second run, available pairs would be populated and enableOnePair would
work. This situation could persist due to running with --dry or
containerised, though.

Fixes:
`
Okx websocket: subscription failure, myOrders all : subscription template did not generate the expected number of pair records for spread: Got 1;
Expected 0
`

Relates to #1420
2025-03-06 12:08:08 +11:00

36 lines
1.0 KiB
Cheetah

{{- if eq .S.Channel "error1" }}
{{/* Runtime error from executing */}}
{{ .S.String 42 }}
{{- else if eq .S.Channel "error2" }}
{{/* Incorrect number of asset entries */}}
{{- .AssetSeparator -}}
{{- .AssetSeparator -}}
{{- .AssetSeparator -}}
{{- else if eq .S.Channel "error3" }}
{{/* Incorrect number of pair entries */}}
{{- .PairSeparator -}}
{{- .PairSeparator -}}
{{- else if eq .S.Channel "error4" }}
{{/* Too many BatchSize commands */}}
{{- range $asset, $pairs := $.AssetPairs }}
{{- $pairs.Join -}}
{{- $.BatchSize -}}1
{{- $.BatchSize -}}2
{{- $.AssetSeparator -}}
{{- end -}}
{{- else if eq .S.Channel "error5" }}
{{/* BatchSize without number */}}
{{- range $asset, $pairs := $.AssetPairs }}
{{- $pairs.Join -}}
{{- $.BatchSize -}}
{{- $.AssetSeparator -}}
{{- end -}}
{{- else if eq .S.Channel "empty-content" }}
{{/* Empty response for the pair */}}
{{- range $asset, $pairs := $.AssetPairs }}
{{- range $pair := $pairs -}}
{{- $.PairSeparator -}}
{{- end -}}
{{- end -}}
{{- end -}}