/lib/DDG/Spice/Stocks.pm

https://github.com/pardocz/zeroclickinfo-spice · Perl · 28 lines · 18 code · 6 blank · 4 comment · 1 complexity · 5a3c754b4e8a5ca9ad87bc4b49c10e77 MD5 · raw file

  1. package DDG::Spice::Stocks;
  2. use DDG::Spice;
  3. primary_example_queries "AAPL";
  4. description "Shows stock quote for a ticker";
  5. name "Stocks";
  6. code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/Stocks.pm";
  7. icon_url "/i/ycharts.com.ico";
  8. topics "economy_and_finance";
  9. category "finance";
  10. # trigger is intentionally very specific, should trigger from internal view/deep triggers.
  11. # It's only here because I couldn't get the /js/stocks/ location to end up in generated nginx conf
  12. # unless I had at least some kind of trigger defined.
  13. triggers start => 'stock quote for', 'stock quote', 'stock price of', 'stock price';
  14. spice to => 'http://ycharts.com/quotes/$1';
  15. spice wrap_jsonp_callback => 1;
  16. spice proxy_cache_valid => "418 1d";
  17. handle remainder => sub {
  18. # needs to be uppercase when it goes to charts api:
  19. return uc $_ if $_;
  20. return;
  21. };
  22. 1;