# Align\_periods not working?

**URL:** https://dbnomics.discourse.group/t/align-periods-not-working/391
**Category:** Data Issues
**Created:** [January 7, 2021, 9:36am UTC](https://dbnomics.discourse.group/t/align-periods-not-working/391 "2021-01-07T09:36:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jacklucchetti](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jacklucchetti](https://dbnomics.discourse.group/u/jacklucchetti)
#### Post date: [January 7, 2021, 9:36am UTC](https://dbnomics.discourse.group/t/align-periods-not-working/391/1 "2021-01-07T09:36:34Z")

</div>

I’m trying to download a series using the following URL:

[https://api.db.nomics.world/v22/series?series\_ids=ECB/RTD/M.S0.N.C\_SP500.X&format=json&observations=1&align\_periods=1](https://api.db.nomics.world/v22/series?series_ids=ECB/RTD/M.S0.N.C_SP500.X&format=json&observations=1&align_periods=1)

Apparently, the align\_periods flag has no effect (there are quite a few gaps in the observations and these are not filled with NAs). This happens both with JSON and CSV export. Am I missing something?

---

<div class="post-metadata">

### Author: ![cbenz](https://yyz2.discourse-cdn.com/free1/user_avatar/dbnomics.discourse.group/cbenz/32/33_2.png) [@cbenz](https://dbnomics.discourse.group/u/cbenz)
#### Post date: [January 11, 2021, 10:00am UTC](https://dbnomics.discourse.group/t/align-periods-not-working/391/2 "2021-01-11T10:00:17Z")

</div>

Due to 2 recent issues ([#709](https://git.nomics.world/dbnomics-fetchers/management/-/issues/709) and [#860](https://git.nomics.world/dbnomics-fetchers/management/-/issues/860)) related to series alignment, we fixed the alignment algorithm via those 2 merge requests: [!45](https://git.nomics.world/dbnomics/dbnomics-data-model/-/merge_requests/45) and [!46](https://git.nomics.world/dbnomics/dbnomics-data-model/-/merge_requests/46).

Series alignment does not fill the holes in the series periods with NAs – this is called “completion”. And completion was too much error-prone and was the main reason of the 2 issues mentioned above.

Series alignment “just” creates a common period axis among all the matching series, enabling for example a representation of many series on the same table.

This is explained in the documentation: [https://db.nomics.world/docs/web-api/#time-series-completion](https://db.nomics.world/docs/web-api/#time-series-completion) and [https://db.nomics.world/docs/web-api/#time-series-alignment](https://db.nomics.world/docs/web-api/#time-series-alignment)

If my answer is not precise enough, could you give more details about what you would expect from DBnomics web API?

---

<div class="post-metadata">

### Author: ![jacklucchetti](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jacklucchetti](https://dbnomics.discourse.group/u/jacklucchetti)
#### Post date: [January 11, 2021, 2:45pm UTC](https://dbnomics.discourse.group/t/align-periods-not-working/391/3 "2021-01-11T14:45:26Z")

</div>

Ah ok, sorry, there was a misunderstanding on my side. I was under the impression that the “align\_periods” flag was used to perform “completion”, but obviously this is not the case. From your reply, then, I gather that the “align\_periods” switch has no effect when you download just one series. Am I right?

Also: I understand that inserting NAs in “gappy” series is the responsibility of the original provider and if the original series needs completion, then DB.NOMICS will provide it as is and it’s up to the end user to fill the gaps as appropriate. This was not the original policy, though, right?

---

<div class="post-metadata">

### Author: ![cbenz](https://yyz2.discourse-cdn.com/free1/user_avatar/dbnomics.discourse.group/cbenz/32/33_2.png) [@cbenz](https://dbnomics.discourse.group/u/cbenz)
#### Post date: [January 11, 2021, 4:09pm UTC](https://dbnomics.discourse.group/t/align-periods-not-working/391/4 "2021-01-11T16:09:21Z")

</div>

> From your reply, then, I gather that the “align\_periods” switch has no effect when you download just one series. Am I right?

Correct!

> Also: I understand that inserting NAs in “gappy” series is the responsibility of the original provider and if the original series needs completion, then DB.NOMICS will provide it as is and it’s up to the end user to fill the gaps as appropriate. This was not the original policy, though, right?

Before the mentioned updates, series _completion_ was done by default for tabular formats and had to be enabled explicitly for JSON with `complete_series=1` (which is not what you did, based on the URL you provided). Now this feature is completely removed and indeed provider data is provided as is.

---

<div class="post-metadata">

### Author: ![jacklucchetti](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jacklucchetti](https://dbnomics.discourse.group/u/jacklucchetti)
#### Post date: [January 11, 2021, 5:12pm UTC](https://dbnomics.discourse.group/t/align-periods-not-working/391/5 "2021-01-11T17:12:07Z")

</div>

Thank you, Cristophe. This is very useful.
