Skip to content

Instantly share code, notes, and snippets.

@john-friedman
Created April 4, 2025 07:01
Show Gist options
  • Save john-friedman/26fbe99fe23e4e2ebf9626b8b691f0bf to your computer and use it in GitHub Desktop.
Save john-friedman/26fbe99fe23e4e2ebf9626b8b691f0bf to your computer and use it in GitHub Desktop.
from datamule import Portfolio
from datetime import datetime
for month in range(1, 13):
# Format month as 2-digit string
month_str = f"{month:02d}"
# Create date ranges for the first and last day of each month
start_date = f"2022-{month_str}-01"
end_date = f"2022-{month_str}-31" # 31 always works for the last day of the month :)
portfolio = Portfolio(f'20-f_{month_str}')
# Download submissions for this month
portfolio.download_submissions(
submission_type='20-F',
filing_date=(start_date, end_date)
)
# Keep only 20-F document type
portfolio.keep('20-F')
print(f"Created portfolio for {datetime.strptime(month_str, '%m').strftime('%B')} 2022")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment