diff --git a/models/stocks_bulkcandles.go b/models/stocks_bulkcandles.go index ca520e5..93e06f7 100644 --- a/models/stocks_bulkcandles.go +++ b/models/stocks_bulkcandles.go @@ -9,26 +9,26 @@ import ( // It contains arrays of stock symbols, timestamps, opening, high, low, closing prices, and volumes for each candle. // // # Generated By -// +// // - BulkStockCandlesRequest.Packed(): Generates a BulkStockCandlesResponse from a bulk stock candles request. -// +// // # Methods -// +// // - Unpack() ([]Candle, error): Converts the BulkStockCandlesResponse into a slice of Candle structs. // - String() string: Provides a string representation of the BulkStockCandlesResponse. -// +// // # Notes -// +// // - The Date field uses UNIX timestamps to represent the time for each candle. // - Ensure the slices within BulkStockCandlesResponse have equal lengths to prevent index out-of-range errors. type BulkStockCandlesResponse struct { - Symbol []string `json:"symbol" human:"Symbol"` // Symbol holds the stock ticker of the candle. - Date []int64 `json:"t" human:"Date"` // Date holds UNIX timestamps for each candle. - Open []float64 `json:"o" human:"Open"` // Open holds the opening prices for each candle. - High []float64 `json:"h" human:"High"` // High holds the highest prices reached in each candle. - Low []float64 `json:"l" human:"Low"` // Low holds the lowest prices reached in each candle. - Close []float64 `json:"c" human:"Close"` // Close holds the closing prices for each candle. - Volume []int64 `json:"v" human:"Volume"` // Volume represents the trading volume in each candle. + Symbol []string `json:"symbol"` // Symbol holds the stock ticker of the candle. + Date []int64 `json:"t"` // Date holds UNIX timestamps for each candle. + Open []float64 `json:"o"` // Open holds the opening prices for each candle. + High []float64 `json:"h"` // High holds the highest prices reached in each candle. + Low []float64 `json:"l"` // Low holds the lowest prices reached in each candle. + Close []float64 `json:"c"` // Close holds the closing prices for each candle. + Volume []int64 `json:"v"` // Volume represents the trading volume in each candle. } // Unpack converts a BulkStockCandlesResponse into a slice of Candle. diff --git a/models/stocks_candles.go b/models/stocks_candles.go index 3ad2432..2e49e69 100644 --- a/models/stocks_candles.go +++ b/models/stocks_candles.go @@ -35,14 +35,14 @@ import ( // - The optional fields VWAP and N are only available for version 2 candles. // - The Date field uses UNIX timestamps to represent the date and time of each candle. type StockCandlesResponse struct { - Date []int64 `json:"t" human:"Date"` // Date holds UNIX timestamps for each candle. - Open []float64 `json:"o" human:"Open"` // Open holds the opening prices for each candle. - High []float64 `json:"h" human:"High"` // High holds the highest prices reached in each candle. - Low []float64 `json:"l" human:"Low"` // Low holds the lowest prices reached in each candle. - Close []float64 `json:"c" human:"Close"` // Close holds the closing prices for each candle. - Volume []int64 `json:"v" human:"Volume"` // Volume represents the trading volume in each candle. - VWAP *[]float64 `json:"vwap,omitempty" human:"VWAP,omitempty"` // VWAP holds the Volume Weighted Average Price for each candle, optional. - N *[]int64 `json:"n,omitempty" human:"No. of Trades,omitempty"` // N holds the number of trades for each candle, optional. + Date []int64 `json:"t"` // Date holds UNIX timestamps for each candle. + Open []float64 `json:"o"` // Open holds the opening prices for each candle. + High []float64 `json:"h"` // High holds the highest prices reached in each candle. + Low []float64 `json:"l"` // Low holds the lowest prices reached in each candle. + Close []float64 `json:"c"` // Close holds the closing prices for each candle. + Volume []int64 `json:"v"` // Volume represents the trading volume in each candle. + VWAP *[]float64 `json:"vwap,omitempty"` // VWAP holds the Volume Weighted Average Price for each candle, optional. + N *[]int64 `json:"n,omitempty"` // N holds the number of trades for each candle, optional. } // Unpack converts a StockCandlesResponse into a slice of StockCandle. This method is primarily used to transform the aggregated diff --git a/options_chain.go b/options_chain.go index 9a6747a..724a6b5 100644 --- a/options_chain.go +++ b/options_chain.go @@ -7,8 +7,8 @@ // // | Method | Execution Level | Return Type | Description | // |------------|-----------------|------------------------------|----------------------------------------------------------------------------------------------------------------------------------| -// | **Get** | Direct | `[]OptionQuote` | Immediately fetches a slice of `[]models.OptionQuote`, allowing direct access to the options chain data. | -// | **Packed** | Intermediate | `*OptionQuotesResponse` | Delivers a `*models.OptionQuotesResponse` object containing the data, which requires unpacking to access the `OptionQuote` data. | +// | **Get** | Direct | `[]OptionQuote` | Immediately fetches a slice of `[]OptionQuote`, allowing direct access to the options chain data. | +// | **Packed** | Intermediate | `*OptionQuotesResponse` | Delivers a `*OptionQuotesResponse` object containing the data, which requires unpacking to access the `OptionQuote` data. | // | **Raw** | Low-level | `*resty.Response` | Offers the unprocessed `*resty.Response` for those seeking full control and access to the raw JSON or `*http.Response`. | package client diff --git a/stocks_candles_test.go b/stocks_candles_test.go index 1a845d1..9150a1b 100644 --- a/stocks_candles_test.go +++ b/stocks_candles_test.go @@ -2,6 +2,17 @@ package client import "fmt" +func ExampleStockCandlesRequest_raw() { + scr, err := StockCandles().Resolution("4H").Symbol("AAPL").From("2023-01-01").To("2023-01-04").Raw() + if err != nil { + fmt.Print(err) + return + } + fmt.Println(scr) + + // Output: {"s":"ok","t":[1672756200,1672770600,1672842600,1672857000],"o":[130.28,124.6699,126.89,127.265],"h":[130.9,125.42,128.6557,127.87],"l":[124.19,124.17,125.08,125.28],"c":[124.6499,125.05,127.2601,126.38],"v":[64411753,30727802,49976607,28870878]} +} + func ExampleStockCandlesRequest_packed() { scr, err := StockCandles().Resolution("4H").Symbol("AAPL").From("2023-01-01").To("2023-01-04").Packed() if err != nil { diff --git a/stocks_earnings_test.go b/stocks_earnings_test.go index 2b4dd20..2caf52c 100644 --- a/stocks_earnings_test.go +++ b/stocks_earnings_test.go @@ -2,9 +2,28 @@ package client import ( "fmt" + "regexp" "time" ) +func ExampleStockEarningsRequest_raw() { + ser, err := StockEarnings().Symbol("AAPL").From("2022-01-01").To("2022-01-31").Raw() + if err != nil { + fmt.Print(err) + return + } + + // Convert the response to a string if it's not already + serString := ser.String() + + // Use regex to remove the "updated" key and its value so that the output is consistent between runs. + re := regexp.MustCompile(`,"updated":\[\d+\]`) + cleanedSerString := re.ReplaceAllString(serString, "") + + fmt.Println(cleanedSerString) + // Output: {"s":"ok","symbol":["AAPL"],"fiscalYear":[2022],"fiscalQuarter":[1],"date":[1640926800],"reportDate":[1643259600],"reportTime":["after close"],"currency":["USD"],"reportedEPS":[2.1],"estimatedEPS":[1.89],"surpriseEPS":[0.21],"surpriseEPSpct":[0.1111]} +} + func ExampleStockEarningsRequest_packed() { ser, err := StockEarnings().Symbol("AAPL").From("2022-01-01").To("2022-01-31").Packed() if err != nil { diff --git a/stocks_news_test.go b/stocks_news_test.go index 821b709..329a4b4 100644 --- a/stocks_news_test.go +++ b/stocks_news_test.go @@ -30,4 +30,15 @@ func ExampleStockNewsRequest_packed() { fmt.Println(resp) // Output: StockNewsResponse{Symbol: "AAPL", Headline: "Lessons Learned From Visa and Mastercard in a Year of Crypto News", Content: "How Visa and Mastercard fared in a year dominated by crypto news. Why fortress-like balance sheets will be an even bigger asset in the new year. To catch full episodes of all The Motley Fool's free podcasts, check out our podcast center.

Continue reading", Source: "https://finance.yahoo.com/m/4b9f894a-9854-3caf-8775-c7e9f9d4ce90/lessons-learned-from-visa-and.html", PublicationDate: 1672549200; Symbol: "AAPL", Headline: "Down 28% in 2022, Is Apple Stock a Buy for 2023?", Content: "Apple (NASDAQ: AAPL) has benefited from robust consumer demand and hopes that easing supply chain constraints will boost the tech giant's prospects. *Stock prices used were the afternoon prices of Dec.

Continue reading", Source: "https://finance.yahoo.com/m/457b8480-3b01-3a94-9273-54aaf80906a8/down-28%25-in-2022%2C-is-apple.html", PublicationDate: 1672549200; Symbol: "AAPL", Headline: "80% of Warren Buffett's Portfolio Is Invested in These 7 Stocks as 2023 Begins", Content: "Two of these stocks were especially big winners for Buffett in 2022.", Source: "https://www.fool.com/investing/2023/01/01/80-of-warren-buffetts-portfolio-is-invested-in-the/", PublicationDate: 1672549200; Symbol: "AAPL", Headline: "2 Beaten-Down Warren Buffett Stocks to Buy in 2023", Content: "These are high-conviction stocks for the Oracle of Omaha but they're trading at knocked-down prices.

Continue reading", Source: "https://finance.yahoo.com/m/cc37d40a-9068-3de1-9dd3-a6a71da3aa75/2-beaten-down-warren-buffett.html", PublicationDate: 1672549200; Symbol: "AAPL", Headline: "2023 Dividend Growth Portfolio Review And Look Ahead", Content: "I review my current holdings and sectors in the portfolio and how it has changed over the years. See my income projections for 2023 and potential pitfalls.", Source: "https://seekingalpha.com/article/4567219-2023-dividend-growth-portfolio-review-and-look-ahead", PublicationDate: 1672549200; Symbol: "AAPL", Headline: "The Fall Of Tesla And The Rise of Exxon Amid The Energy Crisis", Content: "Growth stocks have been thoroughly hammered this year, with high inflation and rising interest rates pinching growth equities of all stripes. But few stocks exemplify the dramatic shake-up at the top, like leading EV maker Tesla Inc. (NASDAQ: TSLA). TSLA stock has tanked 69.5% in the year-to-date, wiping off a staggering $877 billion from its market cap. In comparison, the S&P 500 has declined a more modest 19.7% over the timeframe. Tesla has gone from being the fifth most valuable public company and now ranks just thirteenth with a market cap of $385 billion.

Tesla’s woes are well documented, including Musk's Twitter takeover and related distractions; worries that high inflation and rising interest rates will dampen consumers' enthusiasm for EVs, as well as investor jitters about growth assets. TSLA shareholders are furious at CEO Elon Musk, The Wall Street Journal reports, for his Twitter antics and tomfoolery, which has led to several downgrades for the stock. Meanwhile, hordes of customers are canceling their Tesla orders, \"His personality is absolutely tanking the Tesla brand. I'm looking forward to having an Elon-free existence,’’ a biotech exec with a Model S lease has told CNET. \"There is no Tesla CEO today,\" tweeted Gary Black, a hedge fund manager with ~$50 million worth of TSLA stock told Futurism.

Related: U.S. Oil, Gas Rigs Up 193 This Year

But Tesla is hardly alone here: most EV stocks have had a year to forget with rising costs, supply chain issues, increasing competition, and the threat of a potential recession causing many to sell off heavily.

Surprisingly, some Wall Street pundits have not given up on TSLA stock and are urging investors to use the selloff as a buying opportunity. To wit, Citi has tapped TSLA as a bullish contrarian stock for 2023, while Baird analyst Ben Kallo still sees Tesla as a “Best Idea” stock in 2023. Meanwhile, Morgan Stanley says Tesla could extend its lead over its EV rivals in the coming year, and has cited “valuation, cash flow, innovation and cost leadership” as key reasons to maintain a Buy-equivalent rating. Meanwhile, famed contrarian investor Cathie Wood, known for betting big on former growth stocks as they fall, recently loaded up on more than 25K shares of the EV giant.

Story continues

In sharp contrast, things could not have gone differently for Tesla’s biggest fossil fuel rival, Exxon Mobil Corp. (NYSE: XOM). Exxon Mobil has enjoyed the biggest rise in the S&P 500 this year, with the energy giant jumping almost like technology stocks did in the tech boom thanks to high oil and gas prices triggered by the energy crisis. XOM shares have soared 72% this year, adding $190 billion to the company’s market value. Exxon’s increase in market value surpasses any company in the S&P 500, making Exxon Mobil the eighth most valuable stock in the S&P 500. That’s a remarkable jump considering that it only ranked 27th most valuable in the S&P 500 a year ago. Exxon was the most valuable S&P 500 company in 2011 until Apple Inc. (NASDAQ: AAPL) surpassed it in 2012.

Whereas Citi has picked XOM as one of its bearish contrarian stocks for 2023, the stock is viewed favorably by most Wall Street analysts, as evidenced by its $118.89 average price target, good for a 10% upside. The energy sector in general is expected to outperform the market again in 2023, and XOM should be just fine, considering it’s still cheap with a PE (Fwd) of 7.9. Back in October, Exxon raised its quarterly dividend by $0.03 per share to $0.91 per share marking the company's 40th straight year of increasing its dividend, keeping it in the elite group of Dividend Aristocrats. XOM shares now yield 3.3%.

The outlook for the energy sector remains bright. According to a recent Moody's research report, industry earnings will stabilize overall in 2023, though they will come in slightly below levels reached by recent peaks.

The analysts note that commodity prices have declined from very high levels earlier in 2022, but have predicted that prices are likely to remain cyclically strong through 2023. This, combined with modest growth in volumes, will support strong cash flow generation for oil and gas producers. Moody’s estimates that the U.S. energy sector’s EBITDA for 2022 will clock in at $623B but fall slightly to $585B in 2023.

The analysts say that low capex, rising uncertainty about the expansion of future supplies, and high geopolitical risk premium will, however, continue to support cyclically high oil prices. Meanwhile, strong export demand for U.S. LNG will continue supporting high natural gas prices.

The combined dividend and buyback yield for the energy sector is now approaching 8%, which is high by historical standards. Similarly elevated levels occurred in 2020 and 2009, which preceded periods of strength. In comparison, the combined dividend and buyback yield for the S&P 500 is closer to five percent, which makes for one of the largest gaps in favor of the energy sector on record.

In other words, there simply aren’t better places for people investing in the U.S. stock market to park their money if they are looking for serious earnings growth.

By Alex Kimani for Oilprice.com

More Top Reads from Oilprice.com:

A New Type Of Oil And Gas Funding Is Booming What is Crude Oil? A Detailed Explanation on this Essential Fossil Fuel Chevron Sending Tanker To Venezuela To Load Oil

Read this article on OilPrice.com", Source: "https://finance.yahoo.com/news/fall-tesla-rise-exxon-amid-000000565.html", PublicationDate: 1672549200} +} + +func ExampleStockNewsRequest_raw() { + resp, err := StockNews().Symbol("AAPL").Date("2023-01-01").Raw() + if err != nil { + fmt.Print(err) + return + } + + fmt.Println(resp) + // Output: {"s":"ok","symbol":["AAPL","AAPL","AAPL","AAPL","AAPL","AAPL"],"headline":["Lessons Learned From Visa and Mastercard in a Year of Crypto News","Down 28% in 2022, Is Apple Stock a Buy for 2023?","80% of Warren Buffett's Portfolio Is Invested in These 7 Stocks as 2023 Begins","2 Beaten-Down Warren Buffett Stocks to Buy in 2023","2023 Dividend Growth Portfolio Review And Look Ahead","The Fall Of Tesla And The Rise of Exxon Amid The Energy Crisis"],"content":["How Visa and Mastercard fared in a year dominated by crypto news. Why fortress-like balance sheets will be an even bigger asset in the new year. To catch full episodes of all The Motley Fool's free podcasts, check out our podcast center.

Continue reading","Apple (NASDAQ: AAPL) has benefited from robust consumer demand and hopes that easing supply chain constraints will boost the tech giant's prospects. *Stock prices used were the afternoon prices of Dec.

Continue reading","Two of these stocks were especially big winners for Buffett in 2022.","These are high-conviction stocks for the Oracle of Omaha but they're trading at knocked-down prices.

Continue reading","I review my current holdings and sectors in the portfolio and how it has changed over the years. See my income projections for 2023 and potential pitfalls.","Growth stocks have been thoroughly hammered this year, with high inflation and rising interest rates pinching growth equities of all stripes. But few stocks exemplify the dramatic shake-up at the top, like leading EV maker Tesla Inc. (NASDAQ: TSLA). TSLA stock has tanked 69.5% in the year-to-date, wiping off a staggering $877 billion from its market cap. In comparison, the S&P 500 has declined a more modest 19.7% over the timeframe. Tesla has gone from being the fifth most valuable public company and now ranks just thirteenth with a market cap of $385 billion.

Tesla’s woes are well documented, including Musk's Twitter takeover and related distractions; worries that high inflation and rising interest rates will dampen consumers' enthusiasm for EVs, as well as investor jitters about growth assets. TSLA shareholders are furious at CEO Elon Musk, The Wall Street Journal reports, for his Twitter antics and tomfoolery, which has led to several downgrades for the stock. Meanwhile, hordes of customers are canceling their Tesla orders, \"His personality is absolutely tanking the Tesla brand. I'm looking forward to having an Elon-free existence,’’ a biotech exec with a Model S lease has told CNET. \"There is no Tesla CEO today,\" tweeted Gary Black, a hedge fund manager with ~$50 million worth of TSLA stock told Futurism.

Related: U.S. Oil, Gas Rigs Up 193 This Year

But Tesla is hardly alone here: most EV stocks have had a year to forget with rising costs, supply chain issues, increasing competition, and the threat of a potential recession causing many to sell off heavily.

Surprisingly, some Wall Street pundits have not given up on TSLA stock and are urging investors to use the selloff as a buying opportunity. To wit, Citi has tapped TSLA as a bullish contrarian stock for 2023, while Baird analyst Ben Kallo still sees Tesla as a “Best Idea” stock in 2023. Meanwhile, Morgan Stanley says Tesla could extend its lead over its EV rivals in the coming year, and has cited “valuation, cash flow, innovation and cost leadership” as key reasons to maintain a Buy-equivalent rating. Meanwhile, famed contrarian investor Cathie Wood, known for betting big on former growth stocks as they fall, recently loaded up on more than 25K shares of the EV giant.

Story continues

In sharp contrast, things could not have gone differently for Tesla’s biggest fossil fuel rival, Exxon Mobil Corp. (NYSE: XOM). Exxon Mobil has enjoyed the biggest rise in the S&P 500 this year, with the energy giant jumping almost like technology stocks did in the tech boom thanks to high oil and gas prices triggered by the energy crisis. XOM shares have soared 72% this year, adding $190 billion to the company’s market value. Exxon’s increase in market value surpasses any company in the S&P 500, making Exxon Mobil the eighth most valuable stock in the S&P 500. That’s a remarkable jump considering that it only ranked 27th most valuable in the S&P 500 a year ago. Exxon was the most valuable S&P 500 company in 2011 until Apple Inc. (NASDAQ: AAPL) surpassed it in 2012.

Whereas Citi has picked XOM as one of its bearish contrarian stocks for 2023, the stock is viewed favorably by most Wall Street analysts, as evidenced by its $118.89 average price target, good for a 10% upside. The energy sector in general is expected to outperform the market again in 2023, and XOM should be just fine, considering it’s still cheap with a PE (Fwd) of 7.9. Back in October, Exxon raised its quarterly dividend by $0.03 per share to $0.91 per share marking the company's 40th straight year of increasing its dividend, keeping it in the elite group of Dividend Aristocrats. XOM shares now yield 3.3%.

The outlook for the energy sector remains bright. According to a recent Moody's research report, industry earnings will stabilize overall in 2023, though they will come in slightly below levels reached by recent peaks.

The analysts note that commodity prices have declined from very high levels earlier in 2022, but have predicted that prices are likely to remain cyclically strong through 2023. This, combined with modest growth in volumes, will support strong cash flow generation for oil and gas producers. Moody’s estimates that the U.S. energy sector’s EBITDA for 2022 will clock in at $623B but fall slightly to $585B in 2023.

The analysts say that low capex, rising uncertainty about the expansion of future supplies, and high geopolitical risk premium will, however, continue to support cyclically high oil prices. Meanwhile, strong export demand for U.S. LNG will continue supporting high natural gas prices.

The combined dividend and buyback yield for the energy sector is now approaching 8%, which is high by historical standards. Similarly elevated levels occurred in 2020 and 2009, which preceded periods of strength. In comparison, the combined dividend and buyback yield for the S&P 500 is closer to five percent, which makes for one of the largest gaps in favor of the energy sector on record.

In other words, there simply aren’t better places for people investing in the U.S. stock market to park their money if they are looking for serious earnings growth.

By Alex Kimani for Oilprice.com

More Top Reads from Oilprice.com:

A New Type Of Oil And Gas Funding Is Booming What is Crude Oil? A Detailed Explanation on this Essential Fossil Fuel Chevron Sending Tanker To Venezuela To Load Oil

Read this article on OilPrice.com"],"source":["https://finance.yahoo.com/m/4b9f894a-9854-3caf-8775-c7e9f9d4ce90/lessons-learned-from-visa-and.html","https://finance.yahoo.com/m/457b8480-3b01-3a94-9273-54aaf80906a8/down-28%25-in-2022%2C-is-apple.html","https://www.fool.com/investing/2023/01/01/80-of-warren-buffetts-portfolio-is-invested-in-the/","https://finance.yahoo.com/m/cc37d40a-9068-3de1-9dd3-a6a71da3aa75/2-beaten-down-warren-buffett.html","https://seekingalpha.com/article/4567219-2023-dividend-growth-portfolio-review-and-look-ahead","https://finance.yahoo.com/news/fall-tesla-rise-exxon-amid-000000565.html"],"publicationDate":[1672549200,1672549200,1672549200,1672549200,1672549200,1672549200]} } \ No newline at end of file diff --git a/stocks_quotes_test.go b/stocks_quotes_test.go index 8d4ac2d..cbabafb 100644 --- a/stocks_quotes_test.go +++ b/stocks_quotes_test.go @@ -2,10 +2,73 @@ package client import ( "fmt" + "log" + "regexp" "testing" "time" ) +func ExampleStockQuoteRequest_get() { + // This example demonstrates how to create a StockQuoteRequest, set its parameters, + // and perform an actual request to fetch stock quotes for the "AAPL" symbol. + + // Initialize a new StockQuoteRequest and fetch a stock quote. + sqr, err := StockQuote().Symbol("AAPL").Get() + if err != nil { + log.Fatalf("Failed to get stock quotes: %v", err) + } + + // Check if the response contains the "AAPL" symbol. + for _, quote := range sqr { + fmt.Printf("Symbol: %s\n", quote.Symbol) + } + // Output: Symbol: AAPL +} + +func ExampleStockQuoteRequest_packed() { + // This example demonstrates how to create a StockQuoteRequest, set its parameters, + // and perform an actual request to fetch stock quotes for the "AAPL" symbol. + + // Initialize a new StockQuoteRequest and fetch a stock quote. + sqr, err := StockQuote().Symbol("AAPL").Packed() + if err != nil { + log.Fatalf("Failed to get stock quotes: %v", err) + } + + // Iterate and print all the symbols in the slice. + for _, symbol := range sqr.Symbol { + fmt.Printf("Symbol: %s\n", symbol) + } + // Output: Symbol: AAPL +} + +func ExampleStockQuoteRequest_raw() { + // This example demonstrates how to create a StockQuoteRequest, set its parameters, + // and perform an actual request to fetch stock quotes for the "AAPL" symbol. + // The response is converted to a raw string and we print out the string at the end of the test. + + // Initialize a new StockQuoteRequest and fetch a stock quote. + sqr, err := StockQuote().Symbol("AAPL").Raw() + if err != nil { + log.Fatalf("Failed to get stock quotes: %v", err) + } + + // Convert the response to a string. + sqrStr := sqr.String() + + // Use regex to find the symbol in the response string. + re := regexp.MustCompile(`"symbol":\["(.*?)"\]`) + matches := re.FindStringSubmatch(sqrStr) + + if len(matches) < 2 { + log.Fatalf("Failed to extract symbol from response") + } + + // Print the extracted symbol. + fmt.Printf("Symbol: %s\n", matches[1]) + // Output: Symbol: AAPL +} + func TestStockQuoteRequest(t *testing.T) { sqr, err := StockQuote().Symbol("AAPL").FiftyTwoWeek(true).Get() if err != nil {