Abstract. To each symplectic space $\Xi$ we associate a $C^*$-algebra ${\mathcal C}^\Xi$ graded by the lattice of all linear subspaces of $\Xi$. The hamiltonians of $N$-body systems in constant magnetic fields are affiliated to $C^*$-subalgebras of ${\mathcal C}^\Xi$ for certain choices of $\Xi$, and this allows one to study their spectral properties. The algebra generated by the hamiltonians corresponding to a fixed magnetic field can also be described as the crossed product of an abelian algebra (of classical potentials'') by the action of a non-abelian group. This point of view is generalized to the case of non-constant magnetic fields.