vector
-
given a vector of dates (past dates and future ones), how can one extract a new vector showing remaining future dates from today :((
By iterating over the collection and pulling out dates that are in the future ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
By iterating over the collection and pulling out dates that are in the future ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
It saddens me that some people have such poor logical ability.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Different ways to add point data in SQL Server 2008 * Spatial References in SQL Server 2008 My website |
-
It saddens me that some people have such poor logical ability.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Different ways to add point data in SQL Server 2008 * Spatial References in SQL Server 2008 My website |
On the otherhand I'm feeling fairly secure in my job ..
I'm largely language agnostic
After a while they all bug me :doh:
-
By iterating over the collection and pulling out dates that are in the future ?
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Please see my code below, for some reason it fails. can you help definitions: valdate = date today ipos = an indicator = +1 or -1 depending if a bond was bought or borrowed. notional = amount of bond bought or borrowed d1 = date when bond was launched d2 = date when bond matures freq = frequency of interest repayments coupon = interest rate used to calculate coupon repayments Function bondcashflow(valdate, ipos, notional, d1, d2, freq, coupon) Dim p, m As Integer Dim v() Dim cashflow() ReDim cashflow(2, m) As Variant Dim n As Long n = Application.Round(DateDiff(dateinterval.Day, d1, d2) / 365, 0) * freq For i = 0 To n - 1 If freq = 1 Then v(i) = DateAdd(dateinterval.Year, i, d1) ElseIf freq = 2 Then v(i) = DateAdd(dateinterval.Month, 6 * i, d1) ElseIf freq = 4 Then v(i) = DateAdd(dateinterval.Month, 3 * i, d1) Else: v(i) = DateAdd(dateinterval.Year, 12 * i, d1) End If m = 0 If valdate < v(i) Then m = m + 1 End If Next i p = n - m For k = 0 To p - 1 cashflow(k, 1) = v(m) Do While k < p - 1 cashflow(k, 2) = ipos * coupon * notional Loop Next k cashflow(p - 1, 2) = ipos * (notional + coupon * notional) bondcashflow = cashflow End Function