Urgent.News

What's breaking now, across thousands of outlets.

Tech

How I built a trade analytics dashboard with Streamlit and Plotly — and turned it into a product

I'm an AI/ML student and I build Streamlit dashboards as a freelancer on the side. A few weeks ago I was working on a trade analytics project and realized I was writing the same landed cost logic, currency conversion and chart code from scratch — again. So I packaged what I built into a proper boilerplate. Here's how it works and what I learned. What the dashboard does LandedIQ calculates trade…

The author is an AI/ML student who builds Streamlit dashboards as a freelancer. They encountered repetitive code during a trade analytics project and decided to create a boilerplate to streamline the process. This dashboard, LandedIQ, calculates trade unit economics - landed cost, net profit, and margin - instantly. It supports live USD ↔ INR conversions via ExchangeRate-API, with an offline fallback. Users can upload their CSV product databases with zero code changes.

The project uses Python 3.11, Streamlit 1.35, Plotly 5.18, Pandas 2.0, and Requests. It's recommended not to use Streamlit ECharts, as it breaks on Python 3.13. Plotly works seamlessly across all Python versions. The code is organized into modules: app.py, components/, data/, and utils/. This modular structure makes the code easier to maintain and test.

Each chart is a pure function that returns a Plotly figure, which can be tested independently. The currency conversion API gets called on every rerender if not cached. To avoid this, the code uses the @st.cache_data decorator with a 1-hour Time-To-Live (ttl). If the API fails, it returns a hard-coded fallback of 83.50.

The dashboard was deployed on Railway, but Streamlit needed to be manually set as the start command: streamlit run app.py --server.port $PORT --server.address 0.0.0.0. The author cleaned up the code, added a PDF setup guide, and listed the boilerplate on Gumroad and Contra. The live demo is available at landediq-production.up.railway.app.

The full boilerplate is accessible for those who want to customize it for their own use case. The author advises starting with Plotly, setting up the module structure from the beginning, and writing the .env.example file before forgetting API keys.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

AWS Lambda Durable Functions and the Replay Bug in Human-in-the-Loop Agents

Ciao 👋 Here is a sentence that should not be possible: my workflow executed an action a human explicitly did not approve.

  • AWS Lambda durable functions enable long-running workflows with human input.
  • Replay bug causes unexpected behavior when agent proposal is outside a step.
  • Properly structuring code within steps prevents replay bug issues.

containerd 2.2's mount manager panics on a one-mount mkfs chain

containerd 2.2 shipped a mount manager: a service that can format a file as ext4 or xfs, attach it as a loopback device, and hand the result to a runtime, all from a single Activate call instead of…

  • Containerd 2.2 mount manager service introduced
  • Manual sequence faster than mount manager's Activate call
  • Mount manager panics, leaks resources

More from Sunday 27 September →