This is my first question for HSM. If it is consider too specialized for HSM, perhaps it can be migrated to MathOverflow.
In algebraic number theory, one frequently denotes the ring of algebraic integers in a number field $K$ by $O_K$. Similarly in algebraic geometry, where one studies algebraic varieties and later schemes, it is common to denote the ring of regular functions over an open set $U$ by $O(U)$ or $\mathcal{O}(U)$, and similarly one often denotes the stalk at a point $p$ by something like $O_p$ or $\mathcal{O}_p$.
Where does this $O$ come from, or where was it first used? My best guess is that it originally had something to do with Order in commutative ring theory, starting primarily in algebraic number theory and later spilling over into algebraic geometry.
(I'm asking as a follow-up to a comment I made at MO here, where I explain a private pun I've developed to give a sense to O-notation as it is used in asymptotic analysis; I realized after making that comment that I had no idea where the notation $O$ in the sense of this question comes from.)