Skip to content

Commit

Permalink
Fix panic in (*CreateOrderRequest).String()
Browse files Browse the repository at this point in the history
  • Loading branch information
ammario committed Apr 19, 2023
1 parent 6af1898 commit cc94f31
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ func (c *CreateOrderRequest) String() string {
} else {
price = c.NoPrice
}
expire := "never"
if c.Expiration != nil {
expire = fmt.Sprintf("in %v", time.Until(c.Expiration.Time()))
}
return fmt.Sprintf(
"%v %v %v at %v cents, expires in %v, max cost is %v",
c.Action, c.Count, strings.ToUpper(string(c.Side)), price, time.Until(c.Expiration.Time()), c.BuyMaxCost,
"%v %v %v at %v, expires %s, max cost is %v",
c.Action, c.Count, strings.ToUpper(string(c.Side)), price, expire, c.BuyMaxCost,
)
}

Expand Down

0 comments on commit cc94f31

Please sign in to comment.