Integration between stock Momentum and sentiment

Hello, i’m new to n8n and i would understand if possible to develop a workflow to trade stocks momentum and sentiment all in one code. I’m finding trouble how to integrate a Python script code on Anaconda environment and run backtesting using n8n. I use Interactive Brokers Api call for data and run backtesting using Anaconda environment, how can i integrate sentiment data and run backtest for the last year? In that way i can evaluate globally how sentiment data increase performance on Momentum.

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

To integrate Python scripts with n8n, you can use the **Code node** or **Execute Command node** to run your Python code directly within n8n. For sentiment analysis, consider using APIs like **Text Analytics API** or **Twitter API** to feed sentiment data into your workflow. For backtesting, you can use the **Function node** to process your Interactive Brokers data and combine it with sentiment analysis results.

Here’s a quick approach:

1. Use the **Code node** to run your Python script for momentum analysis.

2. Fetch sentiment data using an API and process it with the **HTTP Request node**.

3. Combine both datasets in the **Function node** for backtesting.

If you need to run your Anaconda environment, the **Execute Command node** can be used to trigger your Python scripts externally. Share your workflow JSON if you need more specific guidance!