Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Fetch and Write 13F Filings
00:00
5 left

Fetch and Write 13F Filings

MediumPython

Problem

Take-home: write a Python program that retrieves certain companies' 13F filings from SEC EDGAR (XML) and writes them to a tab-separated file; include a thorough README.

Asked in the take-home stage. Web scraping team; filings are in an XML file.

Contract

Implement write_13f_tsv(filings, output_path). filings is a list of objects containing company, cik, and either an EDGAR url or test-only XML text in xml. Fetch URLs with a descriptive User-Agent, parse each information table, and write one row per holding. Return the output path.

Use this column order: company, cik, issuer, class, cusip, value, shares, share_type, put_call, investment_discretion. Missing XML fields must be empty. Preserve source values, sort rows by CIK and CUSIP, and document setup, assumptions, errors, and usage in the README.

Constraints

  • 1 <= number of filings <= 100
  • Each XML document contains zero or more information-table entries
  • XML namespaces and namespace URIs may vary
  • Use only Python standard-library modules
  • Output columns must use the specified order

Function Signature

def write_13f_tsv(filings, output_path):
Interviewer

Your question is Fetch and Write 13F Filings. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.