WiFi Stock Ticker
ESP32 DevKit (WROOM-32)·Arduino C++·Updated Jul 27, 2026·by FluxBench TeamIncludes Lab + Schematic
Connects to WiFi, fetches a live stock quote over HTTP and shows the price and daily change on a 128x64 OLED. In the simulator there is no real network: WiFi "connects" after about a second with a fake IP address, and the Yahoo Finance URL returns realistic simulated quote JSON, so you can watch the whole connect-fetch-parse-display flow work end to end. The sketch parses the JSON by hand with indexOf/substring - no ArduinoJson needed. On real hardware, just set your own WiFi name and password at the top.
sketch.ino
// WiFi Stock Ticker - fetches a live quote and shows price + change on an OLED.
// In the FluxBench simulator, WiFi "connects" after about a second with a fake IP
// and the Yahoo Finance URL returns simulated quote JSON, so you can watch the
// whole flow work without hardware. On a real ESP32, set your own WiFi below.
#include <WiFi.h>
#include <HTTPClient.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
const char* WIFI_SSID = "YourNetwork";
const char* WIFI_PASS = "YourPassword";
const char* QUOTE_URL = "https://query1.finance.yahoo.com/v8/finance/chart/QQQ?interval=1d&range=1d";
Adafruit_SSD1306 display(128, 64, &Wire, -1);
unsigned long lastFetch = 0;
float readNumber(String body, String key) {
int k = body.indexOf(key);
if (k < 0) return 0.0;
int colon = body.indexOf(":", k);
int comma = body.indexOf(",", colon);
if (comma < 0) comma = body.indexOf("}", colon);
return body.substring(colon + 1, comma).toFloat();
}
void setup() {
Serial.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.println("Connecting WiFi...");
display.display();
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) {
delay(250);
Serial.print(".");
}
Serial.println();
Serial.print("Connected! IP: ");
Serial.println(WiFi.localIP());
}
void loop() {
if (millis() - lastFetch >= 5000 || lastFetch == 0) {
lastFetch = millis();
HTTPClient http;
http.begin(QUOTE_URL);
int code = http.GET();
if (code == 200) {
String body = http.getString();
float price = readNumber(body, "regularMarketPrice");
float prev = readNumber(body, "previousClose");
float change = price - prev;
float pct = prev > 0 ? change / prev * 100.0 : 0.0;
Serial.print("QQQ ");
Serial.print(price);
Serial.print(" change ");
Serial.println(change);
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.println("QQQ (Nasdaq-100)");
display.setTextSize(2);
display.setCursor(0, 16);
display.print("$");
display.println(price);
display.setTextSize(1);
display.setCursor(0, 40);
if (change >= 0) display.print("+");
display.print(change);
display.print(" (");
if (pct >= 0) display.print("+");
display.print(pct);
display.println("%)");
display.setCursor(0, 54);
display.print("IP ");
display.print(WiFi.localIP());
display.display();
} else {
Serial.print("HTTP error ");
Serial.println(code);
}
http.end();
}
delay(50);
}Built with FluxBench.AI — the AI workbench for embedded projects.