12. Use Case: Automated Quantitative & Sentiment Dashboard
💡 Quick Start: Don't want to wire nodes from scratch? You can directly download the finished example file here: 📥 Download "Automated Quantitative & Sentiment Dashboard" Example (stock.mldoc.zip)
After downloading, double-click the file or drag it into the MindLogic client to run and test it immediately.
In this chapter, we will perfectly integrate MindLogic's core killer features—Network Request Plugins, AI LLM Plugins, and the Powerful Native Chart Engine—to build a visually striking and highly practical real-world business scenario: "Automated Crypto/Stock Quantitative & Sentiment Monitoring Dashboard".
This workflow is fully automated. After a single click to run, the raw data stream will branch off into two separate tracks: "Pure Mathematical Calculation" and "AI Semantic Analysis", which eventually merge into a dynamic dashboard and an investment decision.
1. Architecture Overview
We will create a network containing 6 core nodes (forming a perfectly symmetrical pipeline structure):
- Data Source (Root Node): Fetch price and news data.
- Data Flow Branch A (Technical): Data Source -> Volume Bar Chart Node -> Price Line Chart Node.
- Data Flow Branch B (Sentiment): Data Source -> AI Sentiment Node -> Sentiment Heatmap Node.
- Final Decision Hub: Combine the Price Dashboard and Sentiment Heatmap to output
[BUY],[HOLD], or[SELL]signals.
2. Node 1: Data Source (HTTP Request Plugin)
First, we create a node and use the official built-in HTTP Request plugin to fetch market data from Yahoo Finance's open API. Since MindLogic's underlying JavaScript engine does not support the native browser fetch function, all network requests must be securely routed through the dedicated plugin system (which supports proxies, retries, and sandbox isolation).
- Select Plugin: Select the newly created node, expand "Plugin" at the bottom of the right Inspector panel, and choose HTTP Request from the dropdown menu.
- Configure Parameters: In the plugin input fields that appear, enter the Yahoo Finance chart API address into the API URL:
https://query1.finance.yahoo.com/v8/finance/chart/BTC-USD?interval=1d&range=7d - Write Cleaning Script: After the plugin successfully makes the background request, it will automatically save the raw data into the current node's
outputs['response']variable. To convert this cryptic nested array into a standard JSON object for downstream charts, we enter the following cleaning logic into the Entity Script at the very bottom of the node:
// 1. Get the raw JSON string automatically saved by the HTTP plugin into the 'response' variable
let rawDataStr = node.outputs['response'];
if (!rawDataStr) return;
let json = JSON.parse(rawDataStr);
let result = json.chart.result[0];
let timestamps = result.timestamp;
let quotes = result.indicators.quote[0];
// 2. Yahoo Finance returns timestamps + quotes arrays; map into JSON with named keys
let history = timestamps.map((ts, i) => {
let dateObj = new Date(ts * 1000);
let dateStr = (dateObj.getMonth() + 1) + "-" + dateObj.getDate();
return {
date: dateStr,
price: Math.round(quotes.close[i] * 100) / 100,
volume: Math.round(quotes.volume[i])
};
});
// 3. Simulate some concurrent news headlines (in a real scenario, fetch via a NewsAPI node)
let mockNews = [
"SEC delays ETF decision, market panics.",
"Large holder sells 10k BTC on exchange.",
"Fed indicates rate hikes, crypto bleeds.",
"Market stabilization, fear remains high.",
"Institutions buying the dip secretly.",
"Major bank announces Bitcoin integration!",
"Bull market resumes, retail FOMO kicks in."
];
for(let i=0; i<history.length; i++) {
if (mockNews[i]) history[i].news = mockNews[i];
}
// 4. Pass the cleaned result downstream as the current node's Payload
outputs.history = history;
outputs.news = mockNews;
node.title = 'get stock data';
When this code executes, the system will first dispatch the HTTP plugin to make the real underlying network request, immediately followed by executing the cleaning script above. Yahoo Finance API requires no authentication and is globally accessible. The final, clean structured JSON data will be automatically output to downstream nodes.
3. Branch A Node 1: Volume Bar Chart
Draw the first downstream connection from the initial "Data Source" node to create a node specifically for rendering trading volume. Since it is in the middle of the data pipeline, we must pass the raw data downstream after drawing the chart.
- Set the node's Content Type to Chart.
- The Entity Script is as follows:
let history = inputs[0].history;
outputs.history = history; // CRITICAL: Pass data downstream to the Price Line Chart node
let series = [];
for (let i = 0; i < history.length; i++) {
let day = history[i];
// Specifically draw the volume bar chart
series.push({
x: day.date,
y: day.volume,
category: "Volume",
type: "bar"
});
}
node.contentType = 'chart';
node.contentPayload = {
chartType: "bar",
series: series
};
4. Branch A Node 2: Pure Price Line Chart (Relay)
Draw a connection from the "Volume Bar Chart" node just created to create the "Price Dashboard" node.
Thanks to the pass-through from the previous node, we still have access to the complete history data here. We will remove the 0-based volume interference and purely draw the price line chart, perfectly activating the underlying adaptive Y-axis scaling so that even tiny trend fluctuations are visible at a glance.
- Set the Content Type to Chart.
- Script code:
// Get historical data passed from the upstream (Volume) node
let history = inputs[0].history;
let series = [];
let sumPrice = 0;
for (let i = 0; i < history.length; i++) {
let day = history[i];
sumPrice += day.price;
// Keep only the main axis: Price Line Chart
series.push({
x: day.date,
y: day.price,
category: "Price",
type: "line"
});
}
// Calculate the 7-day moving average
let averagePrice = sumPrice / history.length;
outputs.averagePrice = averagePrice;
outputs.latestPrice = history[6].price;
// Add a baseline reference rule
series.push({
x: "10-07", // The reference line spans the entire chart, x-axis can be any existing value
y: averagePrice,
category: "7-Day Moving Average",
type: "rule"
});
// Build the standard Chart Payload
node.contentPayload = {
chartType: "line", // Default chart type
series: series
};
Upon execution, your canvas will display a magnificent price trend chart.
5. Branch B Node 1: AI Sentiment Score (LLM Plugin)
Return to the initial "Data Source" node and draw another entirely new connection to create the "AI Sentiment" node.
- Bind AI Plugin: Bind a Large Language Model plugin to the node.
- Build Prompt: In the plugin's User Prompt input field, enter:
Please analyze the following news data from the past 7 days:
{ news }
Score the market sentiment for each day (ranging from -10 to 10, where -10 is extreme fear and 10 is extreme greed).
You must strictly output a JSON array format and do not include any markdown tags or explanatory text. Example format:
[
{"date": "10-01", "score": -8},
{"date": "10-02", "score": 5}
]
6. Branch B Node 2: Sentiment Heatmap
Draw a downstream connection from the "AI Sentiment" node just created, to parse the pure JSON data output by the LLM and render it into a heatmap:
// Get the JSON string generated by the upstream LLM node
let resultText = inputs[0].result;
if (!resultText) return;
// Clean up any potential markdown tags
let jsonMatch = resultText.match(/\[.*\]/s);
if (!jsonMatch) return;
let sentimentScores = JSON.parse(jsonMatch[0]);
let series = sentimentScores.map(item => ({
x: item.date,
y: item.score,
category: "Sentiment"
}));
// Render the heatmap
node.contentType = "chart";
node.contentPayload = {
chartType: "heatmap",
series: series
};
// Extract the latest day's sentiment score and pass it to the final decision node
outputs.Sentiment = sentimentScores[6].score;
Upon execution, the red-and-green heatmap intuitively displays the reversal of market sentiment.
7. Final Decision Hub (Logic Judgement)
Finally, we connect the terminal nodes of both branches—the "Price Dashboard" and the "Sentiment Heatmap"—simultaneously to a final node: "Investment Decision".
let ma7 = averagePrice;
let latestSentiment = Sentiment;
if (latestPrice < ma7 && latestSentiment < -5) {
node.title = "🟢 [BUY SIGNAL] Price is below MA, and market is in extreme fear. Golden opportunity.";
} else if (latestPrice > ma7 && latestSentiment > 5) {
node.title = "🔴 [SELL SIGNAL] Price is overvalued, market is in extreme greed. Take profits.";
} else {
node.title = "⚪ [HOLD SIGNAL] Trend is unclear, recommend waiting.";
}
node.contentType = 'markdown';
Summary
This showcases MindLogic's core capability: Transforming static text nodes into a super engine capable of pulling network data, invoking AI reasoning, handling complex mathematical branches, and ultimately rendering commercial-grade visual dashboards.
