We give a proof of the parabolic/singular Koszul duality for the category O of affine Kac–Moodyalgebras. The main new tool is a relation between moment graphs and finite codimensional affine Schubert varieties. We apply this duality to q-Schur algebras and to cyclotomic rational double affine Heckealgebras.This yields a proof of a conjecture of Chuang–Miyachi relating the level-rank duality with the Ringel–Koszul duality of cyclotomic rational double affine Hecke algebras.