Skip to content

Commit a147d3d

Browse files
committed
updated the tests for historic quotes
1 parent 560d838 commit a147d3d

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

quote/client_test.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,20 @@ func TestHistoricalQuote(t *testing.T) {
2828

2929
assert.Nil(t, err)
3030
assert.NotNil(t, q)
31-
assert.Equal(t, 185.80 , q)
31+
high, _ := q.High.Float64()
32+
low, _ := q.Low.Float64()
33+
open, _ := q.Open.Float64()
34+
close, _ := q.Open.Float64()
35+
assert.Equal(t, 188.13999938964844, high)
36+
assert.Equal(t, 187.5500030517578, low)
37+
assert.Equal(t, 187.75, close)
38+
assert.Equal(t, 187.75, open)
39+
}
40+
41+
func TestBadSymbolBar(t *testing.T) {
42+
chart, err := GetHistoricalQuote("BADSYMBOL", 1, 11, 2018)
43+
assert.Nil(t, chart)
44+
assert.NotNil(t, err)
3245
}
3346

3447
func TestGetPostMarketQuote(t *testing.T) {

yfin.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,16 @@ type ChartBar struct {
249249
Timestamp int
250250
}
251251

252+
type OHLCHistoric struct {
253+
Open float64
254+
Low float64
255+
High float64
256+
Close float64
257+
AdjClose float64
258+
Volume int
259+
Timestamp int
260+
}
261+
252262
// ChartMeta is meta data associated with a chart response.
253263
type ChartMeta struct {
254264
Currency string `json:"currency"`

0 commit comments

Comments
 (0)