Skip to content

Commit

Permalink
updated the tests for historic quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacks821 committed Dec 29, 2018
1 parent 560d838 commit a147d3d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
15 changes: 14 additions & 1 deletion quote/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@ func TestHistoricalQuote(t *testing.T) {

assert.Nil(t, err)
assert.NotNil(t, q)
assert.Equal(t, 185.80 , q)
high, _ := q.High.Float64()
low, _ := q.Low.Float64()
open, _ := q.Open.Float64()
close, _ := q.Open.Float64()
assert.Equal(t, 188.13999938964844, high)
assert.Equal(t, 187.5500030517578, low)
assert.Equal(t, 187.75, close)
assert.Equal(t, 187.75, open)
}

func TestBadSymbolBar(t *testing.T) {
chart, err := GetHistoricalQuote("BADSYMBOL", 1, 11, 2018)
assert.Nil(t, chart)
assert.NotNil(t, err)
}

func TestGetPostMarketQuote(t *testing.T) {
Expand Down
10 changes: 10 additions & 0 deletions yfin.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@ type ChartBar struct {
Timestamp int
}

type OHLCHistoric struct {
Open float64
Low float64
High float64
Close float64
AdjClose float64
Volume int
Timestamp int
}

// ChartMeta is meta data associated with a chart response.
type ChartMeta struct {
Currency string `json:"currency"`
Expand Down

0 comments on commit a147d3d

Please sign in to comment.