Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Let curve inherit type of given rates for its methods #131

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

alecloudenback
Copy link
Member

@alecloudenback alecloudenback commented Jul 4, 2022

closes #107

Todo:

  • Test for all cases
  • Bootstrap/simple curves
  • NS/NSS assume Float64 in the default parameters and aren't given a chance to see the Rates before constructing
  • Smith Wilson curves
  • document _value_type
  • Add doc section

This is tricky too because the construction of curves often uses calculations based on the maturities given as well, so even if the rates are, e.g. Float32, then the calculations will promote if the maturities are Float64.

@codecov
Copy link

codecov bot commented Jul 4, 2022

Codecov Report

Merging #131 (0d9f0f8) into master (87e04ef) will increase coverage by 0.00%.
The diff coverage is 95.00%.

@@           Coverage Diff           @@
##           master     #131   +/-   ##
=======================================
  Coverage   88.58%   88.58%           
=======================================
  Files           9        9           
  Lines         543      552    +9     
=======================================
+ Hits          481      489    +8     
- Misses         62       63    +1     
Impacted Files Coverage Δ
src/Rate.jl 98.01% <80.00%> (-0.94%) ⬇️
src/bootstrap.jl 94.50% <100.00%> (+0.12%) ⬆️
src/utils.jl 91.15% <100.00%> (+0.15%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@alecloudenback
Copy link
Member Author

Per M Abbot on slack:

A common pattern here is to make a 2nd type parameter, so that you can get the eltype in function signatures easily:

struct MyVec{T,A}
   values::A
   MyVec(x::A) where {A<:AbstractVector{T}} where T = new{T,A}(x)
end
MyVec([1,2,3])
fun(x::MyVec{T}) where T = T

instead of

struct MyVec{T}
   values::AbstractVector{T}
end

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make yields inherit type if given something other than Float64
1 participant