Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_holdings method to MarketWatchClient #193

Merged

Conversation

torrresagus
Copy link
Collaborator

Add get_holdings method to MarketWatchClient

  • Implement get_holdings method to scrape fund holdings data from MarketWatch
  • Method returns a dictionary with the following structure:
    { 'ticker': 'ONEQ', 'sector_allocation': { 'Technology': '58.15%', 'Consumer Services': '15.25%', 'Health Care': '6.02%', 'Consumer Goods': '5.45%', 'Industrials': '4.33%', 'Financials': '3.85%', 'Non Classified Equity': '3.07%', 'Basic Materials': '1.24%', 'Telecommunications': '0.81%', 'Oil & Gas': '0.72%' }, 'top_holdings': [ { 'company': 'Microsoft Corp.', 'symbol': 'MSFT', 'net_assets': '11.38%' }, { 'company': 'Apple Inc.', 'symbol': 'AAPL', 'net_assets': '10.35%' }, { 'company': 'NVIDIA Corp.', 'symbol': 'NVDA', 'net_assets': '8.49%' }, { 'company': 'Amazon.com Inc.', 'symbol': 'AMZN', 'net_assets': '7.15%' }, { 'company': 'Alphabet Inc. Cl A', 'symbol': 'GOOGL', 'net_assets': '3.77%' }, { 'company': 'Meta Platforms Inc.', 'symbol': 'META', 'net_assets': '3.72%' }, { 'company': 'Alphabet Inc. Cl C', 'symbol': 'GOOG', 'net_assets': '3.67%' }, { 'company': 'Fidelity Securities Lending Cash Central Fund', 'symbol': '', 'net_assets': '3.20%' }, { 'company': 'Broadcom Inc.', 'symbol': 'AVGO', 'net_assets': '2.37%' }, { 'company': 'Tesla Inc.', 'symbol': 'TSLA', 'net_assets': '2.30%' } ] }
  • Raise exceptions for stock and index tickers by checking URL redirections
  • Added unit tests to verify correct handling of fund, stock, and index tickers

image

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marketwatch-4mll ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 2:25am

@antoinebou12 antoinebou12 merged commit 2a15fec into antoinebou12:main Jun 19, 2024
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants