-
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.
Luke/backend/1036/snapshot v3 endpoint (#283)
* added client code and examples for new v3 snapshot endpoint * chore: Updated coverage badge. * adding a test for the v3 snapshot endpoint * adding method comment for ListAssetSnapshots * Adding proper types for response value * fixed tests and added options response types * aligned response models with models from API * fixed failing test with model name change * replaced ptime type with int64 and string for import issue * refactored into test table with tests for stocks, options, and error case * remove unneeded fields from test data, clean up test failure message --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
585d4fc
commit 66388ee
Showing
7 changed files
with
555 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ | |
|
||
# Dependency directories | ||
vendor/ | ||
|
||
# IntelliJ project settings | ||
.idea |
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,30 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"os" | ||
|
||
polygon "github.com/polygon-io/client-go/rest" | ||
"github.com/polygon-io/client-go/rest/models" | ||
) | ||
|
||
func main() { | ||
// Init client | ||
c := polygon.New(os.Getenv("POLYGON_API_KEY")) | ||
|
||
// Set parameters | ||
params := models.ListAssetSnapshotsParams{}. | ||
WithTickerAnyOf("O:AAPL230512C00050000,O:META230512C00020000,O:F230512C00005000") | ||
|
||
// Make request | ||
iter := c.ListAssetSnapshots(context.Background(), params) | ||
|
||
// do something with the result | ||
for iter.Next() { | ||
log.Println(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,29 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"os" | ||
|
||
polygon "github.com/polygon-io/client-go/rest" | ||
"github.com/polygon-io/client-go/rest/models" | ||
) | ||
|
||
func main() { | ||
// Init client | ||
c := polygon.New(os.Getenv("POLYGON_API_KEY")) | ||
|
||
// Set parameters | ||
params := models.ListAssetSnapshotsParams{}.WithTickerAnyOf("AAPL,META,F") | ||
|
||
// Make request | ||
iter := c.ListAssetSnapshots(context.Background(), params) | ||
|
||
// do something with the result | ||
for iter.Next() { | ||
log.Println(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
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
Oops, something went wrong.