100 curated investment principles from Buffett, Munger, Graham, Lynch & more — ready to use in your Python code.
Curated by KeepRule.com — the investment principles encyclopedia.
pip install keepruleimport keeprule
# Get a random principle
p = keeprule.random()
print(f'"{p["text"]}" — {p["author"]}')
# Get all principles by Warren Buffett
buffett = keeprule.by_author("Buffett")
print(f"{len(buffett)} principles from Buffett")
# Search for "margin of safety"
results = keeprule.search("margin of safety")
for r in results:
print(r["text"])Returns a random investment principle.
p = keeprule.random()
# {
# "id": 3,
# "text": "Price is what you pay. Value is what you get.",
# "author": "Warren Buffett",
# "category": "Value Investing",
# "source": "Berkshire Hathaway Shareholder Letter, 2008"
# }Returns multiple random non-repeating principles.
principles = keeprule.random_multiple(5)Filter by author name (case-insensitive partial match).
keeprule.by_author("Munger") # All Charlie Munger principles
keeprule.by_author("Graham") # All Benjamin Graham principles
keeprule.by_author("Lynch") # All Peter Lynch principlesFilter by category (case-insensitive partial match).
keeprule.by_category("Risk Management")
keeprule.by_category("Value Investing")
keeprule.by_category("Mental Models")Full-text search across text, author, category, and source.
keeprule.search("compound") # Principles about compound interest
keeprule.search("fear") # Principles about fear/greed
keeprule.search("intelligent") # The Intelligent Investor referencesReturns all 100 principles.
all_principles = keeprule.all()
print(f"Total: {len(all_principles)} principles")Returns a sorted list of all unique author names.
keeprule.authors()
# ["Albert Einstein", "Alexander Elder", "Benjamin Graham", "Charlie Munger", ...]Returns a sorted list of all unique categories.
keeprule.categories()
# ["Behavioral Finance", "Business Quality", "Circle of Competence", ...]Get a specific principle by its ID (1-100).
p = keeprule.get_by_id(1)
# Rule No. 1: Never lose money...Returns the total number of principles.
keeprule.count() # 100Each principle is a dict with:
| Key | Type | Description |
|---|---|---|
id |
int | Unique identifier (1-100) |
text |
str | The investment principle or quote |
author |
str | Author name |
category |
str | Category classification |
source |
str | Source reference |
- Value Investing — Core value investing principles
- Risk Management — Managing and understanding risk
- Market Psychology — Understanding market behavior
- Long-term Investing — Patience and compound growth
- Mental Models — Thinking frameworks
- Behavioral Finance — Psychology of investing
- Circle of Competence — Knowing your limits
- Decision Making — Better investment decisions
- Business Quality — Evaluating businesses
- Financial Discipline — Spending, saving, discipline
- Portfolio Management — Diversification and allocation
- Research — Due diligence and analysis
- Warren Buffett — The Oracle of Omaha
- Charlie Munger — Berkshire Hathaway Vice Chairman
- Benjamin Graham — Father of Value Investing
- Peter Lynch — Legendary Fidelity fund manager
- John Templeton — Global investing pioneer
- John Bogle — Vanguard founder, index fund advocate
- Jesse Livermore — Legendary stock trader
- Philip Fisher — Growth investing pioneer
- George Soros — Quantum Fund founder
- Daily principle bot — Display a random principle every day
- Financial apps — Enrich your app with curated wisdom
- CLI tools — Show investing tips in terminal
- Education — Teach investment principles programmatically
- Data analysis — Analyze investing wisdom patterns
Visit KeepRule.com for:
- Interactive investment principle scenarios
- Deep-dive explanations with real-world examples
- AI-powered investment principle analysis
- Community discussions and notes
MIT - see LICENSE
Issues and PRs welcome at GitHub.
- Investor Personality Quiz - Which legendary investor are you?
- Investment Scorecard - Rate any stock like Buffett
- Portfolio Health Check - Grade your portfolio
- Fear & Greed Calculator - Market sentiment tool
- Decision Tree - Buy/Hold/Sell guidance
- Investment Calculators - Compound interest, retirement, DCA & more
- 30-Day Challenge - Transform your investing
- Free API - 100 principles, 20 authors
- NPM Package -
npm install keeprule - PyPI Package -
pip install keeprule - Chrome Extension
- Discord Bot
- Embeddable Widget
- Master Guides - Buffett, Munger, Graham & more
- Free Ebook - 100 Investment Principles
- Email Course - 7-day Buffett course
- Infographics - Visual investing guides
- Investment Glossary - 100 terms every investor should know
- Annual Report - State of Investment Principles 2026
- SEO Blog - Deep-dive investing articles
- Platform Comparisons - KeepRule vs alternatives
Built by William Wang | All Tools