  By extending the gauge covariant magnetic perturbation theory to operators
defined on half-planes, we prove that for $2d$ random ergodic magnetic
Schr\"odinger operators, the celebrated bulk-edge correspondence can be
obtained from a general bulk-edge duality at positive temperature involving the
bulk magnetization and the total edge current.
  Our main result is encapsulated in a formula, which states that the
derivative of a large class of bulk partition functions with respect to the
external constant magnetic field, equals the expectation of a corresponding
edge distribution function of the velocity component which is parallel to the
edge. Neither spectral gaps, nor mobility gaps, nor topological arguments are
required.
  The equality between the bulk and edge indices, as stated by the conventional
bulk-edge correspondence, is obtained as a corollary of our purely analytical
arguments by imposing a gap condition and by taking a ``zero-temperature"
limit.
