NelsonDane / fennel-invest-api

Unofficial reverse-engineered Fennel.com Invest app API written in Python Requests
MIT License
12 stars 3 forks source link

get_stock_quote() and get_stock_price() added to Fennel class #9

Closed Cfomodz closed 3 months ago

Cfomodz commented 4 months ago

Get stock "quote"/query results and a helper function to just directly return price from that same search

deepsource-io[bot] commented 4 months ago

Here's the code health analysis summary for commits d32b69d..5bda787. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.
NelsonDane commented 4 months ago

Thanks for the PR! Your two functions look great, I just have a few requests/suggestions:

  1. The place_order function has a section that can be replaced by your get_stock_quote function, it would be great if you could replace that.
  2. You'll also notice that there is a check on the length of returned stocks in the place_order function. That is because I've found that Fennel will return a 200 code even when searching for a stock that doesn't exist, it just won't return any info in the returned list. Adding the length check to your get_stock_quote would protect against that. Then if it occurs you could return 0 or None in the get_stock_price function.

Hope this makes sense, and feel free to suggest other ways/ideas if you find come up with something better!

Cfomodz commented 4 months ago

Great thoughts! I also realized I forgot to include the modified endpoint, so I will make the suggested changes and push that

NelsonDane commented 3 months ago

I just tested this out and it works great! Thanks so much for the contribution!