Skip to content

Commit

Permalink
Use the v1 endpoint for corporate actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gnvk committed Jan 17, 2025
1 parent d3fb5cc commit ac3edf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions marketdata/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,10 @@ func (c *Client) GetSnapshots(symbols []string, req GetSnapshotRequest) (map[str
return snapshots, nil
}

const cryptoPrefix = "v1beta3/crypto"
const cryptoPerpPrefix = "v1beta1/crypto-perps"
const (
cryptoPrefix = "v1beta3/crypto"
cryptoPerpPrefix = "v1beta1/crypto-perps"
)

type cryptoBaseRequest struct {
Symbols []string
Expand Down Expand Up @@ -1233,7 +1235,6 @@ func (c *Client) GetLatestCryptoQuotes(
symbols []string, req GetLatestCryptoQuoteRequest,
) (map[string]CryptoQuote, error) {
u, err := url.Parse(fmt.Sprintf("%s/latest/quotes", c.cryptoURL(req)))

if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1499,7 +1500,7 @@ type GetCorporateActionsRequest struct {

// GetCorporateActions returns the corporate actions based on the given req.
func (c *Client) GetCorporateActions(req GetCorporateActionsRequest) (CorporateActions, error) {
u, err := url.Parse(fmt.Sprintf("%s/v1beta1/corporate-actions", c.opts.BaseURL))
u, err := url.Parse(fmt.Sprintf("%s/v1/corporate-actions", c.opts.BaseURL))
if err != nil {
return CorporateActions{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions marketdata/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ func TestGetCorporateActions(t *testing.T) {
}`
c := DefaultClient
c.do = func(_ *Client, req *http.Request) (*http.Response, error) {
assert.Equal(t, "/v1beta1/corporate-actions", req.URL.Path)
assert.Equal(t, "/v1/corporate-actions", req.URL.Path)
assert.Equal(t, "forward_split,name_change,worthless_removal,stock_merger",
req.URL.Query().Get("types"))
assert.Equal(t, "2024-03-10", req.URL.Query().Get("start"))
Expand Down Expand Up @@ -1445,7 +1445,7 @@ func TestLatestCryptoPerpQuote(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, got)
assert.Equal(t, CryptoPerpQuote{
Timestamp: time.Date(2024, 12, 19, 9, 43, 04, 92000000, time.UTC),
Timestamp: time.Date(2024, 12, 19, 9, 43, 0o4, 92000000, time.UTC),
BidPrice: 101674.7,
BidSize: 1.4496,
AskPrice: 101675.1,
Expand Down

0 comments on commit ac3edf9

Please sign in to comment.