go-finance icon indicating copy to clipboard operation
go-finance copied to clipboard

'index out of range' for basic GetQuote example

Open davemachado opened this issue 7 years ago • 6 comments

main.go:

package main

import (
    "fmt"

    finance "github.com/FlashBoys/go-finance"
)

func main() {
    // 15-min delayed full quote for Apple.
    q, err := finance.GetQuote("AAPL")
    if err == nil {
        fmt.Println(q)
    }
}
$ go run main.go
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/FlashBoys/go-finance.mapFields(0xc42015a120, 0x3, 0x3, 0x29, 0x122b0c0, 0xc420035c00)
	/go/src/github.com/FlashBoys/go-finance/fields.go:28 +0x737
github.com/FlashBoys/go-finance.GetQuote(0x1294dfd, 0x4, 0x50, 0xc42007cc60, 0xc42008c8c0, 0x8, 0xc4200532f0, 0x11f3298, 0x126f5c0, 0xc420086230, ...)
	/go/src/github.com/FlashBoys/go-finance/quotes.go:72 +0x2b3
main.main()
	/test.go:11 +0x75
exit status 2

davemachado avatar Nov 09 '17 16:11 davemachado

Yahoo has shut down this service...

guillaume0811 avatar Nov 12 '17 08:11 guillaume0811

Let me look into it. Let me also look into getting email notifications when issues get posted to this repo...

ackleymi avatar Nov 30 '17 02:11 ackleymi

Sigh... yahoo.

ackleymi avatar Nov 30 '17 02:11 ackleymi

Maybe we can use the Morningstar API? https://gist.github.com/hahnicity/45323026693cdde6a116

Any other idea?

guillaume0811 avatar Dec 01 '17 09:12 guillaume0811

Hmm. Looks like they actually have some pretty expansive datasets available. I think short-term I'm going to fix the ailing quote snapshot api call with yahoo's new endpoint: https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL,GE and set up a long-term goal of incorporating morningstar's data into some separate api calls. Sound good?

ackleymi avatar Dec 08 '17 01:12 ackleymi

Sounds good to me. I didn't find this new endpoint...

guillaume0811 avatar Dec 09 '17 15:12 guillaume0811