-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - polygon #15558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - polygon #15558
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d7a4a38
polygon init
luancazarine 950b927
[Components] polygon #15141
luancazarine db53c01
pnpm update
luancazarine 33e9861
Update components/polygon/actions/get-historical-prices/get-historica…
luancazarine 0377cd4
some adjusts
luancazarine 19f4866
fix source summary
luancazarine b3f3276
Merge branch 'master' into issue-15141
luancazarine 838fdde
pnpm update
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
components/polygon/actions/get-company-financials/get-company-financials.mjs
This file contains hidden or 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,80 @@ | ||
| import { | ||
| SORT_HISTORICAL_OPTIONS, | ||
| SORT_OPTIONS, TIMEFRAME_OPTIONS, | ||
| } from "../../common/constants.mjs"; | ||
| import polygon from "../../polygon.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "polygon-get-company-financials", | ||
| name: "Get Company Financials", | ||
| description: "Retrieves financial details for a specific company by stock ticker. [See the documentation](https://polygon.io/docs/stocks/get_vx_reference_financials).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| polygon, | ||
| stockTicker: { | ||
| propDefinition: [ | ||
| polygon, | ||
| "stockTicker", | ||
| ], | ||
| }, | ||
| filingDate: { | ||
| type: "string", | ||
| label: "Filing Date", | ||
| description: "Query by the date when the filing with financials data was filed in **YYYY-MM-DD** format.", | ||
| optional: true, | ||
| }, | ||
| periodOfReportDate: { | ||
| type: "string", | ||
| label: "Period Of Report Date", | ||
| description: "The period of report for the filing with financials data in **YYYY-MM-DD** format.", | ||
| optional: true, | ||
| }, | ||
| timeframe: { | ||
| type: "string", | ||
| label: "Timeframe", | ||
| description: "Query by timeframe. Annual financials originate from 10-K filings, and quarterly financials originate from 10-Q filings. Note: Most companies do not file quarterly reports for Q4 and instead include those financials in their annual report, so some companies my not return quarterly financials for Q4", | ||
| options: TIMEFRAME_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| order: { | ||
| type: "string", | ||
| label: "Order", | ||
| description: "Order results based on the `Sort` field.", | ||
| options: SORT_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "Limit the number of results returned.", | ||
| optional: true, | ||
| min: 1, | ||
| max: 100, | ||
| default: 10, | ||
| }, | ||
| sort: { | ||
| type: "string", | ||
| label: "Sort", | ||
| description: "Sort field used for ordering", | ||
| options: SORT_HISTORICAL_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const financialDetails = await this.polygon.getFinancialDetails({ | ||
| $, | ||
| params: { | ||
| ticker: this.stockTicker, | ||
| filing_date: this.filingDate, | ||
| period_of_report_date: this.periodOfReportDate, | ||
| timeframe: this.timeframe, | ||
| order: this.order, | ||
| limit: this.limit, | ||
| sort: this.sort, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved financial details for ${this.stockTicker}`); | ||
| return financialDetails; | ||
| }, | ||
| }; |
84 changes: 84 additions & 0 deletions
84
components/polygon/actions/get-historical-prices/get-historical-prices.mjs
This file contains hidden or 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,84 @@ | ||
| import { | ||
| SORT_OPTIONS, | ||
| TIMESPAN_OPTIONS, | ||
| } from "../../common/constants.mjs"; | ||
| import polygon from "../../polygon.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "polygon-get-historical-prices", | ||
| name: "Get Historical Prices", | ||
| description: "Fetches historical price data for a specified stock ticker within a date range. [See the documentation](https://polygon.io/docs/stocks/get_v2_aggs_ticker__stocksticker__range__multiplier___timespan___from___to)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| polygon, | ||
| stockTicker: { | ||
| propDefinition: [ | ||
| polygon, | ||
| "stockTicker", | ||
| ], | ||
| }, | ||
| multiplier: { | ||
| type: "integer", | ||
| label: "Multiplier", | ||
| description: "The size of the timespan multiplier.", | ||
| default: 1, | ||
| }, | ||
| timespan: { | ||
| type: "string", | ||
| label: "Timespan", | ||
| description: "The size of the time window.", | ||
| options: TIMESPAN_OPTIONS, | ||
| }, | ||
| from: { | ||
| type: "string", | ||
| label: "From Date", | ||
| description: "The start of the aggregate time window. Either a date with the format **YYYY-MM-DD** or a millisecond timestamp.", | ||
| }, | ||
| to: { | ||
| type: "string", | ||
| label: "To Date", | ||
| description: "The end of the aggregate time window. Either a date with the format **YYYY-MM-DD** or a millisecond timestamp.", | ||
| }, | ||
| adjusted: { | ||
| propDefinition: [ | ||
| polygon, | ||
| "adjusted", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| sort: { | ||
| type: "string", | ||
| label: "Sort", | ||
| description: "Sort the results by timestamp. asc will return results in ascending order (oldest at the top), desc will return results in descending order (newest at the top).", | ||
| options: SORT_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "Limits the number of base aggregates queried to create the aggregate results. Max 50000 and Default 5000. Read more about how limit is used to calculate aggregate results in our article on [Aggregate Data API Improvements](https://polygon.io/blog/aggs-api-updates).", | ||
| optional: true, | ||
| min: 1, | ||
| max: 50000, | ||
| default: 5000, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.polygon.getHistoricalPriceData({ | ||
| $, | ||
| stockTicker: this.stockTicker, | ||
| multiplier: this.multiplier, | ||
| timespan: this.timespan, | ||
| from: this.from, | ||
| to: this.to, | ||
| params: { | ||
| adjusted: this.adjusted, | ||
| sort: this.sort, | ||
| limit: this.limit, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Fetched historical prices for ${this.stockTicker} from ${this.from} to ${this.to}.`); | ||
| return response; | ||
| }, | ||
| }; | ||
51 changes: 51 additions & 0 deletions
51
components/polygon/actions/get-stock-price/get-stock-price.mjs
This file contains hidden or 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,51 @@ | ||
| import polygon from "../../polygon.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "polygon-get-stock-price", | ||
| name: "Get Stock Price", | ||
| description: "Get the open, close and afterhours prices of a stock symbol on a certain date. [See the documentation](https://polygon.io/docs/stocks/get_v1_open-close__stocksticker___date)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| polygon, | ||
| stockTicker: { | ||
| propDefinition: [ | ||
| polygon, | ||
| "stockTicker", | ||
| ], | ||
| }, | ||
| date: { | ||
| type: "string", | ||
| label: "Date", | ||
| description: "The date of the requested open/close in the format YYYY-MM-DD.", | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| adjusted: { | ||
| propDefinition: [ | ||
| polygon, | ||
| "adjusted", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
|
|
||
| const response = await this.polygon.getCurrentPrice({ | ||
| $, | ||
| date: this.date, | ||
| stockTicker: this.stockTicker, | ||
| params: { | ||
| adjusted: this.adjusted, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully fetched the price of ${this.stockTicker}`); | ||
| return response; | ||
| } catch ({ response }) { | ||
| if (response.status === 404) { | ||
| $.export("$summary", `No data found for ${this.stockTicker}`); | ||
| return {}; | ||
| } | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
This file contains hidden or 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,26 @@ | ||
| export const TIMESPAN_OPTIONS = [ | ||
| "second", | ||
| "minute", | ||
| "hour", | ||
| "day", | ||
| "week", | ||
| "month", | ||
| "quarter", | ||
| "year", | ||
| ]; | ||
|
|
||
| export const TIMEFRAME_OPTIONS = [ | ||
| "annual", | ||
| "quarterly", | ||
| "ttm", | ||
| ]; | ||
|
|
||
| export const SORT_OPTIONS = [ | ||
| "asc", | ||
| "desc", | ||
| ]; | ||
|
|
||
| export const SORT_HISTORICAL_OPTIONS = [ | ||
| "filing_date", | ||
| "period_of_report_date", | ||
| ]; |
This file contains hidden or 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,7 @@ | ||
| export const parseNextPage = (nextUrl = null) => { | ||
| if (nextUrl) { | ||
| const url = new URL(nextUrl); | ||
| nextUrl = url.searchParams.get("cursor"); | ||
| } | ||
| return nextUrl; | ||
| }; |
This file contains hidden or 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,18 @@ | ||
| { | ||
| "name": "@pipedream/polygon", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Polygon Components", | ||
| "main": "polygon.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "polygon" | ||
| ], | ||
| "homepage": "https://pipedream.com/apps/polygon", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.