Here is the flow
[
{
"id": "bc0911de95c8c5bb",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": "",
"env": []
},
{
"id": "ecf691ca347c5c68",
"type": "file",
"z": "bc0911de95c8c5bb",
"name": "TdV Scanner",
"filename": "/home/ubuntu/scan.py",
"filenameType": "str",
"appendNewline": false,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 510,
"y": 120,
"wires": [
[
"382912e733161884"
]
]
},
{
"id": "382912e733161884",
"type": "exec",
"z": "bc0911de95c8c5bb",
"command": "python3 /home/ubuntu/scan.py",
"addpay": "topic",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": true,
"oldrc": false,
"name": "TdV Scanner",
"x": 510,
"y": 160,
"wires": [
[
"2aaa1d8217c72a92"
],
[],
[]
]
},
{
"id": "772421ee4d545f11",
"type": "debug",
"z": "bc0911de95c8c5bb",
"name": "debug 30",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 240,
"wires": []
},
{
"id": "9dc8863bae5cd720",
"type": "template",
"z": "bc0911de95c8c5bb",
"name": "TdV Scanner",
"field": "payload",
"fieldType": "msg",
"format": "python",
"syntax": "plain",
"template": "\nfrom tradingview_screener import Query, Column\nfrom json import loads, dumps\n\nq = Query().select('name', 'close', 'change')\\\n .where(\n Column('close').between(1, 20),\n Column('change') > 100,\n\n )\\\n\nnum_rows, dataFrame = q.get_scanner_data()\n\n\njson_columns = dataFrame.to_json(orient ='records') \nprint(json_columns, \"\\n\")\n \n",
"output": "str",
"x": 270,
"y": 120,
"wires": [
[
"ecf691ca347c5c68"
]
]
},
{
"id": "ff081bc8414999a6",
"type": "inject",
"z": "bc0911de95c8c5bb",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 120,
"wires": [
[
"9dc8863bae5cd720"
]
]
},
{
"id": "2aaa1d8217c72a92",
"type": "json",
"z": "bc0911de95c8c5bb",
"name": "",
"property": "payload",
"action": "str",
"pretty": true,
"x": 510,
"y": 240,
"wires": [
[
"772421ee4d545f11"
]
]
}
]
And JSON node config: