Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions components/finage/actions/forex-last-quote/forex-last-quote.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
26 changes: 26 additions & 0 deletions components/finage/actions/forex-last-trade/forex-last-trade.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
Original file line number Diff line number Diff line change
@@ -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;
},
};
76 changes: 71 additions & 5 deletions components/finage/finage.app.mjs
Original file line number Diff line number Diff line change
@@ -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,
});
},
},
};
};
5 changes: 4 additions & 1 deletion components/finage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/finage",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Finage Components",
"main": "finage.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
37 changes: 18 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading