subscriptions: Add templating support and integrate with Binance (#1568)

* Subscriptions: Add List.AssetPairs

* Subscriptions: Add Template and QualifiedChannel

These fields separate the concept of what the channel is from the
qualified resource name

* Subscriptions: Add List.SetStates()

* Subscriptions: Add List.QualifiedChannels

* Subscriptions: Rename testsubs.EqualLists

* Binance: Switch to ExpandTemplates

* Binance: Update ConfigTest format

* Subscriptions: Test Coverage improvements

* Subscriptions: Reenterant List.ExpandTemplates

* Subscriptions: Move templates from subscriptions to exchanges

* Binance: Inline subscription template and improvements
This commit is contained in:
Gareth Kirwan
2024-07-09 12:53:00 +07:00
committed by GitHub
parent 00c5c95468
commit c601575c66
27 changed files with 886 additions and 232 deletions

View File

@@ -0,0 +1,13 @@
{{- if eq .S.Channel "error1" }}
{{/* Error 1: Expand pairs but not assets, without specific asset */}}
{{- .PairSeparator -}}
{{- else if eq .S.Channel "error2" }}
{{/* Error 2: Runtime error from executing */}}
{{ .S.String 42 }}
{{- else if eq .S.Channel "error3" }}
{{/* Error 3: Incorrect number of asset entries */}}
{{- .AssetSeparator }}
{{- else if eq .S.Channel "error4" }}
{{/* Error 3: Incorrect number of pair entries */}}
{{- .PairSeparator }}
{{- end -}}

View File

@@ -0,0 +1 @@
{{ explode }}

View File

@@ -0,0 +1,21 @@
{{- if eq $.S.Channel "feature1" -}}
{{/* Case 1: One channel to rule them all */}}
feature1
{{- else if eq $.S.Channel "feature2" -}}
{{/* Case 2: One channel per asset */}}
{{- range $asset, $pairs := $.AssetPairs }}
{{ assetName $asset }}-feature2@ {{- $.S.Interval.Short }}
{{- $.AssetSeparator }}
{{- end }}
{{- else if eq $.S.Channel "feature3" }}
{{/* Case 3: One channel per pair per asset */}}
{{- range $asset, $pairs := $.AssetPairs }}
{{- range $pair := $pairs -}}
{{ assetName $asset }}-{{ $pair.Swap.String -}} -feature3@ {{- $.S.Levels }}
{{- $.PairSeparator -}}
{{- end -}}
{{- $.AssetSeparator -}}
{{- end -}}
{{- else if eq $.S.Channel "feature4" }}
feature4-authed
{{- end -}}