-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added GetShortInterest and ListIPOs support
- Loading branch information
1 parent
4518350
commit b65b919
Showing
6 changed files
with
359 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Stocks - Company IPOs | ||
// https://polygon.io/docs/stocks/get_v1_reference_ipos | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"os" | ||
|
||
polygon "github.com/polygon-io/client-go/rest" | ||
"github.com/polygon-io/client-go/rest/models" | ||
) | ||
|
||
func main() { | ||
|
||
// Initialize client | ||
c := polygon.New(os.Getenv("POLYGON_API_KEY")) | ||
|
||
// Set parameters (optional) | ||
params := models.ListIPOsParams{}. | ||
WithLimit(1). | ||
WithOrder(models.Asc). | ||
WithSort(models.IPOsSortListingDate) | ||
|
||
// make request | ||
iter := c.ListIPOs(context.Background(), params) | ||
|
||
// do something with the result | ||
for iter.Next() { | ||
log.Print(iter.Item()) | ||
} | ||
if iter.Err() != nil { | ||
log.Fatal(iter.Err()) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Stocks - Short Interest | ||
// https://polygon.io/docs/stocks/get_v1_reference_short-interest__identifierType___identifier | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"os" | ||
|
||
polygon "github.com/polygon-io/client-go/rest" | ||
"github.com/polygon-io/client-go/rest/models" | ||
) | ||
|
||
func main() { | ||
|
||
// Initialize client | ||
c := polygon.New(os.Getenv("POLYGON_API_KEY")) | ||
|
||
// Set parameters | ||
params := models.GetShortInterestParams{ | ||
IdentifierType: "ticker", | ||
Identifier: "AAPL", | ||
} | ||
|
||
// Make request | ||
res, err := c.GetShortInterest(context.Background(), ¶ms) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Handle the result | ||
log.Print(res) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters