There are plenty of great companies contending for your cash these days, and more than a few of them are trading on sale. But investors should be particularly judicious with their investing capital in the current market. You shouldn't put your money toward any investment just because it's trading up or down, or because of primarily near-term factors.

Rather, any investment thesis should be built around a solid business that has long-term growth potential, strong financials, and quality leadership -- and you should plan to buy and hold for at least several years. You shouldn't be investing money that you'll soon require for bills or other financial obligations, and you shouldn't be dipping into your nest egg or emergency stash to fund your portfolio. 

With all that being said, if you have $1,000 at the ready to invest in the stock market, here are two incredible companies to consider adding to your portfolio in the near future. 

1. Amazon: E-commerce is just the tip of the iceberg

Amazon (AMZN 1.10%) has fallen nearly 30% this year as factors like inflation, supply chain and labor disruptions, fears about a global recession, and changes in consumer spending have impacted its balance sheet and caused some investors to head for the hills. While these factors will undoubtedly take time to resolve, I have no qualms about maintaining and even adding to my position. 

Frankly, it would have been unrealistic to expect even a company like Amazon to be totally immune to the current global catalysts impacting businesses across a range of sectors, such as "inflationary pressures in fuel, energy, and transportation costs," as CEO Andy Jassy said in the most recent quarterly report.

In the long run, though, the diversity of Amazon's businesses and its leadership in the massive, dynamic markets in which it operates can still drive considerable growth for the company in the years ahead. Even with the present business and market environment, analysts still think the stock could hit as much as $215 over the next 12 months, a nearly 80% upside from its current share price. 

In the most recent quarter, unprofitability, combined with a decline in operating and free cash flow, understandably unnerved some investors. At the same time, net sales rose 7% year-over-year, though that does represent a pullback from the previous quarterly growth figures investors had become accustomed to previously. 

But the broader dynamics that can drive Amazon's future growth trajectory are far more favorable. Amazon is known first and foremost as an e-commerce stock, and it continues to control a significant share of this multi-trillion industry. Amazon captures 38% of the online retail market in the U.S. alone. Even in the current environment, Amazon still reported that on this year's Prime Day Event in July it saw more transactions than on any other Prime Day to date.

While the company notably has its fingers in many pies, from healthcare to groceries to entertainment, the largest slice of its business besides e-commerce is its cloud business, Amazon Web Services. In the most recent quarter, AWS saw net sales jump 33% year-over-year. Bear in mind, AWS continues to dominate the $200 billion cloud infrastructure market, outpacing giants like Alphabet and Microsoft

And while management can only do so much to combat the impact of inflation, the company is making changes that should help improve its top line and move it back to profitability, such as improvements to its fulfillment network. All of this portends a strong recovery for Amazon stock in the future, as current headwinds eventually subside.

2. Walmart: A safe haven for consumers and investors alike

Another household name, and the number-two company behind Amazon among the largest online retailers in the country, Walmart (WMT -1.38%) is only down about 8% from the beginning of this year. 

Walmart has weathered many market and economic storms in its day, and its stable, consistent financial growth has translated to steady returns for investors throughout the years. The Dividend Aristocrat -- which is just one year's dividend increase away from being crowned a Dividend King -- currently yields 1.7%. Over the past five years, the stock has yielded a total return of about 86%, compared to the S&P 500's 63%. During that same five-year period, the company has grown its annual revenue and annual net income by 14% and 39%, respectively. 

Walmart's business footprint covers a variety of lucrative, non-cyclical industries, ranging from consumer staples like food and household supplies to healthcare. This gives the company many reliable streams of revenue growth to tap into, even in a turbulent business environment. Walmart's "Every Day Low Price" strategy is especially compelling for consumers looking for ways to reduce costs in a high-inflation economy, and that bears up in the company's recent financial figures. 

In the most recent quarter, Walmart reported total revenue growth of 8% year-over-year to $152.9 billion, while net income increased 20% year-over-year to $5.1 billion. Its U.S. comp sales and e-commerce sales rose 7% and 12%, respectively, from the year-ago period. On a two-year basis, these two metrics rose 12% and 18%. More and more consumers are also flocking to its warehouse retailer subsidiary Sam's Club, which saw sales jump 10% year-over-year, while its member base hit an all-time high, pushing membership income up 9% year-over-year. 

And while foreign currency headwinds are impacting a variety of businesses including Walmart, its international sales were still up 6% year-over-year. Stepping away from the retail side, its global ad division, which represents a rapidly growing segment of its business, saw sales skyrocket 30% from the year-ago period. 

The consistent growth that Walmart has realized even in the current environment demonstrates the resilience of its business. With its history of robust financial performance, the stock is a favorable choice for investors to buy and hold for many years in all types of markets.