Skip to content

Commit

Permalink
bug fix and outdated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhack committed Nov 13, 2024
1 parent 743be16 commit 0f43d2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions alpaca/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,11 +827,11 @@ func (c *Client) GetOptionContracts(req GetOptionContractsRequest) ([]OptionCont
q.Set("style", string(req.Style))
}

if req.StrikePriceLTE.IsZero() {
if !req.StrikePriceLTE.IsZero() {
q.Set("strike_price_lte", req.StrikePriceLTE.String())
}

if req.StrikePriceGTE.IsZero() {
if !req.StrikePriceGTE.IsZero() {
q.Set("strike_price_gte", req.StrikePriceGTE.String())
}

Expand Down
7 changes: 3 additions & 4 deletions alpaca/rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ func TestGetAssetFromJSON(t *testing.T) {

func TestGetOptionContracts(t *testing.T) {
c := DefaultClient
// successful with nils
// successful case with simple query
request := GetOptionContractsRequest{
UnderlyingSymbols: "some_symbol1,some_symbol2",
}
Expand All @@ -936,8 +936,7 @@ func TestGetOptionContracts(t *testing.T) {
require.Len(t, contracts, 1)
assert.Equal(t, expectedID, contracts[0].ID)

// successful without nils

// successful case with more paramters
request = GetOptionContractsRequest{
UnderlyingSymbols: "some_symbol",
ShowDeliverable: true,
Expand Down Expand Up @@ -991,7 +990,7 @@ func TestGetOptionContracts(t *testing.T) {

func TestGetOptionContract(t *testing.T) {
c := DefaultClient
// successful with nils
// successful case
expectedSymbol := "some_symbol"
expectedID := "some_id"
c.do = func(_ *Client, req *http.Request) (*http.Response, error) {
Expand Down

0 comments on commit 0f43d2f

Please sign in to comment.