---
id: tra-paper
name: "TRA: Learning Multiple Stock Trading Patterns with Temporal Routing Adaptor and Optimal Transport"
summary: Introduces the Temporal Routing Adaptor, a router-plus-multi-predictor module trained with optimal-transport assignment so one backbone can model several trading patterns.
authors: [Hengxu Lin, Dong Zhou, Weiqing Liu, Jiang Bian]
origin: external
repo: https://github.com/microsoft/qlib/tree/main/examples/benchmarks/TRA
license: MIT
year: 2021
venue: KDD 2021
arxiv: "2106.12950"
doi: 10.1145/3447548.3467358
tags: [stock-prediction, deep-learning, optimal-transport, trading-patterns, qlib]
markets: [equities]
added: 2026-08-17
prerequisites:
  trading: moderate
  ai: advanced
  programming: moderate
  setup: advanced
builds_on: [qlib]
---

> Part of [Athenara](https://athenara.info/), the open registry for agentic trading.
> Index of everything: https://athenara.info/llms.txt · This entry: [HTML](https://athenara.info/papers/tra-paper/) · [JSON](https://athenara.info/api/v1/papers/tra-paper.json)

TRA attaches a router and a set of predictors to an existing stock-prediction backbone so that one
model can represent several distinct trading patterns instead of averaging them into a single
signal, with the assignment of samples to predictors learned as an optimal-transport
problem. Published at KDD 2021
(Proceedings of the 27th ACM SIGKDD Conference, pp. 1017–1026,
[doi:10.1145/3447548.3467358](https://doi.org/10.1145/3447548.3467358)).

The model is a first-class citizen of Microsoft Qlib rather than standalone research code: it lives
at `qlib/contrib/model/pytorch_tra.py` with configs under `examples/benchmarks/TRA/` for both the
Alpha158 and Alpha360 feature sets, and Qlib's public benchmark table reports its information
coefficient, annualized return and maximum drawdown alongside the platform's other models. Qlib is
MIT licensed and actively maintained, with its most recent commit in July 2026.

Two things to know before treating it as a reproduction target. The README section that reproduces
the paper is explicitly labelled "Usage (Not Maintained)" and its result table was generated by
`qlib==0.7.1`; the supported path is the `qlib.workflow` integration, whose current benchmark
numbers are not the paper's numbers and should not be mixed with them. And three of the four
authors are at Microsoft Research, the same organization that maintains Qlib, so the in-Qlib
benchmark is not third-party replication — the KDD acceptance is the independent signal.
