Can anyone suggest a sample algorithm to:

  1. find a few some available Put Options near a target strike price & expiration date (e.g., SPY Mar17'17 Puts with 5 strike prices near $224.40)
  2. evaluate them and choose one (lowest bid/ask spread or lowest implied IV or highest return for a forecasted underlying price target)
  3. place order & buy it

Thanks in advance.  Either C# or python would be great.