Skip to content

Commit 79b6854

Browse files
committed
Update endpoints from vX to v1
1 parent 92dc4d1 commit 79b6854

File tree

5 files changed

+47
-53
lines changed

5 files changed

+47
-53
lines changed

rest/example/economy/treasury-yields/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func main() {
2121
WithLimit(50000)
2222

2323
// Make request
24-
iter := c.VX.ListTreasuryYields(context.Background(), params)
24+
iter := c.ListTreasuryYields(context.Background(), params)
2525

2626
// Process results
2727
for iter.Next() {

rest/example/stocks/short-interest/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func main() {
2121
WithLimit(50000)
2222

2323
// Make request
24-
iter := c.VX.ListShortInterest(context.Background(), params)
24+
iter := c.ListShortInterest(context.Background(), params)
2525

2626
// Process results
2727
for iter.Next() {

rest/example/stocks/short-volume/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func main() {
2121
WithLimit(50000)
2222

2323
// Make request
24-
iter := c.VX.ListShortVolume(context.Background(), params)
24+
iter := c.ListShortVolume(context.Background(), params)
2525

2626
// Process results
2727
for iter.Next() {

rest/reference.go

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,17 @@ const (
1515
ListTickerNewsPath = "/v2/reference/news"
1616
GetTickerRelatedCompaniesPath = "/v1/related-companies/{ticker}"
1717
GetTickerTypesPath = "/v3/reference/tickers/types"
18-
19-
GetMarketHolidaysPath = "/v1/marketstatus/upcoming"
20-
GetMarketStatusPath = "/v1/marketstatus/now"
21-
22-
ListSplitsPath = "/v3/reference/splits"
23-
24-
ListDividendsPath = "/v3/reference/dividends"
25-
26-
ListConditionsPath = "/v3/reference/conditions"
27-
28-
GetExchangesPath = "/v3/reference/exchanges"
29-
30-
GetOptionsContractPath = "/v3/reference/options/contracts/{ticker}"
31-
ListOptionsContractsPath = "/v3/reference/options/contracts"
18+
GetMarketHolidaysPath = "/v1/marketstatus/upcoming"
19+
GetMarketStatusPath = "/v1/marketstatus/now"
20+
ListSplitsPath = "/v3/reference/splits"
21+
ListDividendsPath = "/v3/reference/dividends"
22+
ListConditionsPath = "/v3/reference/conditions"
23+
GetExchangesPath = "/v3/reference/exchanges"
24+
GetOptionsContractPath = "/v3/reference/options/contracts/{ticker}"
25+
ListOptionsContractsPath = "/v3/reference/options/contracts"
26+
ListShortInterestPath = "/stocks/v1/short-interest"
27+
ListShortVolumePath = "/stocks/v1/short-volume"
28+
ListTreasuryYieldsPath = "/fed/v1/treasury-yields"
3229
)
3330

3431
// ReferenceClient defines a REST client for the Polygon reference API.
@@ -210,3 +207,33 @@ func (c *ReferenceClient) ListOptionsContracts(ctx context.Context, params *mode
210207
return res, res.Results, err
211208
})
212209
}
210+
211+
// ListShortInterest retrieves short interest data for stocks, including days to cover and average daily volume.
212+
// Note: this method utilizes an experimental API and could experience breaking changes or deprecation.
213+
func (c *ReferenceClient) ListShortInterest(ctx context.Context, params *models.ListShortInterestParams, options ...models.RequestOption) *iter.Iter[models.ShortInterest] {
214+
return iter.NewIter(ctx, ListShortInterestPath, params, func(uri string) (iter.ListResponse, []models.ShortInterest, error) {
215+
res := &models.ListShortInterestResponse{}
216+
err := c.CallURL(ctx, http.MethodGet, uri, res, options...)
217+
return res, res.Results, err
218+
})
219+
}
220+
221+
// ListShortVolume retrieves short volume data for stocks, including venue-specific volumes and short volume ratio.
222+
// Note: this method utilizes an experimental API and could experience breaking changes or deprecation.
223+
func (c *ReferenceClient) ListShortVolume(ctx context.Context, params *models.ListShortVolumeParams, options ...models.RequestOption) *iter.Iter[models.ShortVolume] {
224+
return iter.NewIter(ctx, ListShortVolumePath, params, func(uri string) (iter.ListResponse, []models.ShortVolume, error) {
225+
res := &models.ListShortVolumeResponse{}
226+
err := c.CallURL(ctx, http.MethodGet, uri, res, options...)
227+
return res, res.Results, err
228+
})
229+
}
230+
231+
// ListTreasuryYields retrieves treasury yield data for U.S. Treasury securities at various maturities.
232+
// Note: this method utilizes an experimental API and could experience breaking changes or deprecation.
233+
func (c *ReferenceClient) ListTreasuryYields(ctx context.Context, params *models.ListTreasuryYieldsParams, options ...models.RequestOption) *iter.Iter[models.TreasuryYield] {
234+
return iter.NewIter(ctx, ListTreasuryYieldsPath, params, func(uri string) (iter.ListResponse, []models.TreasuryYield, error) {
235+
res := &models.ListTreasuryYieldsResponse{}
236+
err := c.CallURL(ctx, http.MethodGet, uri, res, options...)
237+
return res, res.Results, err
238+
})
239+
}

rest/vx.go

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ import (
1010
)
1111

1212
const (
13-
ListFinancialsPath = "/vX/reference/financials"
14-
GetTickerEventsPath = "/vX/reference/tickers/{id}/events"
15-
ListTreasuryYieldsPath = "/fed/vX/treasury-yields"
16-
ListIPOsPath = "/vX/reference/ipos"
17-
ListShortInterestPath = "/stocks/vX/short-interest"
18-
ListShortVolumePath = "/stocks/vX/short-volume"
13+
ListFinancialsPath = "/vX/reference/financials"
14+
GetTickerEventsPath = "/vX/reference/tickers/{id}/events"
15+
ListIPOsPath = "/vX/reference/ipos"
1916
)
2017

2118
// VXClient defines a REST client for the Polygon VX (experimental) API.
@@ -53,16 +50,6 @@ func (c *VXClient) GetTickerEvents(ctx context.Context, params *models.GetTicker
5350
return res, err
5451
}
5552

56-
// ListTreasuryYields retrieves treasury yield data for U.S. Treasury securities at various maturities.
57-
// Note: this method utilizes an experimental API and could experience breaking changes or deprecation.
58-
func (c *VXClient) ListTreasuryYields(ctx context.Context, params *models.ListTreasuryYieldsParams, options ...models.RequestOption) *iter.Iter[models.TreasuryYield] {
59-
return iter.NewIter(ctx, ListTreasuryYieldsPath, params, func(uri string) (iter.ListResponse, []models.TreasuryYield, error) {
60-
res := &models.ListTreasuryYieldsResponse{}
61-
err := c.CallURL(ctx, http.MethodGet, uri, res, options...)
62-
return res, res.Results, err
63-
})
64-
}
65-
6653
// ListIPOs retrieves detailed information about Initial Public Offerings (IPOs), including both upcoming and historical events.
6754
// Note: this method utilizes an experimental API and could experience breaking changes or deprecation.
6855
func (c *VXClient) ListIPOs(ctx context.Context, params *models.ListIPOsParams, options ...models.RequestOption) *iter.Iter[models.IPOResult] {
@@ -72,23 +59,3 @@ func (c *VXClient) ListIPOs(ctx context.Context, params *models.ListIPOsParams,
7259
return res, res.Results, err
7360
})
7461
}
75-
76-
// ListShortInterest retrieves short interest data for stocks, including days to cover and average daily volume.
77-
// Note: this method utilizes an experimental API and could experience breaking changes or deprecation.
78-
func (c *VXClient) ListShortInterest(ctx context.Context, params *models.ListShortInterestParams, options ...models.RequestOption) *iter.Iter[models.ShortInterest] {
79-
return iter.NewIter(ctx, ListShortInterestPath, params, func(uri string) (iter.ListResponse, []models.ShortInterest, error) {
80-
res := &models.ListShortInterestResponse{}
81-
err := c.CallURL(ctx, http.MethodGet, uri, res, options...)
82-
return res, res.Results, err
83-
})
84-
}
85-
86-
// ListShortVolume retrieves short volume data for stocks, including venue-specific volumes and short volume ratio.
87-
// Note: this method utilizes an experimental API and could experience breaking changes or deprecation.
88-
func (c *VXClient) ListShortVolume(ctx context.Context, params *models.ListShortVolumeParams, options ...models.RequestOption) *iter.Iter[models.ShortVolume] {
89-
return iter.NewIter(ctx, ListShortVolumePath, params, func(uri string) (iter.ListResponse, []models.ShortVolume, error) {
90-
res := &models.ListShortVolumeResponse{}
91-
err := c.CallURL(ctx, http.MethodGet, uri, res, options...)
92-
return res, res.Results, err
93-
})
94-
}

0 commit comments

Comments
 (0)