Skip to content

Commit

Permalink
test: fixed contract test to match Yahoo API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
achannarasappa committed Feb 18, 2023
1 parent c6ba5e5 commit 6f139d9
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion internal/quote/yahoo/quote_contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,67 @@ var _ = Describe("Quote", func() {
"regularMarketPreviousClose": {
"type": "number"
},
"regularMarketOpen": {
"type": "number"
},
"regularMarketDayRange": {
"type": "string"
},
"regularMarketDayHigh": {
"type": "number"
},
"regularMarketDayLow": {
"type": "number"
},
"regularMarketVolume": {
"type": "number"
},
"postMarketChange": {
"type": "number"
},
"postMarketChangePercent": {
"type": "number"
},
"postMarketPrice": {
"type": "number"
},
"preMarketChange": {
"type": "number"
},
"preMarketChangePercent": {
"type": "number"
},
"preMarketPrice": {
"type": "number"
},
"fiftyTwoWeekHigh": {
"type": "number"
},
"fiftyTwoWeekLow": {
"type": "number"
},
"symbol": {
"type": "string"
},
"fullExchangeName": {
"type": "string"
},
"exchangeDataDelayedBy": {
"type": "number"
},
"marketCap": {
"type": "number"
},
"quoteType": {
"type": "string"
}
}
}
},
"required": ["quoteResponse"]
}`

resp, err := http.Get("https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US&region=US&corsDomain=finance.yahoo.com&symbols=NET")
resp, err := http.Get("https://query1.finance.yahoo.com/v7/finance/quote?fields=shortName,regularMarketChange,regularMarketChangePercent,regularMarketPrice,regularMarketPreviousClose,regularMarketOpen,regularMarketDayRange,regularMarketDayHigh,regularMarketDayLow,regularMarketVolume,postMarketChange,postMarketChangePercent,postMarketPrice,preMarketChange,preMarketChangePercent,preMarketPrice,fiftyTwoWeekHigh,fiftyTwoWeekLow,marketCap&region=US&lang=en-US&symbols=NET")
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 6f139d9

Please sign in to comment.