diff --git a/components/finage/actions/forex-last-quote/forex-last-quote.mjs b/components/finage/actions/forex-last-quote/forex-last-quote.mjs new file mode 100644 index 0000000000000..71afa525f30ca --- /dev/null +++ b/components/finage/actions/forex-last-quote/forex-last-quote.mjs @@ -0,0 +1,26 @@ +import app from "../../finage.app.mjs"; + +export default { + key: "finage-forex-last-quote", + name: "Forex Last Quote", + description: "Get the last quote for the specified forex symbol. [See the documentation](https://finage.co.uk/docs/api/forex/forex-last-quote)", + version: "0.0.1", + type: "action", + props: { + app, + symbol: { + propDefinition: [ + app, + "symbol", + ], + }, + }, + async run({ $ }) { + const response = await this.app.forexLastQuote({ + $, + symbol: this.symbol, + }); + $.export("$summary", "Successfully retrieved the last quote for " + this.symbol); + return response; + }, +}; diff --git a/components/finage/actions/forex-last-trade/forex-last-trade.mjs b/components/finage/actions/forex-last-trade/forex-last-trade.mjs new file mode 100644 index 0000000000000..cc4c92ac2e716 --- /dev/null +++ b/components/finage/actions/forex-last-trade/forex-last-trade.mjs @@ -0,0 +1,26 @@ +import app from "../../finage.app.mjs"; + +export default { + key: "finage-forex-last-trade", + name: "Forex Last Trade", + description: "Get the last trade for the specified forex symbol. [See the documentation](https://finage.co.uk/docs/api/forex/forex-last-trade)", + version: "0.0.1", + type: "action", + props: { + app, + symbol: { + propDefinition: [ + app, + "symbol", + ], + }, + }, + async run({ $ }) { + const response = await this.app.forexLastTrade({ + $, + symbol: this.symbol, + }); + $.export("$summary", "Successfully retrieved the last trade for " + this.symbol); + return response; + }, +}; diff --git a/components/finage/actions/forex-previous-close/forex-previous-close.mjs b/components/finage/actions/forex-previous-close/forex-previous-close.mjs new file mode 100644 index 0000000000000..57a21791fbb39 --- /dev/null +++ b/components/finage/actions/forex-previous-close/forex-previous-close.mjs @@ -0,0 +1,26 @@ +import app from "../../finage.app.mjs"; + +export default { + key: "finage-forex-previous-close", + name: "Forex Previous Close", + description: "Get the previous close for the specified forex symbol. [See the documentation](https://finage.co.uk/docs/api/forex/forex-previous-close)", + version: "0.0.1", + type: "action", + props: { + app, + symbol: { + propDefinition: [ + app, + "symbol", + ], + }, + }, + async run({ $ }) { + const response = await this.app.forexPreviousClose({ + $, + symbol: this.symbol, + }); + $.export("$summary", "Successfully retrieved the previous close for " + this.symbol); + return response; + }, +}; diff --git a/components/finage/finage.app.mjs b/components/finage/finage.app.mjs index 3bb1cce1eab80..7ade671a239c1 100644 --- a/components/finage/finage.app.mjs +++ b/components/finage/finage.app.mjs @@ -1,11 +1,77 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "finage", - propDefinitions: {}, + propDefinitions: { + symbol: { + type: "string", + label: "symbol", + description: "Description for symbol", + async options() { + const response = await this.getSymbols(); + const symbols = response.symbols; + return symbols.map(({ + symbol, name, + }) => ({ + value: symbol, + label: name, + })); + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.finage.co.uk"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + path, + params, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl() + path, + params: { + apikey: `${this.$auth.api_key}`, + ...params, + }, + }); + }, + async forexLastQuote({ + symbol, + ...args + }) { + return this._makeRequest({ + path: `/last/forex/${symbol}`, + ...args, + }); + }, + async forexLastTrade({ + symbol, + ...args + }) { + return this._makeRequest({ + path: `/last/trade/forex/${symbol}`, + ...args, + }); + }, + async forexPreviousClose({ + symbol, + ...args + }) { + return this._makeRequest({ + path: `/agg/forex/prev-close/${symbol}`, + ...args, + }); + }, + async getSymbols(args = {}) { + return this._makeRequest({ + path: "/symbol-list/forex", + ...args, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/finage/package.json b/components/finage/package.json index f7538ee325b2a..a4d502a92e8a4 100644 --- a/components/finage/package.json +++ b/components/finage/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/finage", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Finage Components", "main": "finage.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cfc3a254fa106..535dd870525f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2934,8 +2934,7 @@ importers: specifier: ^3.0.0 version: 3.0.3 - components/cockpit: - specifiers: {} + components/cockpit: {} components/coda: dependencies: @@ -4943,7 +4942,11 @@ importers: specifier: ^1.1.1 version: 1.6.6 - components/finage: {} + components/finage: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/finalscout: dependencies: @@ -7085,8 +7088,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/instamojo: - specifiers: {} + components/instamojo: {} components/instant: {} @@ -7601,8 +7603,7 @@ importers: components/koala_ai: {} - components/kobotoolbox: - specifiers: {} + components/kobotoolbox: {} components/kodagpt: dependencies: @@ -11743,8 +11744,7 @@ importers: components/redmine: {} - components/reduct_video: - specifiers: {} + components/reduct_video: {} components/referral_rocket: {} @@ -13048,8 +13048,7 @@ importers: specifier: 1.6.0 version: 1.6.0 - components/shopware: - specifiers: {} + components/shopware: {} components/short: dependencies: @@ -13153,8 +13152,7 @@ importers: specifier: ^4.0.0 version: 4.0.1 - components/signl4: - specifiers: {} + components/signl4: {} components/signnow: dependencies: @@ -13859,8 +13857,7 @@ importers: components/streamwish: {} - components/strety: - specifiers: {} + components/strety: {} components/stripe: dependencies: @@ -30958,22 +30955,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please upgrade to superagent v10.2.2+, see release notes at https://github.com/forwardemail/superagent/releases/tag/v10.2.2 - maintenance is supported by Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net supports-color@10.0.0: resolution: {integrity: sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ==} @@ -38950,6 +38947,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: