Skip to content

Commit

Permalink
Fixed region issue, added error handling for faulty data feed for som…
Browse files Browse the repository at this point in the history
…e stock symbols like APPL
  • Loading branch information
Tan committed Jun 30, 2020
1 parent ef79b41 commit 69d5394
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion processors/GetIntradayPrices/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const axios = require('axios');
const moment = require("moment-timezone");
require("isomorphic-fetch");

AWS.config.update({region: "eu-west-1"});
AWS.config.update({region: configExports.appsync_region});

const getBackendTokens = async(sm) => {
const idp = new AWS.CognitoIdentityServiceProvider();
Expand Down Expand Up @@ -51,6 +51,8 @@ const getPrices = async(apiKey, symbol) => {
if ("Note" in data) {
console.log("["+symbol+"] Rate limit exceeded, skipping request");
return [];
} else if ("Error Message" in data) {
return [];
} else {
const metadata = data["Meta Data"];
const timezone = metadata["6. Time Zone"];
Expand Down

0 comments on commit 69d5394

Please sign in to comment.