Cohomological and K-theoretic stable bases originated from the study of quantum cohomology and quantum K-theory. Restriction formula for cohomological stable bases played an important role in computing the quantum connection of cotangent bundle of partial flag varieties. In this paper we study the K-theoretic stable bases of cotangent bundles of flag varieties. We describe these bases in terms of the action of the affine Hecke algebra and the twisted group algebra of Kostant-Kumar. Using this algebraic description and the method of root polynomials, we give a restriction formula of the stable bases. We apply it to obtain the restriction formula for partial flag varieties. We also build a relation between the stable basis and the Casselman basis in the principal series representations of the Langlands dual group. As an application, we give a closed formula for the transition matrix between Casselman basis and the characteristic functions.