Equity research with QuantConnect, QuantRocket, and StockSharp

An equity research platform must show which instruments and fields were available when the strategy made its decision. QuantConnect offers LEAN’s event-based workflow and a research environment. QuantRocket’s Moonshot uses a vectorized, pandas-based model for cross-sectional research. StockSharp API replays stored market data through HistoryEmulationConnector. All three workflows need dated universe membership and a consistent corporate-action policy.

Research step QuantConnect / LEAN QuantRocket / Moonshot StockSharp API
Choose the universe Define a daily universe or import dated membership. Record when the universe callback sees current inputs. Select the securities and database for the price matrix. Keep a dated eligibility mask alongside the factors. Load daily membership as a separate dataset. Map stable vendor IDs to SecurityId and update eligibility when the membership data becomes available.
Normalize prices Choose the equity normalization mode and verify splits and cash dividends in a test window. Document the database adjustment policy and how factor values join to security identifiers on each date. Record the adjustment policy for imported prices. Verify how splits and cash dividends affect portfolio returns.
Execute the same signal Log the event time and first permitted fill. Check that sizing uses the expected portfolio state. Align factor calculation and trade weights with timestamps. Test explicitly that a target position only earns returns after it can be entered. Replay the same period through HistoryEmulationConnector. Check the signal time, the first allowed fill and the change in position.

QuantConnect universe settings · QuantConnect fundamental universes · QuantRocket Moonshot workflow · StockSharp historical testing

Check a delisting day before comparing speed

Take three symbols and record their eligibility at the beginning of each period. Retain the final return of any removed stock if it is held at the start of that period. Save row counts, a stable instrument identifier, eligibility timestamps and the treatment of a missing last price before scaling. Comparing today’s surviving symbols against the original historical universe measures an input selection difference.

Screenshots and examples

Backtest results and equity curve
QuantConnect · Backtest results and equity curve Source
Moonshot backtest output from the QuantRocket notebook
QuantRocket · Moonshot backtest output from the QuantRocket notebook Source

Rebalance two universes on the same synthetic dates

Equity returns with historical membership or current survivors

Equal-weight return averages over the universe available at the decision time. Compound the daily returns.
Results from the example
DayHistorical universeCurrent survivorsHistorical day, %Survivor day, %Historical cumulative, %Survivor cumulative, %
D1 3 2 1.3333 1.5 1.3333 1.5
D2 3 2 -8.3333 1.5 -7.1111 3.0225
D3 2 2 -0.5 -0.5 -7.5756 2.5074
Cumulative returns under two universe definitions StockSharp JS-Charts

The three synthetic sessions start equally weighted across available symbols each day. A, B and C begin in the historical universe. B returns −28% on D2 and is absent at the start of D3. The retrospective version uses only A and C from the beginning. On D2, the historical portfolio loses 8.3333%, while the survivor portfolio gains 1.5%. After compounding, the totals are −7.5756% and +2.5074%. The fixture omits fees and uses simple daily returns.

Match the first differing row across reports

Print the security set, factors and expected order for the first differing date. Check whether any run used information published after the decision. If the last price or delisting cash flow is missing, record the exact data policy and reconcile it independently.

Reproduce the result in Python

import json
from decimal import Decimal as D


def percent(value):
    return round(float(100 * value), 4)


def run():
    sessions = [
        ("D1", {"A": D("0.02"), "B": D("0.01"), "C": D("0.01")}),
        ("D2", {"A": D("0.01"), "B": D("-0.28"), "C": D("0.02")}),
        ("D3", {"A": D("0"), "C": D("-0.01")}),
    ]
    survivors = {"A", "C"}
    historical_nav = current_nav = D(1)
    rows = []
    for day, returns in sessions:
        recent = [returns[symbol] for symbol in sorted(survivors & returns.keys())]
        past_r = sum(returns.values()) / len(returns)
        recent_r = sum(recent) / len(recent)
        historical_nav *= 1 + past_r
        current_nav *= 1 + recent_r
        rows.append([day, len(returns), len(recent), percent(past_r), percent(recent_r),
                     percent(historical_nav - 1), percent(current_nav - 1)])

    assert rows[1][3:5] == [-8.3333, 1.5]
    assert rows[-1][5:] == [-7.5756, 2.5074]
    return rows


if __name__ == "__main__":
    print(json.dumps(run()))

Change B’s last return and rerun. Keep point-in-time eligibility separate from current security status in future sweeps. Look-ahead bias acceptance checks · Split training and testing periods in order.