# New package for shifting of market data

**URL:** <https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026>\
**Category:** Finance and Economics\
**Tags:** announcement\
**Created:** [February 22, 2020, 7:40pm UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026 "2020-02-22T19:40:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [February 22, 2020, 7:40pm UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026/1 "2020-02-22T19:40:05Z")

</div>

Hi,

for sensitivity calculation, stress testing or market risk (VaR, etc.) calculation market data items (like interest rate and FX curves) need to be shifted.  
Often the base items and the shift sizes are not defined on the same maturity grid, thus interpolation is required.

This small package aims at making “calculations” with market data items easier by taking care about interpolations. E.g. when “adding” two curves containing the base interest rates and (maturity dependent) shift sizes, they are interpolated to a common grid before adding.

A `Curve` in this package is essentially a collection of points `(x, y)` , together with an interpolation and extrapolation method.  
`Curve` objects have a number of standard calculation function defined (like addition, multiplication, logarithm), thus they can be used in algebraic expressions analogue to scalars.

> **[GitHub - lungben/Curves.jl: A collection of points (x, y), together with an...](https://github.com/lungben/Curves.jl)**
>
> A collection of points (x, y), together with an interpolation and extrapolation method, on which standard calculation functions are defined. - GitHub - lungben/Curves.jl: A collection of points (x,...

This is my first Julia package, I hope that this will be helpful for you.  
Suggestions, Issues, etc. are welcome!

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [February 22, 2020, 7:54pm UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026/2 "2020-02-22T19:54:12Z")

</div>

Looks cleanly coded 🙂 Consider using inline or block comments for others reading your code. For example, clarify { `etp`, `etpm`, `itpm`, `Titp`} and any clear algorithmic choices you may have made.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [February 23, 2020, 9:56am UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026/3 "2020-02-23T09:56:49Z")

</div>

Thanks for your suggestions!  
I’ll add more docstrings and reasonings about my choices.

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [February 29, 2020, 8:09pm UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026/4 "2020-02-29T20:09:41Z")

</div>

I improved the docstrings, added reasonings / explanations and a few more tests (especially for non-standard interpolation / extrapolation methods taken from Interpolations.jl). Hope that makes my choices more transparent.

Thanks again for your valuable feedback!

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [February 29, 2020, 8:32pm UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026/5 "2020-02-29T20:32:01Z")

</div>

night and day – good work

It would help to add an example of plotting a Curve (or two and their interpolation) to the `README.md`.

---

<div class="post-metadata">

**Author:** ![felipenoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/felipenoris/32/553_2.png) [@felipenoris](https://discourse.julialang.org/u/felipenoris)\
**Post date:** [March 1, 2020, 2:33am UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026/6 "2020-03-01T02:33:03Z")

</div>

Welcome aboard!

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [June 26, 2020, 11:34am UTC](https://discourse.julialang.org/t/new-package-for-shifting-of-market-data/35026/7 "2020-06-26T11:34:14Z")

</div>

Hi,

the Curves package is now registered and contains a bunch of new functionality.

[https://github.com/lungben/Curves.jl](https://github.com/lungben/Curves.jl)

Please let me know if you encounter any issues or are missing anything!
