Open LeventeLantos opened 7 months ago
@LeventeLantos - did you ever figure this out? I'm running into the same issue, even when APCA_API_KEY_ID
and APCA_API_SECRET_KEY
exist in my env.
Figured this out, the marketdata
package has an identical NewClient
function and ClientOpts
just as in the alpaca
package:
client := marketdata.NewClient(marketdata.ClientOpts{
APIKey: os.Getenv("APCA_API_KEY_ID"),
APISecret: os.Getenv("APCA_API_SECRET_KEY"),
})
client.GetBars(...)
// etc.
marketdata DefaultClient authentication does not seem to work, I have this piece code: `func printCurrentPrice(symbol string) { lastQuote, err := marketdata.GetLatestQuote(symbol, marketdata.GetLatestQuoteRequest{ Feed: marketdata.SIP, Currency: "USD", }) if err != nil { fmt.Printf("Failed to get last quote for %s: %s\n", symbol, err) return }
}`
This will simple return: `$ go run main.go Failed to get last quote for AAPL:
403 Forbidden
(HTTP 403) `