Whistle Past the Graveyard

What does the idiom “Whistle Past the Graveyard” mean?

Definition:

Remain optimistic despite dangers; be clueless

For example:

“Stockbrokers act as though stock prices will always rise, but they’re whistling past the graveyard.”