Skip to content

Instantly share code, notes, and snippets.

View byBobo's full-sized avatar
🕯️
I’m having a hard time; I’m preparing my next mistake.

Bobo byBobo

🕯️
I’m having a hard time; I’m preparing my next mistake.
  • Bra (CN) - Italy
View GitHub Profile
[{"id":"bf60b8.b136b748","type":"http request","z":"5f0a7d11.3d2dd4","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://www.freeforexapi.com/api/live?pairs={{payload.from}}{{payload.to}}","tls":"","persist":false,"proxy":"","authType":"","x":430,"y":760,"wires":[["759fac8f.720bd4","10c356bd.29f009"]]},{"id":"10c356bd.29f009","type":"function","z":"5f0a7d11.3d2dd4","name":"","func":"const value = flow.get(\"value\");\nconst from = flow.get(\"from\");\nconst to = flow.get(\"to\");\n\nconst rates = msg.payload.rates;\nconst pair = from + to;\n\n\nconst rate = rates[pair].rate;\nconst result = value * rate;\n\nmsg.payload.result = result;\nmsg.payload.value = value;\nmsg.payload.message = `${value} ${from} = ${result.toFixed(2)} ${to}`\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":740,"wires":[["2d5a9fbd.c7d008"]]},{"id":"759fac8f.720bd4","type":"debug","z":"5f0a7d11.3d2dd4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"pa