
clif.dev docs
Level up: lookup command
In the Get started quickly article, you created the clif
CLI and implemented a simple command clif hello
. In this article, you're going to build three new commands:
clif lookup
clif login
clif logout
clif lookup
will lookup a stock ticker's price over a specified number of days, like this:
$ clif lookup AAPL --from 2022-06-01 --to 2022-06-06
┌────────────┬────────────────┐
│ Date │ Closing Price │
├────────────┼────────────────┤
│ 06/01/2022 │ $148.71 │
├────────────┼────────────────┤
│ 06/02/2022 │ $151.21 │
├────────────┼────────────────┤
│ 06/03/2022 │ $145.38 │
├────────────┼────────────────┤
│ 06/06/2022 │ $146.14 │
└────────────┴────────────────┘
In order to do retrieve actual stock prices via clif lookup
, the 3rd party Polygon.io API (which provides stock market data) will be called, which means your CLI program will need to make authenticated API calls. That's why you'll also implement clif login
and clif logout
: to help your user with that authentication.