Skip to content

Instantly share code, notes, and snippets.

@nkabir
Created February 6, 2012 22:28
Show Gist options
  • Select an option

  • Save nkabir/1755436 to your computer and use it in GitHub Desktop.

Select an option

Save nkabir/1755436 to your computer and use it in GitHub Desktop.
fincad_fc_function
import fincad_fc_function_call_builder as fc
from datetime import date
try:
fc.initlib()
print fc.fcBuildInformation()
print fc.fcListFunctions()
discount_curve = [[date(2011,8,2),1],
[date(2011,8,3),0.999993734],
[date(2011,8,4),0.999987467],
[date(2011,8,11),0.999942236],
[date(2011,9,6),0.999756853],
[date(2011,10,4),0.999500202],
[date(2011,11,4),0.999183635],
[date(2012,2,6),0.998362482],
[date(2012,5,8),0.997502901],
[date(2012,8,6),0.996530402],
[date(2013,1,17),0.994850586],
[date(2013,4,16),0.993879376],
[date(2013,7,17),0.992814122],
[date(2013,10,17),0.991663674],
[date(2014,1,16),0.990442718],
[date(2014,8,4),0.978655701],
[date(2015,8,4),0.958256571],
[date(2016,8,4),0.935254387],
[date(2018,8,6),0.860600255],
[date(2021,8,4),0.764910425],
[date(2026,8,4),0.599207931],
[date(2031,8,4),0.446583632],
[date(2036,8,4),0.346074011]]
print fc.fcCashDepo(date(2011, 8, 2), date(2011, 8, 4), '3m', 1000000, 0.003148, 'Pay', 'CashUSD', discount_curve, ['Value', 'DV01'])
# should throw a user level exception complaining about the discount curve being incorrect
fc.fcCashDepo(date(2011, 8, 2), date(2011, 8, 4), '3m', 1000000, 0.003148, 'Pay', 'CashUSD', 'Not a discount curve', ['Value', 'DV01'])
except fc.UserLevelF3Error, e:
print e
fc.shutdownlib()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment