Bitcoin Arbitrage Function

I have tried implementing the bitcoin arbitrage skill using alexa with the following code, but the SetSpreadIntent doesn’t seem to be working fine

“use strict”;
var Alexa=require(“alexa-sdk”);
var AWS=require(“aws-sdk”);
const cheerioReq=require(“cheerio-req”);
var CmeValue,CmeDate,CboeValue,CboeDate,Price;
const https=require(“https”);
var ddb=new AWS.DynamoDB({apiVersion:‘2012-10-08’});
exports.handler=function(event,context,callback){
var alexa=Alexa.handler(event,context,callback);
alexa.registerHandlers(Handler);
alexa.execute();
};

var Handler={
“LaunchRequest”:function(){
if(!this.event.session.user.accessToken){
this.emit(’:tellWithLinkAccountCard’,“For a better experience, please link your account through the link account card sent to your home section”);
}else{
this.emit(":askWithCard",“Hi, you can ask me the current bitcoin arbitrage”,“Hi, you can get information about the current bitcoin arbitrage or you can set a mail alert”,“Bitcoin Skill”,“Hi, say get info or mail me and specify the required value in dollars”);
}
},
“SpotPriceIntent”:function(){
cheerioReq(“https://coinmarketcap.com/currencies/bitcoin/",(err,$)=>{
if(err){CboeValue=“error”}
Price=$(”#quote_price > span.h2.text-semi-bold").text();
});

cheerioReq(“http://quotes.ino.com/exchanges/contracts.html?r=CME_BTC",(err,$)=>{
if(err){CmeValue=“error”}
CmeValue = $(”#col-main > div.table-responsive tr > td:nth-of-type(6) “).text().slice(0,4);
CmeValue = parseInt(CmeValue,10);
console.log(CmeValue);
CmeDate = $(”#col-main > div.table-responsive tr > td:nth-of-type(2)").text().slice(0,8);
console.log(CmeDate);
});

cheerioReq(“http://cfe.cboe.com/cfe-products/xbt-cboe-bitcoin-futures",(err,$)=>{
if(err){CboeValue=“error”}
CboeValue = $(”#itemPlaceholderContainer1 > tr:nth-of-type(3) > td:nth-of-type(3)").text();
CboeValue = parseInt(CboeValue , 10);
CboeDate = $("#itemPlaceholderContainer1 > tr:nth-of-type(3) > td:nth-of-type(2)").text();
});

let CmeDiff=CmeValue-Price;
let CboeDiff=CboeValue-Price;
let GranDiff=CmeValue-CboeValue;

let CmeSign=CmeDiff>0?“above”:“below”;
CmeDiff=Math.trunc(Math.abs(CmeDiff));

let CboeSign=CboeDiff>0?“above”:“below”;
CboeDiff=Math.trunc(Math.abs(CboeDiff));

let GranSign=GranDiff>0?“above”:“below”;
GranDiff=Math.trunc(Math.abs(GranDiff));

if(Price==undefined){
this.emit(’:ask’,“Please try again”);
}

let Cmemonth=CmeDate.slice(3);
this.emit(’:ask’,"The Bitcoin Price is " + Price + " dollars. The " + CmeDate + " Bitcoin Futures contract on the CME is trading at " + CmeValue + " dollars. This is " + CmeDiff + " dollars " + CmeSign + " the Spot Bitcoin price. The " + CboeDate + " expiring Bitcoin Futures contract on the C.B.O.E is trading at " + CboeValue + " dollars. This is " + CboeDiff + " dollars " + CboeSign + " the Spot Bitcoin price. The " + Cmemonth + " Bitcoin Futures contract on the CME is trading at " + GranDiff + “dollars " + GranSign + “the C.B.O.E Bitcoin Futures contract. Would you like to set a mail alert”);
},
“SetSpreadIntent”:function(){
let content=this;
let Email;
if(!this.event.session.user.accessToken){
this.emit(’:tellWithCard’,“For a better experience, please link your account”,“Account Linking”,“For a better experience, please link your account”,“For a better experience, please link your account”);
}else{
var Spread=this.event.request.intent.slots.Spread.value;
var UserId=this.event.session.user.userId;
var AccessToken=this.event.session.user.accessToken;
const url=“https://api.amazon.com/user/profile?access_token= " + AccessToken;
https.get(url,res=>{
res.setEncoding(“utf8”);
var body=””;
res.on(“data”,data=>{
body+=data;
console.log(body);
});
res.on(“end”,()=>{
let body1=JSON.parse(body);
Email=body1.email;
console.log(Email);
var params={
TableName:‘UserDatabase’,
Item:{
‘Spread’:{N:Spread},
‘UserId’:{S:UserId},
‘PlaceHolder’:{S:‘same’},
‘EmailId’:{S:Email}
}
};
ddb.putItem(params,function(err,data){
if(err){
console.log(“Error”,err);
}else{
console.log(“Success”,data);
}
});
if(Email==undefined){
this.emit(’:ask’,“Please try again”);
}
content.emit(’:tellWithCard’,“A mail will be sent to your amazon account " + Email + " when the arbitrage crosses " + Spread + " dollars”,“Mail Alert”,“A mail will be sent to your amazon account " + Email + " when the arbitrage crosses " + Spread + " dollars”);
});
});
}
},
“AMAZON.YesIntent”:function(){
this.emit(’:ask’,“To set a mail alert say mail me and specify your required value in dollars”);
},
“AMAZON.NoIntent”:function(){
this.emit(’:tell’,“Ok, Catch you later”);
},
“AMAZON.CancelIntent”:function(){
this.emit(’:tell’,“Thank You”);
},
“AMAZON.StopIntent”:function(){
this.emit(’:tell’,“Thank You”);
},
“AMAZON.HelpIntent”:function(){
this.emit(’:ask’,“For querying about the current bitcoin arbitrage, ask what is the current bitcoin arbitrage, For setting a mail alert say mail me and specify the required value in dollars, would you like to set a mail alert”);
},
“Unhandled”:function(){
this.emit(’:ask’,“Sorry, I didn’t get that, to know the current bitcoin arbitrage, ask what is the current bitcoin arbitrage, To set a mail alert say mail me and specify the required value in dollars, would you like to set a mail alert”);
}
};