From 30ab2fc57aae1d807dc4aa1eef1424fc1b966e1e Mon Sep 17 00:00:00 2001 From: Marek Cermak Date: Fri, 6 Dec 2024 21:03:51 +0100 Subject: [PATCH] feat: add list exchange symbols Signed-off-by: Marek Cermak --- market/quote.go | 7 ++++--- market/ticker.go | 6 ++++++ model/quote.go | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/market/quote.go b/market/quote.go index 1d0ec38..23d6b88 100644 --- a/market/quote.go +++ b/market/quote.go @@ -10,9 +10,10 @@ import ( ) const ( - GetFullPricePath = "/api/v3/quote/:symbol" - GetPriceChangePath = "/api/v3/stock-price-target/:symbol" - BatchGetFullPricePath = "/api/v3/quote/:symbols" + ListExchangeSymbolsPath = "/api/v3/symbol/:exchange" + GetFullPricePath = "/api/v3/quote/:symbol" + GetPriceChangePath = "/api/v3/stock-price-target/:symbol" + BatchGetFullPricePath = "/api/v3/quote/:symbols" GetRealtimeQuotePath = "/api/v3/stock/full/real-time-price/:symbol" BatchGetRealtimeQuotePath = "/api/v3/stock/full/real-time-price/:symbols" diff --git a/market/ticker.go b/market/ticker.go index 5c1ec5d..784839e 100644 --- a/market/ticker.go +++ b/market/ticker.go @@ -136,3 +136,9 @@ func (tc *TickerClient) ListMostActiveTickers(ctx context.Context, opts ...model _, err := tc.Call(ctx, http.MethodGet, ListMostActiveTickersPath, nil, &res, opts...) return res, err } + +func (qc *TickerClient) ListExchangeSymbols(ctx context.Context, params *model.ListExchangeSymbolsParams, opts ...model.RequestOption) (model.ListExchangeSymbolsResponse, error) { + var res model.ListExchangeSymbolsResponse + _, err := qc.Call(ctx, http.MethodGet, ListExchangeSymbolsPath, params, &res, opts...) + return res, err +} diff --git a/model/quote.go b/model/quote.go index 6e64841..ab9b242 100644 --- a/model/quote.go +++ b/model/quote.go @@ -26,6 +26,12 @@ type TickerQuote struct { type ListAllRealtimeQuotesResponse = []TickerQuote +type ListExchangeSymbolsParams struct { + Exchange string `path:"exchange,required"` +} + +type ListExchangeSymbolsResponse = []TickerPrice + type GetFullPriceParams struct { Symbol string `path:"symbol,required"` }