Skip to content
All library documents

Formatting Multi-Asset CSV Data with Date and Symbol Columns

Article Quant Q&A · Author: user28039

Summary

The document explains what a CSV format requiring both date and symbol columns means when supplying data for multiple securities. A wide table may place dates down rows and securities across separate columns, which makes it seem that symbols cannot also occupy a column.

The answers clarify that the expected structure is a long table: each row records one date, one ticker, and that security's value. This lets a file contain observations for several instruments, including instruments with different trading calendars. The example shows that a date with no value for one ticker can simply be omitted for that ticker rather than forcing every security into a shared wide row. The exchange addresses data layout for a particular CSV ingestion interface; it does not describe validation rules beyond the stated date, symbol, and value arrangement or explain how the platform handles missing observations.

Key ideas

  • A multi-security CSV can use one row per date and ticker observation.
  • The date and symbol fields identify the instrument value recorded on each row.
  • A long format can accommodate securities with different holidays and missing dates.
  • The exchange explains the data shape rather than broader CSV validation or missing-data behavior.

Tags

Full text
# Quantopian's fetch_csv()


# Quantopian's fetch_csv()












The description of an argument of Quantopian's fetch_csv() function is the following:

> A well-formed http or https url pointing to a CSV file that has a header, a date column, and a symbol column (symbol column required to match data to securities).

How can my CSV possibly have BOTH a date column and a symbol column? In my CSV, (created using pandas.DataFrame's to_csv() function), the dates occupy a column, but the symbols constitute a row, and it is blatantly obvious that if the dates are in a column, the symbols cannot also be. Can anyone explain this to me? Thank you.

## Answer by James Spencer-Lavan (score 2)

https://quant.stackexchange.com/a/34320

It might be allowing you to upload, via CSV, values for multiple dates and multiple securities, all in one go.

Think about how you would format the columns if you had 4 dates of values for stockA and 10 dates of values for stockB

## Answer by will (score 2)

https://quant.stackexchange.com/a/34323

for example:

your file:

```
#N/A,     SX5E
20170519, 3590
20170518, 3585
20170517, 3586
20170516, 3583
20170515, 3582
```

Now say we have SX5E and also N225 - they have different holidays, so you might (in your format) have something like this:

```
#N/A,     SX5E, N225
20170519, 3590, 19600
20170518, 3585, 19590
20170517, 3586, #N/A
20170516, 3583, 19596
20170515, 3582, 19589
```

the format they're asking for sounds more like this:

```
Date, Ticker, Value
20170519, SX5E, 3590
20170518, SX5E, 3585
20170517, SX5E, 3586
20170516, SX5E, 3583
20170515, SX5E, 3582
20170519, N225, 19600
20170518, N225, 19590
20170516, N225, 19596
20170515, N225, 19589
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.