The market can stay irrational longer than you can stay solvent.
The first part is okay (although there is no Chinese word meaning "can" or "able to"), but in the second part 保持破產 = "maintain bankruptcy" = "remain bankrupt" is the opposite of what the quote says. (Also, it might not be a Keynes quote.)
The grammar structure 比...长 is also not the closest possible match to the English, so I wouldn't use it (even though it's correct).
Anyway, let's see how it's translated online:
克纳普，理性的股票投资, 2013；Google Books (screenshot)
The last part above 长到令你破产 is something like "extends until you go bankrupt". I think 市场 = "market" is more general than 股市 = "stock market" (I believe shorthand for 股票市场); maybe 股市 is more precise.
财富, 2009; Google Books
Here 超过 = "exceed" and 清偿能力 = "solvency" are suitable. However, I feel the 可能 = "possibly" feels wrong (the quote does not say "possibly longer", just "longer"). Also, having both 能够 and 能力 seems excessive. [I'm not sure what 基本面 is doing at the start here.]
Here 状态 is used to mean "state" (as in "a state of irrationality"). I don't think it's needed.
Combining these ideas, I suggest:
My direct translation: The stock market can maintain irrationality time exceeds your maintain solvency time.
Google Translate: The stock market can remain irrational longer than you can maintain solvency.