Skip to content

Commit

Permalink
Merge pull request #22 from pallotron/master
Browse files Browse the repository at this point in the history
Actually return an error for unknown symbol
  • Loading branch information
ackleymi committed May 8, 2023
2 parents 0545f78 + 75e947a commit c2477f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quote/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package quote

import (
"context"
"fmt"
"strings"

finance "github.com/piquette/finance-go"
Expand Down Expand Up @@ -62,6 +63,10 @@ func GetHistoricalQuote(symbol string, month int, day int, year int) (*finance.C
func Get(symbol string) (*finance.Quote, error) {
i := List([]string{symbol})

if i.Count() == 0 {
return nil, fmt.Errorf("Can't find quote for symbol: %s", symbol)
}

if !i.Next() {
return nil, i.Err()
}
Expand Down

0 comments on commit c2477f7

Please sign in to comment.