I am currently creating an app that allows users to do algorithmic trading. In designing the front end, users are able to select which stocks they want to trade by their NASDAQ stock symbol, [NYSE stock symbol (http://eoddata.com/stocklist/NYSE/S.htm), or otherwise in a form view.
Given that listing out every possible stock symbol in an enum is rather difficult, I give users the option to enter their own symbols. However, I don’t want users entering symbols that are invalid, i.e. don’t belong to any particular company. For example AAPL is fine but something like AAPLXDT is not.
Is there a way to generate an error for invalid values “on the fly”, that is, as a user is entering a value into a form, it automatically checks against an established stock API using a REST call (or something along these lines) if the symbol is valid or not before the form is submitted?