Initial
This commit is contained in:
391
analytic/ANALYTIC.001
Normal file
391
analytic/ANALYTIC.001
Normal file
@@ -0,0 +1,391 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=analytic - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to analytic - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "analytic - Win32 Release" && "$(CFG)" !=\
|
||||
"analytic - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE on this makefile
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "analytic.mak" CFG="analytic - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "analytic - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "analytic - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
################################################################################
|
||||
# Begin Project
|
||||
# PROP Target_Last_Scanned "analytic - Win32 Debug"
|
||||
CPP=cl.exe
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
|
||||
ALL : "$(OUTDIR)\analytic.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Bond.obj"
|
||||
-@erase "$(INTDIR)\Catmull.obj"
|
||||
-@erase "$(INTDIR)\Coupon.obj"
|
||||
-@erase "$(INTDIR)\Instrmnt.obj"
|
||||
-@erase "$(INTDIR)\Money.obj"
|
||||
-@erase "$(INTDIR)\Pairs.obj"
|
||||
-@erase "$(INTDIR)\portflio.obj"
|
||||
-@erase "$(INTDIR)\Zbond.obj"
|
||||
-@erase "$(OUTDIR)\analytic.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
/Fp"$(INTDIR)/analytic.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/analytic.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/analytic.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Bond.obj" \
|
||||
"$(INTDIR)\Catmull.obj" \
|
||||
"$(INTDIR)\Coupon.obj" \
|
||||
"$(INTDIR)\Instrmnt.obj" \
|
||||
"$(INTDIR)\Money.obj" \
|
||||
"$(INTDIR)\Pairs.obj" \
|
||||
"$(INTDIR)\portflio.obj" \
|
||||
"$(INTDIR)\Zbond.obj"
|
||||
|
||||
"$(OUTDIR)\analytic.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "msvcobj"
|
||||
# PROP Intermediate_Dir "msvcobj"
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.\msvcobj
|
||||
INTDIR=.\msvcobj
|
||||
|
||||
ALL : "..\exe\analytic.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Bond.obj"
|
||||
-@erase "$(INTDIR)\Catmull.obj"
|
||||
-@erase "$(INTDIR)\Coupon.obj"
|
||||
-@erase "$(INTDIR)\Instrmnt.obj"
|
||||
-@erase "$(INTDIR)\Money.obj"
|
||||
-@erase "$(INTDIR)\Pairs.obj"
|
||||
-@erase "$(INTDIR)\portflio.obj"
|
||||
-@erase "$(INTDIR)\Zbond.obj"
|
||||
-@erase "..\exe\analytic.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /c
|
||||
CPP_PROJ=/nologo /MLd /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\
|
||||
"STRICT" /D "__FLAT__" /Fp"$(INTDIR)/analytic.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\msvcobj/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/analytic.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\exe\analytic.lib"
|
||||
LIB32_FLAGS=/nologo /out:"..\exe\analytic.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Bond.obj" \
|
||||
"$(INTDIR)\Catmull.obj" \
|
||||
"$(INTDIR)\Coupon.obj" \
|
||||
"$(INTDIR)\Instrmnt.obj" \
|
||||
"$(INTDIR)\Money.obj" \
|
||||
"$(INTDIR)\Pairs.obj" \
|
||||
"$(INTDIR)\portflio.obj" \
|
||||
"$(INTDIR)\Zbond.obj"
|
||||
|
||||
"..\exe\analytic.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
.c{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
################################################################################
|
||||
# Begin Target
|
||||
|
||||
# Name "analytic - Win32 Release"
|
||||
# Name "analytic - Win32 Debug"
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Zbond.cpp
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
DEP_CPP_ZBOND=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\.\zbond.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Zbond.obj" : $(SOURCE) $(DEP_CPP_ZBOND) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
DEP_CPP_ZBOND=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\zbond.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Zbond.obj" : $(SOURCE) $(DEP_CPP_ZBOND) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Catmull.cpp
|
||||
DEP_CPP_CATMU=\
|
||||
{$(INCLUDE)}"\.\catmull.hpp"\
|
||||
{$(INCLUDE)}"\.\pairs.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Catmull.obj" : $(SOURCE) $(DEP_CPP_CATMU) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Coupon.cpp
|
||||
DEP_CPP_COUPO=\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Coupon.obj" : $(SOURCE) $(DEP_CPP_COUPO) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Instrmnt.cpp
|
||||
DEP_CPP_INSTR=\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Instrmnt.obj" : $(SOURCE) $(DEP_CPP_INSTR) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Money.cpp
|
||||
DEP_CPP_MONEY=\
|
||||
{$(INCLUDE)}"\.\money.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\stdlib.hpp"\
|
||||
{$(INCLUDE)}"\common\string.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Money.obj" : $(SOURCE) $(DEP_CPP_MONEY) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Pairs.cpp
|
||||
DEP_CPP_PAIRS=\
|
||||
{$(INCLUDE)}"\.\pairs.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Pairs.obj" : $(SOURCE) $(DEP_CPP_PAIRS) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Bond.cpp
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
DEP_CPP_BOND_=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Bond.obj" : $(SOURCE) $(DEP_CPP_BOND_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
DEP_CPP_BOND_=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Bond.obj" : $(SOURCE) $(DEP_CPP_BOND_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\portflio.cpp
|
||||
DEP_CPP_PORTF=\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\.\portflio.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\common\block.hpp"\
|
||||
{$(INCLUDE)}"\common\block.tpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\pointer.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\portflio.obj" : $(SOURCE) $(DEP_CPP_PORTF) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
################################################################################
|
||||
168
analytic/ANALYTIC.DSP
Normal file
168
analytic/ANALYTIC.DSP
Normal file
@@ -0,0 +1,168 @@
|
||||
# Microsoft Developer Studio Project File - Name="analytic" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=analytic - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ANALYTIC.MAK".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "ANALYTIC.MAK" CFG="analytic - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "analytic - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "analytic - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ".\Release"
|
||||
# PROP BASE Intermediate_Dir ".\Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ".\Release"
|
||||
# PROP Intermediate_Dir ".\Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ".\Debug"
|
||||
# PROP BASE Intermediate_Dir ".\Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ".\msvcobj"
|
||||
# PROP Intermediate_Dir ".\msvcobj"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /Gz /MTd /GX /Zi /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409
|
||||
# ADD RSC /l 0x409
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\exe\analytic.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "analytic - Win32 Release"
|
||||
# Name "analytic - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Bond.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Catmull.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Coupon.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Instrmnt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Money.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Pairs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\portflio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Zbond.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bond.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\catmull.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\coupon.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\freq.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\instrmnt.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\money.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pairs.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\portflio.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\rate.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zbond.hpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
29
analytic/ANALYTIC.DSW
Normal file
29
analytic/ANALYTIC.DSW
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "analytic"=.\ANALYTIC.DSP - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
391
analytic/ANALYTIC.MAK
Normal file
391
analytic/ANALYTIC.MAK
Normal file
@@ -0,0 +1,391 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=analytic - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to analytic - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "analytic - Win32 Release" && "$(CFG)" !=\
|
||||
"analytic - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!MESSAGE You can specify a configuration when running NMAKE on this makefile
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "analytic.mak" CFG="analytic - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "analytic - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "analytic - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
################################################################################
|
||||
# Begin Project
|
||||
# PROP Target_Last_Scanned "analytic - Win32 Debug"
|
||||
CPP=cl.exe
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
|
||||
ALL : "$(OUTDIR)\analytic.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Bond.obj"
|
||||
-@erase "$(INTDIR)\Catmull.obj"
|
||||
-@erase "$(INTDIR)\Coupon.obj"
|
||||
-@erase "$(INTDIR)\Instrmnt.obj"
|
||||
-@erase "$(INTDIR)\Money.obj"
|
||||
-@erase "$(INTDIR)\Pairs.obj"
|
||||
-@erase "$(INTDIR)\portflio.obj"
|
||||
-@erase "$(INTDIR)\Zbond.obj"
|
||||
-@erase "$(OUTDIR)\analytic.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
|
||||
/Fp"$(INTDIR)/analytic.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\Release/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/analytic.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
LIB32_FLAGS=/nologo /out:"$(OUTDIR)/analytic.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Bond.obj" \
|
||||
"$(INTDIR)\Catmull.obj" \
|
||||
"$(INTDIR)\Coupon.obj" \
|
||||
"$(INTDIR)\Instrmnt.obj" \
|
||||
"$(INTDIR)\Money.obj" \
|
||||
"$(INTDIR)\Pairs.obj" \
|
||||
"$(INTDIR)\portflio.obj" \
|
||||
"$(INTDIR)\Zbond.obj"
|
||||
|
||||
"$(OUTDIR)\analytic.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "msvcobj"
|
||||
# PROP Intermediate_Dir "msvcobj"
|
||||
# PROP Target_Dir ""
|
||||
OUTDIR=.\msvcobj
|
||||
INTDIR=.\msvcobj
|
||||
|
||||
ALL : "..\exe\analytic.lib"
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\Bond.obj"
|
||||
-@erase "$(INTDIR)\Catmull.obj"
|
||||
-@erase "$(INTDIR)\Coupon.obj"
|
||||
-@erase "$(INTDIR)\Instrmnt.obj"
|
||||
-@erase "$(INTDIR)\Money.obj"
|
||||
-@erase "$(INTDIR)\Pairs.obj"
|
||||
-@erase "$(INTDIR)\portflio.obj"
|
||||
-@erase "$(INTDIR)\Zbond.obj"
|
||||
-@erase "..\exe\analytic.lib"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /c
|
||||
CPP_PROJ=/nologo /MLd /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D\
|
||||
"STRICT" /D "__FLAT__" /Fp"$(INTDIR)/analytic.pch" /YX /Fo"$(INTDIR)/" /c
|
||||
CPP_OBJS=.\msvcobj/
|
||||
CPP_SBRS=.\.
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)/analytic.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\exe\analytic.lib"
|
||||
LIB32_FLAGS=/nologo /out:"..\exe\analytic.lib"
|
||||
LIB32_OBJS= \
|
||||
"$(INTDIR)\Bond.obj" \
|
||||
"$(INTDIR)\Catmull.obj" \
|
||||
"$(INTDIR)\Coupon.obj" \
|
||||
"$(INTDIR)\Instrmnt.obj" \
|
||||
"$(INTDIR)\Money.obj" \
|
||||
"$(INTDIR)\Pairs.obj" \
|
||||
"$(INTDIR)\portflio.obj" \
|
||||
"$(INTDIR)\Zbond.obj"
|
||||
|
||||
"..\exe\analytic.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
|
||||
$(LIB32) @<<
|
||||
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
.c{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_OBJS)}.obj:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.c{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cpp{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
.cxx{$(CPP_SBRS)}.sbr:
|
||||
$(CPP) $(CPP_PROJ) $<
|
||||
|
||||
################################################################################
|
||||
# Begin Target
|
||||
|
||||
# Name "analytic - Win32 Release"
|
||||
# Name "analytic - Win32 Debug"
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Zbond.cpp
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
DEP_CPP_ZBOND=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\.\zbond.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Zbond.obj" : $(SOURCE) $(DEP_CPP_ZBOND) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
DEP_CPP_ZBOND=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\zbond.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Zbond.obj" : $(SOURCE) $(DEP_CPP_ZBOND) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Catmull.cpp
|
||||
DEP_CPP_CATMU=\
|
||||
{$(INCLUDE)}"\.\catmull.hpp"\
|
||||
{$(INCLUDE)}"\.\pairs.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Catmull.obj" : $(SOURCE) $(DEP_CPP_CATMU) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Coupon.cpp
|
||||
DEP_CPP_COUPO=\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Coupon.obj" : $(SOURCE) $(DEP_CPP_COUPO) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Instrmnt.cpp
|
||||
DEP_CPP_INSTR=\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Instrmnt.obj" : $(SOURCE) $(DEP_CPP_INSTR) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Money.cpp
|
||||
DEP_CPP_MONEY=\
|
||||
{$(INCLUDE)}"\.\money.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\stdlib.hpp"\
|
||||
{$(INCLUDE)}"\common\string.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Money.obj" : $(SOURCE) $(DEP_CPP_MONEY) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Pairs.cpp
|
||||
DEP_CPP_PAIRS=\
|
||||
{$(INCLUDE)}"\.\pairs.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Pairs.obj" : $(SOURCE) $(DEP_CPP_PAIRS) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Bond.cpp
|
||||
|
||||
!IF "$(CFG)" == "analytic - Win32 Release"
|
||||
|
||||
DEP_CPP_BOND_=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Bond.obj" : $(SOURCE) $(DEP_CPP_BOND_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "analytic - Win32 Debug"
|
||||
|
||||
DEP_CPP_BOND_=\
|
||||
{$(INCLUDE)}"\.\bond.hpp"\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\Bond.obj" : $(SOURCE) $(DEP_CPP_BOND_) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
################################################################################
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\portflio.cpp
|
||||
DEP_CPP_PORTF=\
|
||||
{$(INCLUDE)}"\.\coupon.hpp"\
|
||||
{$(INCLUDE)}"\.\freq.hpp"\
|
||||
{$(INCLUDE)}"\.\instrmnt.hpp"\
|
||||
{$(INCLUDE)}"\.\portflio.hpp"\
|
||||
{$(INCLUDE)}"\.\rate.hpp"\
|
||||
{$(INCLUDE)}"\common\block.hpp"\
|
||||
{$(INCLUDE)}"\common\block.tpp"\
|
||||
{$(INCLUDE)}"\common\except.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.hpp"\
|
||||
{$(INCLUDE)}"\common\gdata.tpp"\
|
||||
{$(INCLUDE)}"\common\math.hpp"\
|
||||
{$(INCLUDE)}"\common\pointer.hpp"\
|
||||
{$(INCLUDE)}"\common\stdio.hpp"\
|
||||
{$(INCLUDE)}"\common\types.hpp"\
|
||||
{$(INCLUDE)}"\common\windows.hpp"\
|
||||
|
||||
|
||||
"$(INTDIR)\portflio.obj" : $(SOURCE) $(DEP_CPP_PORTF) "$(INTDIR)"
|
||||
|
||||
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
################################################################################
|
||||
BIN
analytic/ANALYTIC.MDP
Normal file
BIN
analytic/ANALYTIC.MDP
Normal file
Binary file not shown.
BIN
analytic/ANALYTIC.OPT
Normal file
BIN
analytic/ANALYTIC.OPT
Normal file
Binary file not shown.
41
analytic/ANALYTIC.PLG
Normal file
41
analytic/ANALYTIC.PLG
Normal file
@@ -0,0 +1,41 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: analytic - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP17.tmp" with contents
|
||||
[
|
||||
/nologo /MLd /GX /Z7 /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /Fp".\msvcobj/ANALYTIC.pch" /YX /Fo".\msvcobj/" /Fd".\msvcobj/" /FD /c
|
||||
"E:\work\analytic\Bond.cpp"
|
||||
"E:\work\analytic\Catmull.cpp"
|
||||
"E:\work\analytic\Coupon.cpp"
|
||||
"E:\work\analytic\Instrmnt.cpp"
|
||||
"E:\work\analytic\Money.cpp"
|
||||
"E:\work\analytic\Pairs.cpp"
|
||||
"E:\work\analytic\portflio.cpp"
|
||||
"E:\work\analytic\Zbond.cpp"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP17.tmp"
|
||||
Creating command line "link.exe -lib /nologo /out:"..\exe\analytic.lib" .\msvcobj\Bond.obj .\msvcobj\Catmull.obj .\msvcobj\Coupon.obj .\msvcobj\Instrmnt.obj .\msvcobj\Money.obj .\msvcobj\Pairs.obj .\msvcobj\portflio.obj .\msvcobj\Zbond.obj "
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
Bond.cpp
|
||||
Catmull.cpp
|
||||
Coupon.cpp
|
||||
Instrmnt.cpp
|
||||
Money.cpp
|
||||
Pairs.cpp
|
||||
portflio.cpp
|
||||
Zbond.cpp
|
||||
Creating library...
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
analytic.lib - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
BIN
analytic/ANALYTIC.ncb
Normal file
BIN
analytic/ANALYTIC.ncb
Normal file
Binary file not shown.
147
analytic/BOND.CPP
Normal file
147
analytic/BOND.CPP
Normal file
@@ -0,0 +1,147 @@
|
||||
#include <analytic/bond.hpp>
|
||||
#include <analytic/rate.hpp>
|
||||
#include <analytic/coupon.hpp>
|
||||
#include <common/gdata.hpp>
|
||||
#include <common/math.hpp>
|
||||
#include <common/stdio.hpp>
|
||||
|
||||
Bond::Bond(void)
|
||||
: Instrument(StraightBond), mPar(0.00), mYTM(0), mYield(0.00)
|
||||
{
|
||||
}
|
||||
|
||||
Bond::Bond(const Bond &bond)
|
||||
{
|
||||
*this=bond;
|
||||
}
|
||||
|
||||
Bond::Bond(double par,const Coupon &coupon,int ytm,double price)
|
||||
{
|
||||
Instrument::price(price);
|
||||
Instrument::coupon(coupon);
|
||||
Instrument::type(StraightBond);
|
||||
Bond::par(par);
|
||||
Bond::ytm(ytm);
|
||||
Bond::yield(0.00);
|
||||
}
|
||||
|
||||
Bond::~Bond()
|
||||
{
|
||||
}
|
||||
|
||||
Bond &Bond::operator=(const Bond &bond)
|
||||
{
|
||||
par(bond.par());
|
||||
ytm(bond.ytm());
|
||||
price(bond.price());
|
||||
coupon(bond.coupon());
|
||||
yield(bond.yield());
|
||||
type(StraightBond);
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOL Bond::operator==(const Bond &bond)const
|
||||
{
|
||||
return (par()==bond.par()&&
|
||||
ytm()==bond.ytm()&&
|
||||
price()==bond.price()&&
|
||||
coupon()==bond.coupon()&&
|
||||
yield()==bond.yield()&&
|
||||
type()==bond.type());
|
||||
}
|
||||
|
||||
double Bond::par(void)const
|
||||
{
|
||||
return mPar;
|
||||
}
|
||||
|
||||
void Bond::par(double par)
|
||||
{
|
||||
mPar=par;
|
||||
}
|
||||
|
||||
const Rate &Bond::yield(void)const
|
||||
{
|
||||
return mYield;
|
||||
}
|
||||
|
||||
void Bond::yield(const Rate &yield)
|
||||
{
|
||||
mYield=yield;
|
||||
}
|
||||
|
||||
int Bond::ytm(void)const
|
||||
{
|
||||
return mYTM;
|
||||
}
|
||||
|
||||
void Bond::ytm(int ytm)
|
||||
{
|
||||
mYTM=ytm;
|
||||
}
|
||||
|
||||
// virtuals
|
||||
|
||||
BOOL Bond::cashflows(GlobalData<double> &cashflows)
|
||||
{
|
||||
double semiAnnualPmt;
|
||||
int periods;
|
||||
Coupon coupon(coupon());
|
||||
|
||||
coupon.makeSemiAnnual();
|
||||
periods=coupon.frequency()*ytm();
|
||||
semiAnnualPmt=par()*coupon.decimalRate();
|
||||
cashflows.size(periods);
|
||||
for(int period=0;period<cashflows.size();period++)cashflows[period]=semiAnnualPmt;
|
||||
cashflows[periods-1]=cashflows[periods-1]+par();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
double Bond::discount(Rate yield)
|
||||
{
|
||||
double semiAnnualPmt;
|
||||
double bondPrice;
|
||||
int periods;
|
||||
Coupon coupon(coupon());
|
||||
|
||||
Bond::yield(yield);
|
||||
yield.makeSemiAnnual();
|
||||
coupon.makeSemiAnnual();
|
||||
periods=yield.frequency()*ytm();
|
||||
semiAnnualPmt=par()*coupon.decimalRate();
|
||||
bondPrice=semiAnnualPmt*((1.00-(1.00/::pow(1.00+yield.decimalRate(),periods)))/yield.decimalRate());
|
||||
bondPrice+=par()/::pow(1.00+yield.decimalRate(),periods);
|
||||
price(bondPrice);
|
||||
return price();
|
||||
}
|
||||
|
||||
Rate Bond::discount(double market)
|
||||
{
|
||||
Rate guess(coupon());
|
||||
Rate maxGuess;
|
||||
Rate minGuess;
|
||||
|
||||
maxGuess=guess;
|
||||
minGuess=guess;
|
||||
maxGuess.rate(guess.rate()+12.00);
|
||||
minGuess.rate(guess.rate()-12.00);
|
||||
if(minGuess.rate()<0.00)minGuess.rate(1.00);
|
||||
while(TRUE)
|
||||
{
|
||||
discount(guess);
|
||||
if(price()==market||(price()-market<0.00?market-price():price()-market)<1.00)break;
|
||||
if(market>price())
|
||||
{
|
||||
maxGuess=guess;
|
||||
guess.rate((guess.rate()+minGuess.rate())/2.00);
|
||||
}
|
||||
else
|
||||
{
|
||||
minGuess=guess;
|
||||
guess.rate((guess.rate()+maxGuess.rate())/2.00);
|
||||
}
|
||||
printf("calculated price:%lf market price:%lf\n",price(),market);
|
||||
}
|
||||
yield(guess);
|
||||
return yield();
|
||||
}
|
||||
43
analytic/BOND.HPP
Normal file
43
analytic/BOND.HPP
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef _ANALYTIC_BOND_HPP_
|
||||
#define _ANALYTIC_BOND_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_GLOBALDATA_HPP_
|
||||
#include <common/gdata.hpp>
|
||||
#endif
|
||||
#ifndef _ANALYTIC_INSTRUMENT_HPP_
|
||||
#include <analytic/instrmnt.hpp>
|
||||
#endif
|
||||
#ifndef _ANALYTIC_RATE_HPP_
|
||||
#include <analytic/rate.hpp>
|
||||
#endif
|
||||
|
||||
class Bond : public Instrument
|
||||
{
|
||||
public:
|
||||
Bond(void);
|
||||
Bond(const Bond &bond);
|
||||
Bond(double par,const Coupon &coupon,int ytm,double price=0.00);
|
||||
virtual ~Bond();
|
||||
Bond &operator=(const Bond &bond);
|
||||
BOOL operator==(const Bond &bond)const;
|
||||
double par(void)const;
|
||||
void par(double par);
|
||||
int ytm(void)const;
|
||||
void ytm(int ytm);
|
||||
const Rate &yield(void)const;
|
||||
void yield(const Rate &yield);
|
||||
virtual BOOL cashflows(GlobalData<double> &cashflows); // retrieve cashflows (ie)periodic payments
|
||||
virtual double discount(Rate yield); // given the yield, calculate the price
|
||||
virtual Rate discount(double price); // given the price, calculate the yield
|
||||
private:
|
||||
double mPar;
|
||||
Rate mYield;
|
||||
int mYTM;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
83
analytic/CATMULL.CPP
Normal file
83
analytic/CATMULL.CPP
Normal file
@@ -0,0 +1,83 @@
|
||||
// SOURCE: CATMULL-ROM CUBIC SPLINE
|
||||
// AUTHOR: SEAN M. KESSLER (Adopted from Numerical Recipes in 'C')
|
||||
// DATE: 12/28/1993
|
||||
#include <analytic/catmull.hpp>
|
||||
|
||||
CatmullRom::CatmullRom(void)
|
||||
{
|
||||
}
|
||||
|
||||
CatmullRom::CatmullRom(const CatmullRom &someCatmullRom)
|
||||
{ // no implementation
|
||||
*this=someCatmullRom;
|
||||
}
|
||||
|
||||
inline
|
||||
CatmullRom::~CatmullRom()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
CatmullRom &CatmullRom::operator=(const CatmullRom &/*someCatmullRom*/)
|
||||
{ // no implementation
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOL CatmullRom::performSpline(GlobalData<FloatPairs> &sourcePairs,GlobalData<FloatPairs> &destPairs)
|
||||
{
|
||||
double a0,a1,a2,a3;
|
||||
double dx,dx1,dx2;
|
||||
double dy,dy1,dy2;
|
||||
double endPointOne,endPointTwo,resamplingPos;
|
||||
double xPoint;
|
||||
short clampOne,clampTwo;
|
||||
short direction;
|
||||
short destSize((short)destPairs.size());
|
||||
short sourceSize((short)sourcePairs.size());
|
||||
short inputIndex,index;
|
||||
|
||||
if(sourceSize<2||destSize<2)return FALSE;
|
||||
if(sourcePairs[0].column()<sourcePairs[1].column())
|
||||
{
|
||||
if(destPairs[0].column()<sourcePairs[0].column()||
|
||||
destPairs[destSize-1].column()>sourcePairs[sourceSize-1].column())direction=0;
|
||||
else direction=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(destPairs[0].column()>sourcePairs[0].column()||
|
||||
destPairs[destSize-1].column()<sourcePairs[sourceSize-1].column())direction=0;
|
||||
else direction=-1;
|
||||
}
|
||||
if(!direction)return FALSE;
|
||||
if(1==direction)endPointTwo=destPairs[0].column()-1;
|
||||
else endPointTwo=destPairs[0].column()+1;
|
||||
for(index=0;index<destSize;index++)
|
||||
{
|
||||
resamplingPos=destPairs[index].column();
|
||||
if((1==direction&&resamplingPos>endPointTwo)||(-1==direction&&resamplingPos<endPointTwo))
|
||||
{
|
||||
for(inputIndex=0;inputIndex<sourceSize&&resamplingPos>sourcePairs[inputIndex].column();inputIndex++);
|
||||
if(resamplingPos<sourcePairs[inputIndex].column())inputIndex--;
|
||||
if(inputIndex<0)inputIndex=0;
|
||||
endPointOne=sourcePairs[inputIndex].column();
|
||||
endPointTwo=sourcePairs[inputIndex+1].column();
|
||||
clampOne=FloatPairs::fpmax(inputIndex-1,0);
|
||||
clampTwo=FloatPairs::fpmin(inputIndex+2,sourceSize-1);
|
||||
dx=1.0/(endPointTwo-endPointOne);
|
||||
dx1=1.0/(endPointTwo-sourcePairs[clampOne].column());
|
||||
dx2=1.0/(sourcePairs[clampTwo].column()-endPointOne);
|
||||
dy=(sourcePairs[inputIndex+1].row()-sourcePairs[inputIndex].row())*dx;
|
||||
dy1=(sourcePairs[inputIndex+1].row()-sourcePairs[clampOne].row())*dx1;
|
||||
dy2=(sourcePairs[clampTwo].row()-sourcePairs[inputIndex].row())*dx2;
|
||||
a0=sourcePairs[inputIndex].row();
|
||||
a1=dy1;
|
||||
a2=dx*(3*dy-2*dy1-dy2);
|
||||
a3=dx*dx*(-2*dy+dy1+dy2);
|
||||
}
|
||||
xPoint=resamplingPos-endPointOne;
|
||||
destPairs[index].row(((a3*xPoint+a2)*xPoint+a1)*xPoint+a0);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
49
analytic/CATMULL.HPP
Normal file
49
analytic/CATMULL.HPP
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef _COMMON_CATMULL_HPP_
|
||||
#define _COMMON_CATMULL_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_GLOBALDATA_HPP_
|
||||
#include <common/gdata.hpp>
|
||||
#endif
|
||||
#ifndef _ANALYTIC_FLOATPAIRS_HPP_
|
||||
#include <analytic/pairs.hpp>
|
||||
#endif
|
||||
|
||||
// Sample usage of the spline generator...
|
||||
// CarmullRom splineGen;
|
||||
// PureVector<FloatPairs> srcPairs;
|
||||
// PureVector<FloatPairs> dstPairs;
|
||||
// srcPairs[0]=FloatPairs(1.00,25);
|
||||
// srcPairs[1]=FloatPairs(4.00,50);
|
||||
// dstPairs[0]=FloatPairs(1.00,0.00);
|
||||
// dstPairs[1]=FloatPairs(2.00,0.00);
|
||||
// dstPairs[2]=FloatPairs(3.00,0.00);
|
||||
// dstPairs[3]=FloatPairs(4.00,0.00);
|
||||
// splineGen.performSpline(srcPairs,dstPairs);
|
||||
// ... dstPairs contains interpolation of 25-50 across four points
|
||||
|
||||
class CatmullRom
|
||||
{
|
||||
public:
|
||||
CatmullRom(void);
|
||||
virtual ~CatmullRom();
|
||||
BOOL performSpline(GlobalData<FloatPairs> &sourcePoints,GlobalData<FloatPairs> &destPoints);
|
||||
private:
|
||||
CatmullRom(const CatmullRom &someCatmullRom);
|
||||
CatmullRom &operator=(const CatmullRom &someCatmullRom);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
92
analytic/COUPON.CPP
Normal file
92
analytic/COUPON.CPP
Normal file
@@ -0,0 +1,92 @@
|
||||
#include <analytic/coupon.hpp>
|
||||
|
||||
Coupon::Coupon(void)
|
||||
: mRate(0.00), mDecimalRate(0.00), mFrequency(Annual)
|
||||
{
|
||||
}
|
||||
|
||||
Coupon::Coupon(const Coupon &coupon)
|
||||
{
|
||||
*this=coupon;
|
||||
}
|
||||
|
||||
Coupon::Coupon(double rate,Frequency frequency)
|
||||
: mRate(rate), mDecimalRate(rate/100.00), mFrequency(frequency)
|
||||
{
|
||||
}
|
||||
|
||||
Coupon::~Coupon()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL Coupon::operator==(const Coupon &coupon)const
|
||||
{
|
||||
return (rate()==coupon.rate()&&
|
||||
frequency()==coupon.frequency());
|
||||
}
|
||||
|
||||
BOOL Coupon::operator>(const Coupon &coupon)const
|
||||
{
|
||||
Coupon cpn(coupon);
|
||||
|
||||
cpn.frequency(frequency());
|
||||
return rate()>cpn.rate();
|
||||
}
|
||||
|
||||
BOOL Coupon::operator<(const Coupon &coupon)const
|
||||
{
|
||||
Coupon cpn(coupon);
|
||||
|
||||
cpn.frequency(frequency());
|
||||
return rate()<cpn.rate();
|
||||
}
|
||||
|
||||
Coupon &Coupon::operator=(const Coupon &coupon)
|
||||
{
|
||||
rate(coupon.rate());
|
||||
frequency(coupon.frequency());
|
||||
return *this;
|
||||
}
|
||||
|
||||
double Coupon::rate(void)const
|
||||
{
|
||||
return mRate;
|
||||
}
|
||||
|
||||
void Coupon::rate(double rate)
|
||||
{
|
||||
mRate=rate;
|
||||
mDecimalRate=mRate/100.00;
|
||||
}
|
||||
|
||||
double Coupon::decimalRate(void)const
|
||||
{
|
||||
return mDecimalRate;
|
||||
}
|
||||
|
||||
Frequency Coupon::frequency(void)const
|
||||
{
|
||||
return mFrequency;
|
||||
}
|
||||
|
||||
void Coupon::frequency(const Frequency &frequency)
|
||||
{
|
||||
mFrequency=frequency;
|
||||
}
|
||||
|
||||
void Coupon::makeAnnual(void)
|
||||
{
|
||||
mRate*=(double)mFrequency;
|
||||
mDecimalRate=mRate/100.00;
|
||||
mFrequency=Annual;
|
||||
}
|
||||
|
||||
void Coupon::makeSemiAnnual(void)
|
||||
{
|
||||
mRate*=(double(mFrequency)/double(SemiAnnual));
|
||||
mDecimalRate=mRate/100.00;
|
||||
mFrequency=SemiAnnual;
|
||||
}
|
||||
|
||||
|
||||
|
||||
33
analytic/COUPON.HPP
Normal file
33
analytic/COUPON.HPP
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _ANALYTIC_COUPON_HPP_
|
||||
#define _ANALYTIC_COUPON_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _ANALYTIC_FREQUENCY_HPP_
|
||||
#include <analytic/freq.hpp>
|
||||
#endif
|
||||
|
||||
class Coupon
|
||||
{
|
||||
public:
|
||||
Coupon(void);
|
||||
Coupon(const Coupon &coupon);
|
||||
Coupon(double rate,Frequency frequency=Annual);
|
||||
virtual ~Coupon();
|
||||
BOOL operator==(const Coupon &coupon)const;
|
||||
BOOL operator>(const Coupon &coupon)const;
|
||||
BOOL operator<(const Coupon &coupon)const;
|
||||
Coupon &operator=(const Coupon &coupon);
|
||||
double rate(void)const;
|
||||
void rate(double rate);
|
||||
double decimalRate(void)const;
|
||||
Frequency frequency(void)const;
|
||||
void frequency(const Frequency &frequency);
|
||||
void makeAnnual(void);
|
||||
void makeSemiAnnual(void);
|
||||
private:
|
||||
double mRate;
|
||||
double mDecimalRate;
|
||||
Frequency mFrequency;
|
||||
};
|
||||
#endif
|
||||
BIN
analytic/Debug/Test.obj
Normal file
BIN
analytic/Debug/Test.obj
Normal file
Binary file not shown.
BIN
analytic/Debug/test.exe
Normal file
BIN
analytic/Debug/test.exe
Normal file
Binary file not shown.
BIN
analytic/Debug/test.ilk
Normal file
BIN
analytic/Debug/test.ilk
Normal file
Binary file not shown.
BIN
analytic/Debug/test.pch
Normal file
BIN
analytic/Debug/test.pch
Normal file
Binary file not shown.
BIN
analytic/Debug/test.pdb
Normal file
BIN
analytic/Debug/test.pdb
Normal file
Binary file not shown.
BIN
analytic/Debug/vc60.idb
Normal file
BIN
analytic/Debug/vc60.idb
Normal file
Binary file not shown.
BIN
analytic/Debug/vc60.pdb
Normal file
BIN
analytic/Debug/vc60.pdb
Normal file
Binary file not shown.
6
analytic/FREQ.HPP
Normal file
6
analytic/FREQ.HPP
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef _ANALYTIC_FREQUENCY_HPP_
|
||||
#define _ANALYTIC_FREQUENCY_HPP_
|
||||
|
||||
enum Frequency{Annual=1,SemiAnnual=2,Quarterly=4,Monthly=12};
|
||||
|
||||
#endif
|
||||
92
analytic/INSTRMNT.CPP
Normal file
92
analytic/INSTRMNT.CPP
Normal file
@@ -0,0 +1,92 @@
|
||||
#include <analytic/instrmnt.hpp>
|
||||
#include <math.h>
|
||||
|
||||
Instrument::Instrument(Type type)
|
||||
: mPrice(0.00), mType(type)
|
||||
{
|
||||
}
|
||||
|
||||
Instrument::Instrument(const Instrument &instrument)
|
||||
{
|
||||
*this=instrument;
|
||||
}
|
||||
|
||||
Instrument::~Instrument()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL Instrument::operator==(const Instrument &instrument)const
|
||||
{
|
||||
return (price()==instrument.price()&&
|
||||
coupon()==instrument.coupon()&&
|
||||
type()==instrument.type());
|
||||
}
|
||||
|
||||
Instrument &Instrument::operator=(const Instrument &instrument)
|
||||
{
|
||||
price(instrument.price());
|
||||
coupon(instrument.coupon());
|
||||
type(instrument.type());
|
||||
return *this;
|
||||
}
|
||||
|
||||
double Instrument::price(void)const
|
||||
{
|
||||
return mPrice;
|
||||
}
|
||||
|
||||
void Instrument::price(double price)
|
||||
{
|
||||
mPrice=price;
|
||||
}
|
||||
|
||||
const Coupon &Instrument::coupon(void)const
|
||||
{
|
||||
return mCoupon;
|
||||
}
|
||||
|
||||
void Instrument::coupon(const Coupon &coupon)
|
||||
{
|
||||
mCoupon=coupon;
|
||||
}
|
||||
|
||||
Instrument::Type Instrument::type(void)const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
||||
void Instrument::type(Type type)
|
||||
{
|
||||
mType=type;
|
||||
}
|
||||
|
||||
// **** virtuals
|
||||
|
||||
double Instrument::par(void)const
|
||||
{
|
||||
return 0.00;
|
||||
}
|
||||
|
||||
BOOL Instrument::cashflows(GlobalData<double> &cashflows)
|
||||
{
|
||||
cashflows.size(0);
|
||||
return cashflows.size();
|
||||
}
|
||||
|
||||
double Instrument::fv(int periods)
|
||||
{
|
||||
Coupon ac(mCoupon);
|
||||
ac.makeAnnual();
|
||||
return price()*::pow(1.00+(ac.rate()/100.00)/ac.frequency(),ac.frequency()*periods);
|
||||
}
|
||||
|
||||
double Instrument::discount(double fv,int periods)
|
||||
{
|
||||
Coupon ac(mCoupon);
|
||||
ac.makeAnnual();
|
||||
price(fv*(1.00/::pow(1+ac.rate()/100.00,periods)));
|
||||
return price();
|
||||
}
|
||||
|
||||
|
||||
|
||||
35
analytic/INSTRMNT.HPP
Normal file
35
analytic/INSTRMNT.HPP
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef _ANALYTIC_INSTRUMENT_HPP_
|
||||
#define _ANALYTIC_INSTRUMENT_HPP_
|
||||
#ifndef _COMMON_GLOBALDATA_HPP_
|
||||
#include <common/gdata.hpp>
|
||||
#endif
|
||||
#ifndef _ANALYTIC_COUPON_HPP_
|
||||
#include <analytic/coupon.hpp>
|
||||
#endif
|
||||
|
||||
class Instrument
|
||||
{
|
||||
public:
|
||||
enum Type{Generic,StraightBond,ZeroCouponBond};
|
||||
Instrument(Type type=Generic);
|
||||
Instrument(const Instrument &instrument);
|
||||
virtual ~Instrument();
|
||||
BOOL operator==(const Instrument &instrument)const;
|
||||
Instrument &operator=(const Instrument &instrument);
|
||||
double price(void)const;
|
||||
void price(double price);
|
||||
const Coupon &coupon(void)const;
|
||||
void coupon(const Coupon &coupon);
|
||||
Type type(void)const;
|
||||
void type(Type type);
|
||||
virtual BOOL cashflows(GlobalData<double> &cashflows);
|
||||
virtual double par(void)const;
|
||||
virtual double fv(int periods);
|
||||
virtual double discount(double fv,int periods);
|
||||
private:
|
||||
double mPrice;
|
||||
Coupon mCoupon;
|
||||
Type mType;
|
||||
};
|
||||
#endif
|
||||
|
||||
18
analytic/MAIN.CPP
Normal file
18
analytic/MAIN.CPP
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <analytic/mainwnd.hpp>
|
||||
#include <common/openfile.hpp>
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
File fileDummy;
|
||||
Point ptDummy;
|
||||
Application mainApp(argc,argv);
|
||||
MainWindow mainWindow(mainApp);
|
||||
mainApp.main();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
469
analytic/MAINWND.CPP
Normal file
469
analytic/MAINWND.CPP
Normal file
@@ -0,0 +1,469 @@
|
||||
#include <analytic/mainwnd.hpp>
|
||||
#include <analytic/money.hpp>
|
||||
#include <analytic/bond.hpp>
|
||||
#include <analytic/portfolio.hpp>
|
||||
#include <analytic/catmull.hpp>
|
||||
#include <common/openfile.hpp>
|
||||
#include <gui/extent.hpp>
|
||||
#include <gui/expose.hpp>
|
||||
#include <gui/configure.hpp>
|
||||
#include <gui/purehdc.hpp>
|
||||
|
||||
MainWindow::MainWindow(Application &mainApp)
|
||||
: Window(mainApp), mCurrentRow(0)
|
||||
{
|
||||
initHandlers();
|
||||
createControls();
|
||||
initControls();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::initHandlers(void)
|
||||
{
|
||||
mCancelHandler.setCallback(this,&cancelHandler);
|
||||
mCalcHandler.setCallback(this,&calcHandler);
|
||||
mAddHandler.setCallback(this,&addHandler);
|
||||
mDelHandler.setCallback(this,&delHandler);
|
||||
mSetHandler.setCallback(this,&setHandler);
|
||||
mSaveHandler.setCallback(this,&saveHandler);
|
||||
mLoadHandler.setCallback(this,&loadHandler);
|
||||
mSelectRowHandler.setCallback(this,&selectRowHandler);
|
||||
mSaveFileSelectHandler.setCallback(this,&saveFileSelectHandler);
|
||||
mLoadFileSelectHandler.setCallback(this,&loadFileSelectHandler);
|
||||
}
|
||||
|
||||
void MainWindow::createControls(void)
|
||||
{
|
||||
create();
|
||||
size(InitialWidth,InitialHeight);
|
||||
setCaption("Portfolio v1.0.0");
|
||||
position(CenterPosition);
|
||||
|
||||
show();
|
||||
|
||||
mPixmap.create(*this,220,120);
|
||||
mPixmap.clear();
|
||||
|
||||
mLabelBond.create("Bond:");
|
||||
mLabelCoupon.create("Coupon:");
|
||||
mLabelYTM.create("YTM:");;
|
||||
mLabelPar.create("Par:");
|
||||
mLabelPrice.create("Price:");
|
||||
mLabelYield.create("Yield:");
|
||||
mLabelYieldValue.create();
|
||||
|
||||
mEntryBond.create();
|
||||
mEntryCoupon.create();
|
||||
mEntryYTM.create();
|
||||
mEntryPar.create();
|
||||
mEntryPrice.create();
|
||||
|
||||
mCancelButton.setHandler(&mCancelHandler);
|
||||
mCancelButton.create("Quit");
|
||||
mCalcButton.setHandler(&mCalcHandler);
|
||||
mCalcButton.create("Yield");
|
||||
|
||||
mAddButton.setHandler(&mAddHandler);
|
||||
mAddButton.create("Add");
|
||||
mDelButton.setHandler(&mDelHandler);
|
||||
mDelButton.create("Remove");
|
||||
mSaveButton.setHandler(&mSaveHandler);
|
||||
mSaveButton.create("Save");
|
||||
mLoadButton.setHandler(&mLoadHandler);
|
||||
mLoadButton.create("Load");
|
||||
mSetButton.setHandler(&mSetHandler);
|
||||
mSetButton.create("Set");
|
||||
|
||||
mStatusBar.create();
|
||||
Block<String> strColTitles;
|
||||
strColTitles.insert(String("Bond"));
|
||||
strColTitles.insert(String("CPN"));
|
||||
strColTitles.insert(String("YTM"));
|
||||
strColTitles.insert(String("Par"));
|
||||
strColTitles.insert(String("Price"));
|
||||
mPortfolioList.create(strColTitles);
|
||||
mPortfolioList.setSelectRowHandler(&mSelectRowHandler);
|
||||
mPortfolioList.setColumnWidth(0,50);
|
||||
mPortfolioList.setColumnWidth(1,50);
|
||||
mPortfolioList.setColumnWidth(2,50);
|
||||
mPortfolioList.setColumnWidth(3,100);
|
||||
mPortfolioList.setColumnWidth(4,100);
|
||||
mWinGrid.create(14,6);
|
||||
mWinGrid.setColSpacing(52);
|
||||
mWinGrid.setRowSpacing(3);
|
||||
|
||||
mWinGrid.attach(mCancelButton,4,6,0,1);
|
||||
mWinGrid.attach(mCalcButton,4,6,1,2);
|
||||
mWinGrid.attach(mAddButton,4,6,7,8);
|
||||
mWinGrid.attach(mDelButton,4,6,8,9);
|
||||
mWinGrid.attach(mSetButton,4,6,9,10);
|
||||
mWinGrid.attach(mSaveButton,4,6,2,3);
|
||||
mWinGrid.attach(mLoadButton,4,6,3,4);
|
||||
mWinGrid.attach(mStatusBar,0,6,13,14);
|
||||
mWinGrid.attach(mPortfolioList,0,5,0,6);
|
||||
|
||||
mWinGrid.attach(mLabelBond,3,4,6,7);
|
||||
mWinGrid.attach(mLabelCoupon,3,4,7,8);
|
||||
mWinGrid.attach(mLabelYTM,3,4,8,9);
|
||||
mWinGrid.attach(mLabelPar,3,4,9,10);
|
||||
mWinGrid.attach(mLabelPrice,3,4,10,11);
|
||||
mWinGrid.attach(mLabelYield,3,4,11,12);
|
||||
mWinGrid.attach(mLabelYieldValue,4,5,11,12);
|
||||
mWinGrid.attach(mEntryBond,4,5,6,7);
|
||||
mWinGrid.attach(mEntryCoupon,4,5,7,8);
|
||||
mWinGrid.attach(mEntryYTM,4,5,8,9);
|
||||
mWinGrid.attach(mEntryPar,4,5,9,10);
|
||||
mWinGrid.attach(mEntryPrice,4,5,10,11);
|
||||
mWinGrid.attach(mPixmap,0,4,6,11);
|
||||
|
||||
*this+=mWinGrid;
|
||||
mWinGrid.show();
|
||||
mPixmap.show();
|
||||
mCancelButton.show();
|
||||
mCalcButton.show();
|
||||
mAddButton.show();
|
||||
mDelButton.show();
|
||||
mSaveButton.show();
|
||||
mLoadButton.show();
|
||||
mSetButton.show();
|
||||
mStatusBar.show();
|
||||
mPortfolioList.show();
|
||||
mLabelBond.show();
|
||||
mLabelCoupon.show();
|
||||
mLabelYTM.show();
|
||||
mLabelPar.show();
|
||||
mLabelPrice.show();
|
||||
mLabelYield.show();
|
||||
mLabelYieldValue.show();
|
||||
|
||||
mEntryBond.show();
|
||||
mEntryCoupon.show();
|
||||
mEntryYTM.show();
|
||||
mEntryPar.show();
|
||||
mEntryPrice.show();
|
||||
}
|
||||
|
||||
void MainWindow::initControls(void)
|
||||
{
|
||||
mStatusBar.setText("Ready.");
|
||||
}
|
||||
|
||||
// callbacks
|
||||
|
||||
int MainWindow::cancelHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
CallbackData cbData(someCallbackData);
|
||||
quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MainWindow::calcHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
calcYield();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainWindow::calcYield(void)
|
||||
{
|
||||
Portfolio portfolio;
|
||||
String strYield;
|
||||
|
||||
getPortfolio(portfolio);
|
||||
if(!portfolio.size())return;
|
||||
Rate yield(portfolio.yield());
|
||||
::sprintf(strYield,"%5.3lf",yield.decimalRate()*100.00);
|
||||
mLabelYieldValue.setLabel(strYield);
|
||||
}
|
||||
|
||||
int MainWindow::addHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
String strEntry;
|
||||
String strFormat;
|
||||
int row;
|
||||
|
||||
mPortfolioList.addRow();
|
||||
row=mPortfolioList.getRowCount();
|
||||
mEntryBond.getText(strEntry);
|
||||
mPortfolioList.setCellData(row-1,0,strEntry);
|
||||
mEntryCoupon.getText(strEntry);
|
||||
::sprintf(strFormat,"%5.3lf",::atof(strEntry));
|
||||
mPortfolioList.setCellData(row-1,1,strFormat);
|
||||
mEntryYTM.getText(strEntry);
|
||||
::sprintf(strFormat,"%d",::atoi(strEntry));
|
||||
mPortfolioList.setCellData(row-1,2,strFormat);
|
||||
mEntryPar.getText(strEntry);
|
||||
mPortfolioList.setCellData(row-1,3,(String)Money(::atof(strEntry)));
|
||||
mEntryPrice.getText(strEntry);
|
||||
mPortfolioList.setCellData(row-1,4,(String)Money(::atof(strEntry)));
|
||||
calcYield();
|
||||
graphCashflows();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MainWindow::delHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
if(!mPortfolioList.getRowCount())return 0;
|
||||
mPortfolioList.removeRow(currentRow());
|
||||
calcYield();
|
||||
graphCashflows();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MainWindow::saveHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
if(!mOpenDialog.create("Save Portfolio"))return 0;
|
||||
mOpenDialog.setSelectHandler(&mSaveFileSelectHandler);
|
||||
}
|
||||
|
||||
int MainWindow::loadHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
if(!mOpenDialog.create("Load Portfolio"))return 0;
|
||||
mOpenDialog.setSelectHandler(&mLoadFileSelectHandler);
|
||||
}
|
||||
|
||||
int MainWindow::setHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
String strEntry;
|
||||
String strFormat;
|
||||
|
||||
if(!mPortfolioList.getRowCount())return 0;
|
||||
mEntryBond.getText(strEntry);
|
||||
mPortfolioList.setCellData(currentRow(),0,strEntry);
|
||||
mEntryCoupon.getText(strEntry);
|
||||
::sprintf(strFormat,"%5.3lf",::atof(strEntry));
|
||||
mPortfolioList.setCellData(currentRow(),1,strFormat);
|
||||
mEntryYTM.getText(strEntry);
|
||||
::sprintf(strFormat,"%d",::atoi(strEntry));
|
||||
mPortfolioList.setCellData(currentRow(),2,strFormat);
|
||||
mEntryPar.getText(strEntry);
|
||||
mPortfolioList.setCellData(currentRow(),3,(String)Money(::atof(strEntry)));
|
||||
mEntryPrice.getText(strEntry);
|
||||
mPortfolioList.setCellData(currentRow(),4,(String)Money(::atof(strEntry)));
|
||||
calcYield();
|
||||
graphCashflows();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MainWindow::saveFileSelectHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
String strPathFileName(*(String*)someCallbackData.data());
|
||||
Block<String> listLines;
|
||||
File saveFile;
|
||||
|
||||
if(strPathFileName.isNull())return 0;
|
||||
if(!getLines(listLines))return 0;
|
||||
saveFile.open(strPathFileName,"wb");
|
||||
for(int index=0;index<listLines.size();index++)saveFile.writeLine(listLines[index]);
|
||||
saveFile.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MainWindow::loadFileSelectHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
String strPathFileName(*(String*)someCallbackData.data());
|
||||
Block<String> strLines;
|
||||
String strLine;
|
||||
File inFile;
|
||||
char *ptrLine;
|
||||
int rows;
|
||||
|
||||
inFile.open(strPathFileName,"rb");
|
||||
if(!inFile.isOkay())return 0;
|
||||
mPortfolioList.clear();
|
||||
while(!inFile.eof())
|
||||
{
|
||||
inFile.getLine(strLine);
|
||||
if(strLine.isNull())continue;
|
||||
mPortfolioList.addRow();
|
||||
rows=mPortfolioList.getRowCount();
|
||||
ptrLine=(char*)strLine;
|
||||
ptrLine=::strtok(ptrLine,",");
|
||||
if(!ptrLine)continue;
|
||||
mPortfolioList.setCellData(rows-1,0,ptrLine);
|
||||
ptrLine=::strtok(0,",");
|
||||
if(!ptrLine)continue;
|
||||
mPortfolioList.setCellData(rows-1,1,ptrLine);
|
||||
ptrLine=::strtok(0,",");
|
||||
if(!ptrLine)continue;
|
||||
mPortfolioList.setCellData(rows-1,2,ptrLine);
|
||||
ptrLine=::strtok(0,",");
|
||||
if(!ptrLine)continue;
|
||||
mPortfolioList.setCellData(rows-1,3,(String)Money(::atof(ptrLine)));
|
||||
ptrLine=::strtok(0,",\0");
|
||||
if(!ptrLine)continue;
|
||||
mPortfolioList.setCellData(rows-1,4,(String)Money(::atof(ptrLine)));
|
||||
}
|
||||
calcYield();
|
||||
graphCashflows();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainWindow::graphCashflows(void)
|
||||
{
|
||||
GlobalData<double> cashflows;
|
||||
GlobalData<FloatPairs> srcPairs;
|
||||
GlobalData<FloatPairs> dstPairs;
|
||||
CatmullRom splineGen;
|
||||
Portfolio portfolio;
|
||||
double maxFlow;
|
||||
double clampFactor;
|
||||
int recLen;
|
||||
|
||||
mPixmap.clear();
|
||||
getPortfolio(portfolio);
|
||||
portfolio.getCashflows(cashflows);
|
||||
recLen=mPixmap.width()/cashflows.size();
|
||||
if(!cashflows.size())return;
|
||||
for(int index=0;index<cashflows.size();index++)
|
||||
{
|
||||
if(!index)maxFlow=cashflows[index];
|
||||
else if(cashflows[index]>maxFlow)maxFlow=cashflows[index];
|
||||
}
|
||||
clampFactor=(float)mPixmap.height()/(float)maxFlow;
|
||||
for(int index=0;index<cashflows.size();index++)cashflows[index]=cashflows[index]*clampFactor;
|
||||
PureDevice pureDevice(*this);
|
||||
pureDevice.setForeground(RGBColor(0,255,0));
|
||||
for(int index=0,xLoc=0;index<cashflows.size();index++,xLoc+=recLen)
|
||||
{
|
||||
Rectangle rect(xLoc,mPixmap.height()-cashflows[index],xLoc+5,mPixmap.height());
|
||||
mPixmap.pixmap().rectangle(pureDevice,rect);
|
||||
}
|
||||
mPixmap.draw();
|
||||
}
|
||||
|
||||
void MainWindow::graphCashflowsSpline(void)
|
||||
{
|
||||
GlobalData<double> cashflows;
|
||||
GlobalData<FloatPairs> srcPairs;
|
||||
GlobalData<FloatPairs> dstPairs;
|
||||
CatmullRom splineGen;
|
||||
Portfolio portfolio;
|
||||
double maxFlow;
|
||||
double clampFactor;
|
||||
|
||||
mPixmap.clear();
|
||||
getPortfolio(portfolio);
|
||||
portfolio.getCashflows(cashflows);
|
||||
if(!cashflows.size())return;
|
||||
for(int index=0;index<cashflows.size();index++)
|
||||
{
|
||||
if(!index)maxFlow=cashflows[index];
|
||||
else if(cashflows[index]>maxFlow)maxFlow=cashflows[index];
|
||||
}
|
||||
clampFactor=(float)mPixmap.height()/(float)maxFlow;
|
||||
for(int index=0;index<cashflows.size();index++)cashflows[index]=cashflows[index]*clampFactor;
|
||||
srcPairs.size(cashflows.size());
|
||||
dstPairs.size(mPixmap.width());
|
||||
clampFactor=srcPairs.size()/(float)mPixmap.width();
|
||||
double invFactor=(float)mPixmap.width()/(float)srcPairs.size();
|
||||
for(int index=0;index<srcPairs.size();index++)srcPairs[index]=FloatPairs(((float)index+1.00)*invFactor,cashflows[index]);
|
||||
for(int index=0;index<dstPairs.size();index++)dstPairs[index]=FloatPairs(index+1,0.00);
|
||||
dstPairs[0].column(srcPairs[0].column());
|
||||
dstPairs[dstPairs.size()-1].column(srcPairs[srcPairs.size()-1].column());
|
||||
splineGen.performSpline(srcPairs,dstPairs);
|
||||
PureDevice pureDevice(*this);
|
||||
pureDevice.setForeground(RGBColor(0,255,0));
|
||||
for(int index=0;index<dstPairs.size();index++)
|
||||
mPixmap.pixmap().line(pureDevice,Point(index,mPixmap.height()),Point(index,mPixmap.height()-dstPairs[index].row()));
|
||||
mPixmap.draw();
|
||||
}
|
||||
|
||||
int MainWindow::selectRowHandler(CallbackData &someCallbackData)
|
||||
{
|
||||
String strEntry;
|
||||
|
||||
Point &rcPoint=*((Point*)someCallbackData.data());
|
||||
mCurrentRow=rcPoint.x();
|
||||
mPortfolioList.getCellData(rcPoint.x(),0,strEntry);
|
||||
mEntryBond.setText(strEntry);
|
||||
mPortfolioList.getCellData(rcPoint.x(),1,strEntry);
|
||||
mEntryCoupon.setText(strEntry);
|
||||
mPortfolioList.getCellData(rcPoint.x(),2,strEntry);
|
||||
mEntryYTM.setText(strEntry);
|
||||
mPortfolioList.getCellData(rcPoint.x(),3,strEntry);
|
||||
strEntry.removeTokens("$ ,");
|
||||
mEntryPar.setText(strEntry);
|
||||
mPortfolioList.getCellData(rcPoint.x(),4,strEntry);
|
||||
strEntry.removeTokens("$ ,");
|
||||
mEntryPrice.setText(strEntry);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MainWindow::getLines(Block<String> &listLines)
|
||||
{
|
||||
String strEntry;
|
||||
String strLine;
|
||||
int rows;
|
||||
|
||||
listLines.remove();
|
||||
rows=mPortfolioList.getRowCount();
|
||||
for(int row=0;row<rows;row++)
|
||||
{
|
||||
String strLine;
|
||||
mPortfolioList.getCellData(row,0,strEntry);
|
||||
strLine+=strEntry+String(",");
|
||||
mPortfolioList.getCellData(row,1,strEntry);
|
||||
strLine+=strEntry+String(",");
|
||||
mPortfolioList.getCellData(row,2,strEntry);
|
||||
strLine+=strEntry+String(",");
|
||||
mPortfolioList.getCellData(row,3,strEntry);
|
||||
strEntry.removeTokens("$ ,");
|
||||
strLine+=strEntry+String(",");
|
||||
mPortfolioList.getCellData(row,4,strEntry);
|
||||
strEntry.removeTokens("$ ,");
|
||||
strLine+=strEntry;
|
||||
listLines.insert(strLine);
|
||||
}
|
||||
return listLines.size();
|
||||
}
|
||||
|
||||
int MainWindow::getPortfolio(Portfolio &portfolio)
|
||||
{
|
||||
String strEntry;
|
||||
String strLine;
|
||||
int rows;
|
||||
|
||||
portfolio.remove();
|
||||
rows=mPortfolioList.getRowCount();
|
||||
for(int row=0;row<rows;row++)
|
||||
{
|
||||
Bond bond;
|
||||
|
||||
mPortfolioList.getCellData(row,1,strEntry);
|
||||
bond.coupon(Coupon(::atof(strEntry),Annual));
|
||||
mPortfolioList.getCellData(row,2,strEntry);
|
||||
bond.ytm(::atoi(strEntry));
|
||||
mPortfolioList.getCellData(row,3,strEntry);
|
||||
strEntry.removeTokens("$ ,");
|
||||
bond.par(::atof(strEntry));
|
||||
mPortfolioList.getCellData(row,4,strEntry);
|
||||
strEntry.removeTokens("$ ,");
|
||||
bond.price(::atof(strEntry));
|
||||
portfolio.insert(FinancialInstrument());
|
||||
portfolio[portfolio.size()-1]=::new Bond(bond);
|
||||
portfolio[portfolio.size()-1].disposition(PointerDisposition::Delete);
|
||||
}
|
||||
return portfolio.size();
|
||||
}
|
||||
|
||||
int MainWindow::currentRow(void)const
|
||||
{
|
||||
return mCurrentRow;
|
||||
}
|
||||
|
||||
// virtuals
|
||||
|
||||
void MainWindow::exposeEvent(const Expose &expose)
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::configureEvent(const Configure &configure)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
80
analytic/MAINWND.HPP
Normal file
80
analytic/MAINWND.HPP
Normal file
@@ -0,0 +1,80 @@
|
||||
#ifndef _ANALYTIC_MAINWND_HPP_
|
||||
#define _ANALYTIC_MAINWND_HPP_
|
||||
#ifndef _GUI_GUI_HPP_
|
||||
#include <gui/gui.hpp>
|
||||
#endif
|
||||
#ifndef _GUI_WINDOW_HPP_
|
||||
#include <gui/window.hpp>
|
||||
#endif
|
||||
|
||||
class Portfolio;
|
||||
|
||||
class MainWindow : private Window
|
||||
{
|
||||
public:
|
||||
MainWindow(Application &mainApp);
|
||||
virtual ~MainWindow();
|
||||
protected:
|
||||
void exposeEvent(const Expose &expose);
|
||||
void configureEvent(const Configure &configure);
|
||||
private:
|
||||
enum{InitialWidth=640,InitialHeight=360};
|
||||
void initHandlers(void);
|
||||
void createControls(void);
|
||||
void initControls(void);
|
||||
void graphCashflows(void);
|
||||
void graphCashflowsSpline(void);
|
||||
void calcYield(void);
|
||||
int currentRow(void)const;
|
||||
int getLines(Block<String> &listLines);
|
||||
int getPortfolio(Portfolio &portfolio);
|
||||
int selectRowHandler(CallbackData &someCallbackData);
|
||||
int cancelHandler(CallbackData &someCallbackData);
|
||||
int calcHandler(CallbackData &someCallbackData);
|
||||
int addHandler(CallbackData &someCallbackData);
|
||||
int delHandler(CallbackData &someCallbackData);
|
||||
int setHandler(CallbackData &someCallbackData);
|
||||
int saveHandler(CallbackData &someCallbackData);
|
||||
int loadHandler(CallbackData &someCallbackData);
|
||||
int saveFileSelectHandler(CallbackData &someCallbackData);
|
||||
int loadFileSelectHandler(CallbackData &someCallbackData);
|
||||
|
||||
Callback<MainWindow> mCancelHandler;
|
||||
Callback<MainWindow> mCalcHandler;
|
||||
Callback<MainWindow> mAddHandler;
|
||||
Callback<MainWindow> mDelHandler;
|
||||
Callback<MainWindow> mSetHandler;
|
||||
Callback<MainWindow> mSelectRowHandler;
|
||||
Callback<MainWindow> mSaveHandler;
|
||||
Callback<MainWindow> mLoadHandler;
|
||||
Callback<MainWindow> mSaveFileSelectHandler;
|
||||
Callback<MainWindow> mLoadFileSelectHandler;
|
||||
Button mCancelButton;
|
||||
Button mCalcButton;
|
||||
Button mAddButton;
|
||||
Button mDelButton;
|
||||
Button mSetButton;
|
||||
Button mSaveButton;
|
||||
Button mLoadButton;
|
||||
Label mLabelBond;
|
||||
Label mLabelCoupon;
|
||||
Label mLabelYTM;
|
||||
Label mLabelPar;
|
||||
Label mLabelPrice;
|
||||
Label mLabelYield;
|
||||
Label mLabelYieldValue;
|
||||
Entry mEntryBond;
|
||||
Entry mEntryCoupon;
|
||||
Entry mEntryYTM;
|
||||
Entry mEntryPar;
|
||||
Entry mEntryPrice;
|
||||
StatusBar mStatusBar;
|
||||
CList mPortfolioList;
|
||||
Table mWinGrid;
|
||||
Pixmap mPixmap;
|
||||
OpenDialog mOpenDialog;
|
||||
int mCurrentRow;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
86
analytic/MONEY.CPP
Normal file
86
analytic/MONEY.CPP
Normal file
@@ -0,0 +1,86 @@
|
||||
#include <analytic/money.hpp>
|
||||
#include <common/stdio.hpp>
|
||||
|
||||
Money::Money(void)
|
||||
: mValue(0.00), mFormat("% 12.2lf")
|
||||
{
|
||||
}
|
||||
|
||||
Money::Money(double value)
|
||||
: mValue(value), mFormat("% 12.2lf")
|
||||
{
|
||||
}
|
||||
|
||||
Money::Money(const Money &someMoney)
|
||||
{
|
||||
*this=someMoney;
|
||||
}
|
||||
|
||||
Money::~Money()
|
||||
{
|
||||
}
|
||||
|
||||
Money &Money::operator=(const Money &someMoney)
|
||||
{
|
||||
format(someMoney.format());
|
||||
value(someMoney.value());
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Money::format(const String &strFormat)
|
||||
{
|
||||
mFormat=strFormat;
|
||||
}
|
||||
|
||||
const String &Money::format(void)const
|
||||
{
|
||||
return mFormat;
|
||||
}
|
||||
|
||||
double Money::value(void)const
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
void Money::value(double value)
|
||||
{
|
||||
mValue=value;
|
||||
}
|
||||
|
||||
Money::operator String(void)
|
||||
{
|
||||
String strString;
|
||||
String moneyString;
|
||||
|
||||
::sprintf(strString,mFormat,mValue);
|
||||
char *strPtr=strString;
|
||||
char *strRoot=strPtr;
|
||||
while(*strPtr!='.')strPtr++;
|
||||
while(TRUE)
|
||||
{
|
||||
for(int count=0;count<3&&strPtr>strRoot&&*strPtr!=' ';count++)strPtr--;
|
||||
if(strPtr<strRoot)break;
|
||||
moneyString.insert(strPtr);
|
||||
if(*strPtr==' '||strPtr==strRoot)break;
|
||||
if(*(strPtr-1)!=' '&&*(strPtr-1)!='-')moneyString.insert(",");
|
||||
*strPtr=0;
|
||||
}
|
||||
apply(moneyString);
|
||||
return moneyString;
|
||||
}
|
||||
|
||||
Money::Money(String strMoney)
|
||||
: mFormat("% 12.2lf")
|
||||
{
|
||||
BOOL negate(FALSE);
|
||||
strMoney.removeTokens("$,");
|
||||
if(-1!=strMoney.strchr('(')){strMoney.removeTokens("(");strMoney.removeTokens(")");negate=TRUE;}
|
||||
mValue=::atof(strMoney);
|
||||
if(negate)mValue=-mValue;
|
||||
}
|
||||
|
||||
// virtuals
|
||||
void Money::apply(String &strMoney)
|
||||
{
|
||||
strMoney.insert("$");
|
||||
}
|
||||
27
analytic/MONEY.HPP
Normal file
27
analytic/MONEY.HPP
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef _ANALYTIC_MONEY_HPP_
|
||||
#define _ANALYTIC_MONEY_HPP_
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
|
||||
class Money
|
||||
{
|
||||
public:
|
||||
Money(void);
|
||||
Money(double value);
|
||||
Money(const Money &someMoney);
|
||||
Money(String strMoney);
|
||||
virtual ~Money();
|
||||
Money &operator=(const Money &someMoney);
|
||||
operator String(void);
|
||||
void format(const String &strFormat);
|
||||
const String &format(void)const;
|
||||
double value(void)const;
|
||||
void value(double value);
|
||||
protected:
|
||||
virtual void apply(String &strMoney);
|
||||
private:
|
||||
double mValue;
|
||||
String mFormat;
|
||||
};
|
||||
#endif
|
||||
74
analytic/PAIRS.CPP
Normal file
74
analytic/PAIRS.CPP
Normal file
@@ -0,0 +1,74 @@
|
||||
#include <analytic/pairs.hpp>
|
||||
|
||||
FloatPairs::FloatPairs(void)
|
||||
: mColumn(0.00), mRow(0.00)
|
||||
{
|
||||
}
|
||||
|
||||
FloatPairs::FloatPairs(const FloatPairs &someFloatPairs)
|
||||
{
|
||||
*this=someFloatPairs;
|
||||
}
|
||||
|
||||
FloatPairs::FloatPairs(double column,double row)
|
||||
: mColumn(column), mRow(row)
|
||||
{
|
||||
}
|
||||
|
||||
FloatPairs::~FloatPairs()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL FloatPairs::operator==(const FloatPairs &someFloatPair)const
|
||||
{
|
||||
return (mColumn==someFloatPair.mColumn && mRow==someFloatPair.mRow);
|
||||
}
|
||||
|
||||
FloatPairs &FloatPairs::operator=(const FloatPairs &someFloatPairs)
|
||||
{
|
||||
column(someFloatPairs.column());
|
||||
row(someFloatPairs.row());
|
||||
return *this;
|
||||
}
|
||||
|
||||
double FloatPairs::column(void)const
|
||||
{
|
||||
return mColumn;
|
||||
}
|
||||
|
||||
void FloatPairs::column(double newColumn)
|
||||
{
|
||||
mColumn=newColumn;
|
||||
}
|
||||
|
||||
double FloatPairs::row(void)const
|
||||
{
|
||||
return mRow;
|
||||
}
|
||||
|
||||
void FloatPairs::row(double newRow)
|
||||
{
|
||||
mRow=newRow;
|
||||
}
|
||||
|
||||
void FloatPairs::setPairs(double newColumn,double newRow)
|
||||
{
|
||||
mColumn=newColumn;
|
||||
mRow=newRow;
|
||||
}
|
||||
|
||||
void FloatPairs::setPairs(int newColumn,int newRow)
|
||||
{
|
||||
mColumn=(double)newColumn;
|
||||
mRow=(double)newRow;
|
||||
}
|
||||
|
||||
int FloatPairs::fpmax(int firstVal,int secondVal)
|
||||
{
|
||||
return (firstVal>secondVal?firstVal:secondVal);
|
||||
}
|
||||
|
||||
int FloatPairs::fpmin(int firstVal,int secondVal)
|
||||
{
|
||||
return (firstVal<secondVal?firstVal:secondVal);
|
||||
}
|
||||
28
analytic/PAIRS.HPP
Normal file
28
analytic/PAIRS.HPP
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _ANALYTIC_FLOATPAIRS_HPP_
|
||||
#define _ANALYTIC_FLOATPAIRS_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
|
||||
class FloatPairs
|
||||
{
|
||||
public:
|
||||
FloatPairs(void);
|
||||
FloatPairs(const FloatPairs &someFloatPairs);
|
||||
FloatPairs(double column,double row);
|
||||
virtual ~FloatPairs();
|
||||
FloatPairs &operator=(const FloatPairs &someFloatPairs);
|
||||
BOOL operator==(const FloatPairs &someFloatPair)const;
|
||||
double column(void)const;
|
||||
void column(double newColumn);
|
||||
double row(void)const;
|
||||
void row(double newRow);
|
||||
void setPairs(double newColumn,double newRow);
|
||||
void setPairs(int newColumn,int newRow);
|
||||
static int fpmax(int firstVal,int secondVal);
|
||||
static int fpmin(int firstVal,int secondVal);
|
||||
private:
|
||||
double mColumn;
|
||||
double mRow;
|
||||
};
|
||||
#endif
|
||||
127
analytic/PORTFLIO.CPP
Normal file
127
analytic/PORTFLIO.CPP
Normal file
@@ -0,0 +1,127 @@
|
||||
#include <analytic/portflio.hpp>
|
||||
#include <common/stdio.hpp>
|
||||
#include <common/math.hpp>
|
||||
|
||||
Portfolio::Portfolio(void)
|
||||
{
|
||||
}
|
||||
|
||||
Portfolio::Portfolio(const Portfolio &portfolio)
|
||||
{ // private implementation
|
||||
*this=portfolio;
|
||||
}
|
||||
|
||||
Portfolio::~Portfolio()
|
||||
{
|
||||
}
|
||||
|
||||
Portfolio &Portfolio::operator=(const Portfolio &/*portfolio*/)
|
||||
{ // private implementation
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOL Portfolio::operator==(const Portfolio &portfolio)const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
double Portfolio::discount(Rate yield,GlobalData<double> &cashflows)
|
||||
{
|
||||
double price(0.00);
|
||||
|
||||
yield.makeSemiAnnual();
|
||||
for(int index=0;index<cashflows.size();index++)price+=cashflows[index]/::pow(1.00+yield.decimalRate(),index+1);
|
||||
return price;
|
||||
}
|
||||
|
||||
Rate Portfolio::wac(void)
|
||||
{
|
||||
Rate rate;
|
||||
double weighted(0.00);
|
||||
double parValue(0.00);
|
||||
|
||||
for(int index=0;index<size();index++)
|
||||
{
|
||||
rate=operator[](index)->coupon();
|
||||
rate.makeAnnual();
|
||||
weighted+=rate.decimalRate()*operator[](index)->par();
|
||||
parValue+=operator[](index)->par();
|
||||
}
|
||||
weighted/=parValue;
|
||||
return Rate(weighted*100.00,Annual);
|
||||
}
|
||||
|
||||
Rate Portfolio::discount(double market,GlobalData<double> &cashflows)
|
||||
{
|
||||
Rate guess(wac());
|
||||
Rate maxGuess;
|
||||
Rate minGuess;
|
||||
double price;
|
||||
int maxPly=50;
|
||||
int ply=0;
|
||||
|
||||
maxGuess=guess;
|
||||
minGuess=guess;
|
||||
maxGuess.rate(guess.rate()+12.00);
|
||||
minGuess.rate(guess.rate()-12.00);
|
||||
if(minGuess.rate()<0.00)minGuess.rate(1.00);
|
||||
while(TRUE)
|
||||
{
|
||||
price=discount(guess,cashflows);
|
||||
if(price==market||(price-market<0.00?market-price:price-market)<1.00)break;
|
||||
if(market>price)
|
||||
{
|
||||
maxGuess=guess;
|
||||
guess.rate((guess.rate()+minGuess.rate())/2.00);
|
||||
}
|
||||
else
|
||||
{
|
||||
minGuess=guess;
|
||||
guess.rate((guess.rate()+maxGuess.rate())/2.00);
|
||||
}
|
||||
if(++ply>maxPly)return Rate(0.00);
|
||||
printf("calculated price:%lf market price:%lf\n",price,market);
|
||||
}
|
||||
return guess;
|
||||
}
|
||||
|
||||
int Portfolio::getCashflows(GlobalData<double> &sumCashflows)
|
||||
{
|
||||
GlobalData<GlobalData<double> > cashflows;
|
||||
int maxFlows(0);
|
||||
|
||||
cashflows.size(size());
|
||||
for(int index=0;index<cashflows.size();index++)operator[](index)->cashflows(cashflows[index]);
|
||||
for(index=0;index<cashflows.size();index++)
|
||||
{
|
||||
if(!index)maxFlows=cashflows[index].size();
|
||||
else if(cashflows[index].size()>maxFlows)maxFlows=cashflows[index].size();
|
||||
}
|
||||
sumCashflows.size(maxFlows);
|
||||
for(int pIndex=0;pIndex<cashflows.size();pIndex++)
|
||||
{
|
||||
GlobalData<double> &cashflow=cashflows[pIndex];
|
||||
for(int index=0;index<cashflow.size();index++)sumCashflows[index]=sumCashflows[index]+cashflow[index];
|
||||
}
|
||||
return sumCashflows.size();
|
||||
}
|
||||
|
||||
Rate Portfolio::yield(void)
|
||||
{
|
||||
GlobalData<double> cashflows;
|
||||
double price(0.00);
|
||||
|
||||
getCashflows(cashflows);
|
||||
for(int index=0;index<size();index++)price+=operator[](index)->price();
|
||||
return Rate(discount(price,cashflows));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
37
analytic/PORTFLIO.HPP
Normal file
37
analytic/PORTFLIO.HPP
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef _ANALYTIC_PORTFOLIO_HPP_
|
||||
#define _ANALYTIC_PORTFOLIO_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_SMARTPOINTER_HPP_
|
||||
#include <common/pointer.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_BLOCK_HPP_
|
||||
#include <common/block.hpp>
|
||||
#endif
|
||||
#ifndef _ANALYTIC_INSTRUMENT_HPP_
|
||||
#include <analytic/instrmnt.hpp>
|
||||
#endif
|
||||
#ifndef _ANALYTIC_RATE_HPP_
|
||||
#include <analytic/rate.hpp>
|
||||
#endif
|
||||
|
||||
typedef SmartPointer<Instrument> FinancialInstrument;
|
||||
typedef Block<FinancialInstrument> FinancialInstruments;
|
||||
|
||||
class Portfolio : public FinancialInstruments
|
||||
{
|
||||
public:
|
||||
Portfolio(void);
|
||||
virtual ~Portfolio();
|
||||
BOOL operator==(const Portfolio &portfolio)const;
|
||||
int getCashflows(GlobalData<double> &sumCashflows);
|
||||
Rate yield(void);
|
||||
private:
|
||||
Portfolio(const Portfolio &portfolio);
|
||||
Portfolio &operator=(const Portfolio &portfolio);
|
||||
double discount(Rate yield,GlobalData<double> &cashflows);
|
||||
Rate discount(double market,GlobalData<double> &cashflows);
|
||||
Rate wac(void);
|
||||
};
|
||||
#endif
|
||||
124
analytic/PORTFOLI.CPP
Normal file
124
analytic/PORTFOLI.CPP
Normal file
@@ -0,0 +1,124 @@
|
||||
#include <analytic/portflio.hpp>
|
||||
#include <common/stdio.hpp>
|
||||
#include <common/math.hpp>
|
||||
|
||||
Portfolio::Portfolio(void)
|
||||
{
|
||||
}
|
||||
|
||||
Portfolio::Portfolio(const Portfolio &portfolio)
|
||||
{ // private implementation
|
||||
*this=portfolio;
|
||||
}
|
||||
|
||||
Portfolio::~Portfolio()
|
||||
{
|
||||
}
|
||||
|
||||
Portfolio &Portfolio::operator=(const Portfolio &/*portfolio*/)
|
||||
{ // private implementation
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOL Portfolio::operator==(const Portfolio &portfolio)const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
double Portfolio::discount(Rate yield,GlobalData<double> &cashflows)
|
||||
{
|
||||
double price(0.00);
|
||||
|
||||
yield.makeSemiAnnual();
|
||||
for(int index=0;index<cashflows.size();index++)price+=cashflows[index]/::pow(1.00+yield.decimalRate(),index+1);
|
||||
return price;
|
||||
}
|
||||
|
||||
Rate Portfolio::wac(void)
|
||||
{
|
||||
Rate rate;
|
||||
double weighted(0.00);
|
||||
double parValue(0.00);
|
||||
|
||||
for(int index=0;index<size();index++)
|
||||
{
|
||||
rate=operator[](index)->coupon();
|
||||
rate.makeAnnual();
|
||||
weighted+=rate.decimalRate()*operator[](index)->par();
|
||||
parValue+=operator[](index)->par();
|
||||
}
|
||||
weighted/=parValue;
|
||||
return Rate(weighted*100.00,Annual);
|
||||
}
|
||||
|
||||
Rate Portfolio::discount(double market,GlobalData<double> &cashflows)
|
||||
{
|
||||
Rate guess(wac());
|
||||
Rate maxGuess;
|
||||
Rate minGuess;
|
||||
double price;
|
||||
|
||||
maxGuess=guess;
|
||||
minGuess=guess;
|
||||
maxGuess.rate(guess.rate()+12.00);
|
||||
minGuess.rate(guess.rate()-12.00);
|
||||
if(minGuess.rate()<0.00)minGuess.rate(1.00);
|
||||
while(TRUE)
|
||||
{
|
||||
price=discount(guess,cashflows);
|
||||
if(price==market||(price-market<0.00?market-price:price-market)<1.00)break;
|
||||
if(market>price)
|
||||
{
|
||||
maxGuess=guess;
|
||||
guess.rate((guess.rate()+minGuess.rate())/2.00);
|
||||
}
|
||||
else
|
||||
{
|
||||
minGuess=guess;
|
||||
guess.rate((guess.rate()+maxGuess.rate())/2.00);
|
||||
}
|
||||
//printf("calculated price:%lf market price:%lf\n",price,market);
|
||||
}
|
||||
return guess;
|
||||
}
|
||||
|
||||
int Portfolio::getCashflows(GlobalData<double> &sumCashflows)
|
||||
{
|
||||
GlobalData<GlobalData<double> > cashflows;
|
||||
int maxFlows(0);
|
||||
|
||||
cashflows.size(size());
|
||||
for(int index=0;index<cashflows.size();index++)operator[](index)->cashflows(cashflows[index]);
|
||||
for(int index=0;index<cashflows.size();index++)
|
||||
{
|
||||
if(!index)maxFlows=cashflows[index].size();
|
||||
else if(cashflows[index].size()>maxFlows)maxFlows=cashflows[index].size();
|
||||
}
|
||||
sumCashflows.size(maxFlows);
|
||||
for(int pIndex=0;pIndex<cashflows.size();pIndex++)
|
||||
{
|
||||
GlobalData<double> &cashflow=cashflows[pIndex];
|
||||
for(int index=0;index<cashflow.size();index++)sumCashflows[index]=sumCashflows[index]+cashflow[index];
|
||||
}
|
||||
return sumCashflows.size();
|
||||
}
|
||||
|
||||
Rate Portfolio::yield(void)
|
||||
{
|
||||
GlobalData<double> cashflows;
|
||||
double price(0.00);
|
||||
|
||||
getCashflows(cashflows);
|
||||
for(int index=0;index<size();index++)price+=operator[](index)->price();
|
||||
return Rate(discount(price,cashflows));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
10
analytic/RATE.HPP
Normal file
10
analytic/RATE.HPP
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _ANALYTIC_RATE_HPP_
|
||||
#define _ANALYTIC_RATE_HPP_
|
||||
#ifndef _ANALYTIC_COUPON_HPP_
|
||||
#include <analytic/coupon.hpp>
|
||||
#endif
|
||||
|
||||
typedef Coupon Rate;
|
||||
#endif
|
||||
|
||||
|
||||
16
analytic/Test.cpp
Normal file
16
analytic/Test.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <common/windows.hpp>
|
||||
#include <analytic/portflio.hpp>
|
||||
#include <analytic/bond.hpp>
|
||||
|
||||
void __cdecl main(int argc,char **argv)
|
||||
{
|
||||
Portfolio portfolio;
|
||||
|
||||
for(double price=10.00;price<100.00;price+=2.00)
|
||||
{
|
||||
SmartPointer<Instrument> bond=new Bond(100.00,Coupon(7.00),10,price);
|
||||
bond.disposition(PointerDisposition::Assume);
|
||||
portfolio.insert(&bond);
|
||||
}
|
||||
Rate yield=portfolio.yield();
|
||||
}
|
||||
60
analytic/ZBOND.CPP
Normal file
60
analytic/ZBOND.CPP
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <analytic/zbond.hpp>
|
||||
#include <common/math.hpp>
|
||||
|
||||
ZeroCouponBond::ZeroCouponBond(void)
|
||||
{
|
||||
type(Instrument::ZeroCouponBond);
|
||||
}
|
||||
|
||||
ZeroCouponBond::ZeroCouponBond(const ZeroCouponBond &zeroCouponBond)
|
||||
{
|
||||
*this=zeroCouponBond;
|
||||
}
|
||||
|
||||
ZeroCouponBond::ZeroCouponBond(double par,const Coupon &coupon,int ytm)
|
||||
: Bond(par,coupon,ytm)
|
||||
{
|
||||
type(Instrument::ZeroCouponBond);
|
||||
}
|
||||
|
||||
ZeroCouponBond::~ZeroCouponBond()
|
||||
{
|
||||
}
|
||||
|
||||
ZeroCouponBond &ZeroCouponBond::operator=(const ZeroCouponBond &zeroCouponBond)
|
||||
{
|
||||
(Bond&)*this=(Bond&)zeroCouponBond;
|
||||
return *this;
|
||||
}
|
||||
|
||||
BOOL ZeroCouponBond::operator==(const ZeroCouponBond &zeroCouponBond)const
|
||||
{
|
||||
return (Bond&)*this==(Bond&)zeroCouponBond;
|
||||
}
|
||||
|
||||
// virtuals
|
||||
|
||||
double ZeroCouponBond::discount(Rate /*yield*/)
|
||||
{
|
||||
return discount();
|
||||
}
|
||||
|
||||
double ZeroCouponBond::discount(void)
|
||||
{
|
||||
Coupon coupon(coupon());
|
||||
double bondPrice;
|
||||
int periods;
|
||||
|
||||
coupon.makeSemiAnnual();
|
||||
periods=coupon.frequency()*ytm();
|
||||
bondPrice=par()/::pow(1.00+coupon.decimalRate(),periods);
|
||||
price(bondPrice);
|
||||
return price();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
20
analytic/ZBOND.HPP
Normal file
20
analytic/ZBOND.HPP
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef _ANALYTIC_ZEROCOUPONBOND_HPP_
|
||||
#define _ANALYTIC_ZEROCOUPONBOND_HPP_
|
||||
#ifndef _ANALYTIC_BOND_HPP_
|
||||
#include <analytic/bond.hpp>
|
||||
#endif
|
||||
|
||||
class ZeroCouponBond : public Bond
|
||||
{
|
||||
public:
|
||||
ZeroCouponBond(void);
|
||||
ZeroCouponBond(const ZeroCouponBond &zeroCouponBond);
|
||||
ZeroCouponBond(double par,const Coupon &coupon,int ytm);
|
||||
virtual ~ZeroCouponBond();
|
||||
ZeroCouponBond &operator=(const ZeroCouponBond &zeroCouponBond);
|
||||
BOOL operator==(const ZeroCouponBond &zeroCouponBond)const;
|
||||
virtual double discount(void);
|
||||
virtual double discount(Rate yield);
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
101
analytic/test.dsp
Normal file
101
analytic/test.dsp
Normal file
@@ -0,0 +1,101 @@
|
||||
# Microsoft Developer Studio Project File - Name="test" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=test - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "test.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "test.mak" CFG="test - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "test - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "test - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "test - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "test - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "STRICT" /D "__FLAT__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "test - Win32 Release"
|
||||
# Name "test - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Test.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
59
analytic/test.dsw
Normal file
59
analytic/test.dsw
Normal file
@@ -0,0 +1,59 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "analytic"=.\ANALYTIC.DSP - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "common"=..\common\common.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "test"=.\test.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name analytic
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name common
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
BIN
analytic/test.ncb
Normal file
BIN
analytic/test.ncb
Normal file
Binary file not shown.
BIN
analytic/test.opt
Normal file
BIN
analytic/test.opt
Normal file
Binary file not shown.
41
analytic/test.plg
Normal file
41
analytic/test.plg
Normal file
@@ -0,0 +1,41 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: analytic - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP114.tmp" with contents
|
||||
[
|
||||
/nologo /Gz /MTd /GX /Zi /O2 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /Fp".\msvcobj/ANALYTIC.pch" /YX /Fo".\msvcobj/" /Fd".\msvcobj/" /FD /c
|
||||
"E:\work\analytic\portflio.cpp"
|
||||
]
|
||||
Creating command line "cl.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP114.tmp"
|
||||
Creating command line "link.exe -lib /nologo /out:"..\exe\analytic.lib" .\msvcobj\Bond.obj .\msvcobj\Catmull.obj .\msvcobj\Coupon.obj .\msvcobj\Instrmnt.obj .\msvcobj\Money.obj .\msvcobj\Pairs.obj .\msvcobj\portflio.obj .\msvcobj\Zbond.obj "
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
portflio.cpp
|
||||
Creating library...
|
||||
<h3>
|
||||
--------------------Configuration: test - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP115.tmp" with contents
|
||||
[
|
||||
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/test.pdb" /debug /machine:I386 /out:"Debug/test.exe" /pdbtype:sept
|
||||
.\Debug\Test.obj
|
||||
\work\exe\analytic.lib
|
||||
\work\exe\mscommon.lib
|
||||
]
|
||||
Creating command line "link.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP115.tmp"
|
||||
<h3>Output Window</h3>
|
||||
Linking...
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
test.exe - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user