The spookiest time of year is back. The end of October brings the opportunity to spend lots of money on a few hours of frightful frolicking.

Bankrate set out to gauge the price of fright by tracking the cost of a basket of holiday items. The items include decorations, candy, pumpkins and kids' costumes. The index was assembled by pricing each item across six retailers. The prices from six vendors were averaged to find the typical cost.

Having a hauntingly good time Oct. 31 can cost a pretty penny, but beware: Economics can barge in when you least expect it.

First, some history

The jack-o'-lantern is, arguably, the defining symbol of the season. But pumpkins weren't always associated with the end of October. In Ireland, where the holiday was thought to have originated, carved turnips were the vegetable of choice.

"Pumpkins as jack o' lanterns have been around for probably 120 years at this point," says Lisa Morton, author of "Trick or Treat: A History of Halloween."

Luckily, pumpkins are fairly easy to come by. The average carving pumpkin costs about $5; the weighted average price in September was $4.73, according to the USDA's National Fruit and Vegetable Report.

The custom of going door to door demanding treats, nicely of course, has been around for an even shorter period.

"It was starting to catch on in the late '30s, and then World War II happened, and there was sugar rationing and so on. So it wasn't until after the war that it really started catching on," Morton says.

There's no shortage of sweets these days, but it can still cost a lot to supply the neighborhood with treats. According to Bankrate's calculations, about 5 pounds of candy comes with an average price of $22. For our measurement, we looked at two 40 ounce bags containing 130 miniature candy bars.

The price of candy has actually decreased, according to the Department of Labor. "What you're seeing recently is the price of candy has fallen when you adjust seasonally," says Chris Christopher, director of global and U.S. consumer markets for IHS Global Insight.

"Sugar prices in the U.S. are protected. They try to keep sugar prices high, but they have been falling," he says.

Sugar has a major influence on the price of candy, but there are other factors that determine price as well, including shipping and production costs.

"Fuel goes into it (as well as the) the utility bills of the major candy manufacturers," Christopher says.

Costly costumes

Like trick-or-treating, Halloween costumes were a 20th century invention born out of necessity.

"For about 30 years, Halloween was taken over by pranksters. By the '30s, pranks were causing cities millions of dollars of damage. They considered banning Halloween in many cities, but instead parents got together and came up with party ideas for kids, and a lot of them involved dressing up and costuming," Morton says.

"There were things called house-to-house parties. Because it was the Great Depression and everyone was so poor, each house would fund a different part of the party, and that's one of the things that could have led to trick or treating as well," she says.

Bankrate's Halloween research found that the price of a kids costume today is an average of $29.60, sans accessories. Halloween costumes don't tend to appreciate in cost with inflation, according to Mark Bietz, vice president of marketing at HalloweenCostumes.com.