8 min read • July 3, 2025
Behind every trading bot is a logic engine—and behind that engine is data. One of the most reliable and time-tested data formats in algorithmic trading is OHLCV: Open, High, Low, Close, Volume. Whether you're building a scalper, swing trader, or trend-following strategy, OHLCV data is the foundation of signal generation, backtesting, and real-time execution.
But not all OHLCV data is created equal. Some sources are delayed. Some lack volume. Others don’t normalize across asset classes.
In this tutorial, we’ll walk through how to use Finage’s OHLCV data API with Python to power your trading bots across Forex, stocks, and crypto. You’ll learn how to fetch, process, and apply this data format in a production-ready context.
If you’re serious about algorithmic trading, mastering OHLCV data is step one. Let’s get started—across all markets.
- What Is OHLCV and Why It Matters
- Finage’s OHLCV Coverage Across Assets
- Getting Historical Candle Data with the Finage API
- Using Python to Structure OHLCV for Analysis
- Feeding OHLCV Into Your Bot’s Logic
- Strategy Ideas Built on Candlestick Patterns
- Final Thoughts — Let the Data Drive Your Bot
OHLCV stands for Open, High, Low, Close, Volume—a format that summarizes market activity over a fixed interval. It's the standard input for most charting platforms, technical indicators, and automated trading strategies.
Each OHLCV entry provides:
- Open: The first price traded during the interval
- High: The highest price reached
- Low: The lowest price reached
- Close: The last price traded
- Volume: The total quantity traded
These five data points give you a compact but powerful view of market behavior. Instead of processing every tick, your trading bot can scan trends, detect momentum, or evaluate volatility with just a few data rows.
- Signal generation: Most technical indicators (like RSI, MACD, Bollinger Bands) rely on OHLCV inputs.
- Backtesting: Strategies need clean, time-indexed candle data to evaluate performance across different conditions.
- Cross-asset logic: Whether you’re trading BTC/USD, EUR/JPY, or TSLA, OHLCV structures stay consistent—making multi-asset bots possible.
- Efficiency: OHLCV data reduces the computational load compared to raw tick feeds while preserving key market patterns.
In short, OHLCV is what makes trading bots fast, interpretable, and scalable. But it only works if your data source is accurate, normalized, and truly historical—not reverse-engineered from recent ticks.
That’s where Finage delivers a clear edge.
One of the biggest advantages of using Finage is that it offers consistent OHLCV data across Forex, stocks, and crypto. This means you can use the same data structure, intervals, and request methods—no matter what your bot is trading.
- Stocks: Access daily, hourly, and intraday OHLCV data for major US markets, and global equity markets.
- Forex: Get candle data for popular currency pairs (e.g., EUR/USD, GBP/JPY) with high precision and time alignment.
- Crypto: Pull OHLCV data for tokens across Ethereum, BNB Chain, and other ecosystems—sourced from both centralized and decentralized exchanges.
Finage lets you query candles by interval, including:
- 1 minute
- 5 minutes
- 15 minutes
- 1 hour
- 1 day
- Custom ranges (via timestamp or date)
This flexibility is essential for building bots that operate on different strategies—from high-frequency momentum trading to long-term swing models.
All data is accessible via the historical candle API, and formatted for quick integration with Python libraries like pandas, numpy, or TA-Lib.
Because Finage standardizes the output across asset classes, your bot’s logic doesn’t need to be rewritten to accommodate new markets. Just swap the symbol—and the rest works the same.
One format, many markets. That’s how real trading systems scale.
To power your trading bot, the first step is retrieving historical OHLCV data. Finage makes this easy with a REST endpoint that supports a unified structure across assets.
You can use the Finage Historical Data API to fetch candles by symbol, interval, and date range. This applies to:
- Stock tickers (e.g., AAPL, TSLA)
- Forex pairs (e.g., EURUSD, GBPJPY)
- Crypto tokens (e.g., BTCUSD, ETHUSDT)
The response includes structured OHLCV data, timestamped for each interval you specify. All timestamps are returned in UTC, making it simple to align across markets.
The query allows you to specify:
- Symbol — Which asset you’re tracking
- Interval — Time granularity (e.g., 1m, 5m, 1h, 1d)
- Start/End — Date or timestamp range for historical data
- Limit — Number of candles to return per call
Once you have the response, it’s easy to load it into Python for further analysis or direct input into your bot’s decision logic.
A consistent historical feed is the backbone of strategy testing and real-time calibration.
Once you’ve retrieved OHLCV data from Finage, the next step is structuring it in Python. A well-organized data pipeline is critical for feeding indicators, running backtests, and executing trades.
After making your API request, parse the JSON and convert it into a pandas DataFrame. This allows easy indexing, slicing, and time-based operations.
Each row should include:
- Timestamp (in UTC or converted to local time)
- Open, High, Low, Close prices
- Volume
This structure enables compatibility with libraries like:
- pandas-ta for indicators
- backtrader for strategy simulation
- plotly or matplotlib for visualization
Indexing by timestamp lets you:
- Align multiple time series (e.g., price vs indicator)
- Resample or aggregate to different intervals
- Apply rolling windows for moving averages or volatility bands
Before pushing data into your bot’s logic:
- Remove NaNs or incomplete candles
- Check for timezone mismatches
- Validate against expected price ranges to avoid anomalies
Finage’s normalized feeds make this much easier by offering clean, gap-aware data straight from the source.
Structured data isn’t just for analysis—it’s how your bot sees the market clearly.
Once your OHLCV data is cleaned and structured, it’s time to plug it into the core of your trading bot: the logic engine that generates buy and sell decisions.
- Indicator-based signals
Use OHLCV to compute indicators like Moving Averages, RSI, MACD, or Bollinger Bands. For example, a bot might buy when the 20-period moving average crosses above the 50-period moving average.
- Pattern recognition
Bots can scan for candlestick patterns (e.g., hammer, engulfing) or volatility setups using OHLCV sequences. Python libraries like TA-Lib or pandas-ta make this process efficient.
- Volume-aware strategies
Volume data helps confirm breakouts, filter fake signals, or identify liquidity shifts. For crypto especially, detecting sudden volume spikes can be key.
- Multi-timeframe alignment
Analyze short-term (e.g., 5m) and long-term (e.g., 1h or 1d) OHLCV data simultaneously to avoid acting on noise.
Once the logic outputs a decision, your bot can:
- Execute via an exchange API
- Log the trade for performance review
- Update its state for the next interval
Because Finage offers consistent OHLCV formatting across asset types, this logic stays reusable whether you’re trading ETH/USD, EUR/USD, or TSLA.
Your bot is only as smart as the data it sees—and how clearly it interprets it.
Candlestick patterns are among the most popular tools in technical trading—and for good reason. They compress market psychology into a single bar and can be identified quickly using OHLCV data. For algorithmic trading bots, these patterns serve as simple but powerful triggers when paired with clear entry and exit rules.
Here are a few strategy concepts:
- Hammer / Inverted Hammer: Formed after a downtrend, suggesting a potential reversal.
- Shooting Star / Hanging Man: Signal weakness in an uptrend.
Your bot can detect these shapes by comparing open/close positions and the length of wicks relative to candle bodies.
- Three White Soldiers: Strong bullish continuation after consolidation.
- Falling Three Methods: A bearish continuation after a brief pause.
Useful when combined with trend-following indicators like moving averages.
- Use volume spikes along with engulfing candles or long-bodied bars to confirm breakout setups.
- Confirm that price closes above/below key resistance or support on higher volume.
- Track combinations over 2–5 candles for more complex patterns (e.g., Morning Star, Evening Star).
- Apply filters like average true range (ATR) to remove low-volatility setups.
These strategies can be applied to any market supported by Finage—crypto, Forex, or stocks—because all assets return clean OHLCV data.
Patterns give your bot a visual edge—even without seeing the chart.
Trading bots succeed when they’re built on consistent, high-quality data—and OHLCV is the format that ties strategy, speed, and signal together. From identifying entries to managing exits, bots rely on each candle to represent market truth. But that truth depends on where your data comes from.
That’s why developers building bots across multiple asset classes trust Finage.
With Forex, Crypto, and Stock OHLCV APIs, you get:
- Normalized, real-time and historical candles
- Clean data for accurate backtesting
- Fast, unified access across global markets
- Developer-friendly formatting for use in Python and automation scripts
Whether you’re scaling a bot network or just launching your first algorithm, Finage gives your logic the clarity, consistency, and breadth it needs to perform—across timeframes, symbols, and strategies.
The strategy is yours. Let Finage deliver the signal.
Access stock, forex and crypto market data with a free API key—no credit card required.
Stay Informed, Stay Ahead
Discover company news, announcements, updates, guides and more