BonosCE.vb 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168
  1. Public Class BonosCE
  2. Private _CodigoInversion As String
  3. Private _DocumentoBase As String
  4. Private _TipoBase As String
  5. Private _CodigoEmpresa As String
  6. Private _CodigoInstrumentoFinanciero As String = "BONO"
  7. Private _DescripcionInstrumentoFinanciero As String = "Bonos"
  8. Private _dtImpuestosYComisiones As DataTable
  9. Private _SumaImpuestosYComisionesVenta As Double
  10. Private _dtIngresos As DataTable
  11. Private _SumaIngresos As Double
  12. Private _SumaImpuestosIngresos As Double
  13. Private _SumaliquidoIngresos As Double
  14. Private Operaciones As New Operaciones
  15. Public Overridable ReadOnly Property CodigoInstrumentoFinanciero As String
  16. Get
  17. Return _CodigoInstrumentoFinanciero
  18. End Get
  19. End Property
  20. Public Overridable ReadOnly Property DescripcionInstrumentoFinanciero
  21. Get
  22. Return _DescripcionInstrumentoFinanciero
  23. End Get
  24. End Property
  25. Public Property CodigoEmpresa As String
  26. Get
  27. Return _CodigoEmpresa
  28. End Get
  29. Set(value As String)
  30. _CodigoEmpresa = value
  31. End Set
  32. End Property
  33. Public ReadOnly Property SumaIngresos As Double
  34. Get
  35. Return _SumaIngresos
  36. End Get
  37. End Property
  38. Public ReadOnly Property SumaImpuestosIngresos As Double
  39. Get
  40. Return _SumaImpuestosIngresos
  41. End Get
  42. End Property
  43. Public ReadOnly Property SumaliquidoIngresos As Double
  44. Get
  45. Return _SumaliquidoIngresos
  46. End Get
  47. End Property
  48. Public Property Ingresos As DataTable
  49. Get
  50. Return _dtIngresos
  51. End Get
  52. Set(value As DataTable)
  53. _dtIngresos = value
  54. End Set
  55. End Property
  56. Private _PeriodicidadCompra As String
  57. 'Private _CodigoCasaCompra As String
  58. Private _ValorNominalCompra As Double
  59. Private _UltimaFechaCuponCompra As Date
  60. Private _SiguienteFechaCuponCompra As Date
  61. Private _FechaLiquidacionCompra As Date
  62. Private _FechaVencimientoCompra As Date
  63. Private _PorcentajeCuponCompra As Double
  64. Private _YTMAlVencimientoComisionCompra As Double
  65. Private _YTMAlVencimientoCompra As Double
  66. Private _PrecioAlVencimientoCompra As Double
  67. Private _PrecioCompra As Double
  68. Private _DiasBaseCompra As Integer
  69. Private _DiasAcumuladosCompra As Integer
  70. Private _DiasAlVencimientoCompra As Integer
  71. Private _PorcentajeInteresAcumuladoCompra As Double
  72. Private _InteresAcumuladoCompra As Double
  73. Private _PrecioSucioCompra As Double
  74. Private _ValorTransadoCompra As Double
  75. Private _MontoAPagarCompra As Double
  76. Private _CostoDeTransferenciaCompra As Double
  77. Private _SumaImpuestosyComisionesCompra As Double
  78. 'Private _CodigoCasaVenta As String
  79. Private _ValorNominalVenta As Double
  80. Private _UltimaFechaCuponVenta As Date
  81. Private _SiguienteFechaCuponVenta As Date
  82. Private _FechaLiquidacionVenta As Date
  83. Private _FechaVencimientoVenta As Date
  84. Private _PorcentajeCuponVenta As Double
  85. Private _YTMAlVencimientoComisionVenta As Double
  86. Private _YTMAlVencimientoVenta As Double
  87. Private _PrecioAlVencimientoVenta As Double
  88. Private _PrecioVenta As Double
  89. Private _DiasBaseVenta As Integer
  90. Private _DiasAcumuladosVenta As Integer
  91. Private _DiasAlVencimientoVenta As Integer
  92. 'Private _PorcentajeInteresAcumuladoVenta As Double
  93. Private _InteresAcumuladoVenta As Double
  94. Private _InteresAcumuladoPorcentajeVenta As Double
  95. Private _PrecioSucioVenta As Double
  96. Private _ValorTransadoVenta As Double
  97. Private _MontoARecibirVenta As Double
  98. Private _PeriodicidadVenta As String
  99. Private _PorcentajeComisionCasaVenta As Double
  100. Private _PorcentajeComisionBolsaVenta As Double
  101. Private _CostoDeTransferenciaVenta As Double
  102. Private _ComisionBolsaVenta As Double
  103. Private _ComisionCasaVenta As Double
  104. Private _ValorNominalRO As Double
  105. Private _DiasPlazoRO As Integer
  106. Private _PrecioCompraRO As Double
  107. Private _PrecioVentaRO As Double
  108. Private _GananciaPerdidaDeCapital As Double
  109. Private _IngresoPorInteres As Double
  110. Private _CostosTotales As Double
  111. Private _GananciaPerdidaTotal As Double
  112. Private _RendimientoGananciaPerdida As Double
  113. Private _RendimientoDeIntereses As Double
  114. Private _RendimientoAntesImpuestos As Double
  115. Private _RendimientoDespuesImpuestos As Double
  116. Public Property CodigoInversion As String
  117. Get
  118. Return _CodigoInversion
  119. End Get
  120. Set(value As String)
  121. _CodigoInversion = value
  122. End Set
  123. End Property
  124. Public Property DocumentoBase As String
  125. Get
  126. Return _DocumentoBase
  127. End Get
  128. Set(value As String)
  129. _DocumentoBase = value
  130. End Set
  131. End Property
  132. Public Property TipoBase As String
  133. Get
  134. Return _TipoBase
  135. End Get
  136. Set(value As String)
  137. _TipoBase = value
  138. End Set
  139. End Property
  140. Public Property ImpuestosYComisiones As DataTable
  141. Get
  142. Return _dtImpuestosYComisiones
  143. End Get
  144. Set(value As DataTable)
  145. _dtImpuestosYComisiones = value
  146. CalcularSumaImpuestosyComisiones()
  147. End Set
  148. End Property
  149. Public Property SumaImpuestosYComisionesVenta As Double
  150. Get
  151. Return _SumaImpuestosYComisionesVenta
  152. End Get
  153. Set(value As Double)
  154. _SumaImpuestosYComisionesVenta = value
  155. End Set
  156. End Property
  157. 'COMPRA
  158. Public Property PeriodicidadCompra As String
  159. Get
  160. Return _PeriodicidadCompra
  161. End Get
  162. Set(value As String)
  163. _PeriodicidadCompra = value
  164. End Set
  165. End Property
  166. Public Property ValorNominalCompra As Double
  167. Get
  168. Return _ValorNominalCompra
  169. End Get
  170. Set(value As Double)
  171. _ValorNominalCompra = value
  172. CalcularInteresAcumuladoCompra()
  173. CalcularPorcentajeInteresAcumuladoCompra()
  174. CalcularValorTransadoCompra()
  175. End Set
  176. End Property
  177. Public Property UltimaFechaCuponCompra As Date
  178. Get
  179. Return _UltimaFechaCuponCompra
  180. End Get
  181. Set(value As Date)
  182. _UltimaFechaCuponCompra = value
  183. CalcularDiasAcumuladosCompra()
  184. End Set
  185. End Property
  186. Public Property SiguienteFechaCuponCompra As Date
  187. Get
  188. Return _SiguienteFechaCuponCompra
  189. End Get
  190. Set(value As Date)
  191. _SiguienteFechaCuponCompra = value
  192. CalcularDiasAcumuladosCompra()
  193. CalcularUltimaFechaCuponVenta()
  194. 'CalcularTablaIngresos()
  195. End Set
  196. End Property
  197. Public Property FechaLiquidacionCompra As Date
  198. Get
  199. Return _FechaLiquidacionCompra
  200. End Get
  201. Set(value As Date)
  202. _FechaLiquidacionCompra = value
  203. CalcularYTMAlVencimientoCompra()
  204. CalcularDiasAcumuladosCompra()
  205. CalcularDiasPlazoRO()
  206. End Set
  207. End Property
  208. Public Property FechaVencimientoCompra As Date
  209. Get
  210. Return _FechaVencimientoCompra
  211. End Get
  212. Set(value As Date)
  213. _FechaVencimientoCompra = value
  214. CalcularYTMAlVencimientoCompra()
  215. End Set
  216. End Property
  217. Public Property PorcentajeCuponCompra As Double
  218. Get
  219. Return _PorcentajeCuponCompra
  220. End Get
  221. Set(value As Double)
  222. _PorcentajeCuponCompra = value
  223. CalcularYTMAlVencimientoCompra()
  224. CalcularInteresAcumuladoCompra()
  225. End Set
  226. End Property
  227. Public ReadOnly Property PorcentajeCuponCompra_x100 As Double
  228. Get
  229. Return _PorcentajeCuponCompra * 100
  230. End Get
  231. End Property
  232. Public ReadOnly Property YTMAlVencimientoComisionCompra As Double
  233. Get
  234. Return _YTMAlVencimientoComisionCompra
  235. End Get
  236. End Property
  237. Public ReadOnly Property YTMAlVencimientoCompra As Double
  238. Get
  239. Return _YTMAlVencimientoCompra
  240. End Get
  241. End Property
  242. Public Property PrecioAlVencimientoCompra As Double
  243. Get
  244. Return _PrecioAlVencimientoCompra
  245. End Get
  246. Set(value As Double)
  247. _PrecioAlVencimientoCompra = value
  248. CalcularYTMAlVencimientoCompra()
  249. End Set
  250. End Property
  251. Public Property PrecioCompra As Double
  252. Get
  253. Return _PrecioCompra
  254. End Get
  255. Set(value As Double)
  256. _PrecioCompra = value
  257. CalcularYTMAlVencimientoCompra()
  258. CalcularPrecioSucioCompra()
  259. CalcularValorTransadoCompra()
  260. End Set
  261. End Property
  262. Public Property DiasBaseCompra As Integer
  263. Get
  264. Return _DiasBaseCompra
  265. End Get
  266. Set(value As Integer)
  267. _DiasBaseCompra = value
  268. CalcularInteresAcumuladoCompra()
  269. CalcularDiasAlVencimientoCompra()
  270. CalcularDiasAcumuladosCompra()
  271. CalcularYTMAlVencimientoComisionCompra()
  272. CalcularPorcentajeInteresAcumuladoCompra()
  273. CalcularDiasPlazoRO()
  274. CalcularRendimientoGananciaPerdida()
  275. CalcularRendimientoDeIntereses()
  276. CalcularRendimientoDespuesImpuestos()
  277. End Set
  278. End Property
  279. Public ReadOnly Property DiasAcumuladosCompra As Integer
  280. Get
  281. Return _DiasAcumuladosCompra
  282. End Get
  283. End Property
  284. Public ReadOnly Property DiasAlVencimientoCompra As Integer
  285. Get
  286. Return _DiasAlVencimientoCompra
  287. End Get
  288. End Property
  289. Public ReadOnly Property PorcentajeInteresAcumuladoCompra As Double
  290. Get
  291. Return _PorcentajeInteresAcumuladoCompra
  292. End Get
  293. End Property
  294. Public ReadOnly Property InteresAcumuladoCompra As Double
  295. Get
  296. Return _InteresAcumuladoCompra
  297. End Get
  298. End Property
  299. Public ReadOnly Property PrecioSucioCompra As Double
  300. Get
  301. Return _PrecioSucioCompra
  302. End Get
  303. End Property
  304. Public ReadOnly Property ValorTransadoCompra As Double
  305. Get
  306. Return _ValorTransadoCompra
  307. End Get
  308. End Property
  309. Public ReadOnly Property MontoAPagarCompra As Double
  310. Get
  311. Return _MontoAPagarCompra
  312. End Get
  313. End Property
  314. Public Property CostoDeTransferenciaCompra As Double
  315. Get
  316. Return _CostoDeTransferenciaCompra
  317. End Get
  318. Set(value As Double)
  319. _CostoDeTransferenciaCompra = value
  320. CalcularMontoAPagarCompra()
  321. End Set
  322. End Property
  323. Public ReadOnly Property SumaImpuestosyComisionesCompra As Double
  324. Get
  325. Return _SumaImpuestosyComisionesCompra
  326. End Get
  327. End Property
  328. 'VENTA
  329. Public Property ValorNominalVenta As Double
  330. Get
  331. Return _ValorNominalVenta
  332. End Get
  333. Set(value As Double)
  334. _ValorNominalVenta = value
  335. CalcularInteresAcumuladoVenta()
  336. CalcularInteresAcumuladoPorcentajeVenta()
  337. CalcularValorTransadoVenta()
  338. CalcularInteresAcumuladoPorcentajeVenta()
  339. End Set
  340. End Property
  341. Public Property UltimaFechaCuponVenta As Date
  342. Get
  343. Return _UltimaFechaCuponVenta
  344. End Get
  345. Set(value As Date)
  346. _UltimaFechaCuponVenta = value
  347. End Set
  348. End Property
  349. Public Property SiguienteFechaCuponVenta As Date
  350. Get
  351. Return _SiguienteFechaCuponVenta
  352. End Get
  353. Set(value As Date)
  354. _SiguienteFechaCuponVenta = value
  355. End Set
  356. End Property
  357. Public Property FechaLiquidacionVenta As Date
  358. Get
  359. Return _FechaLiquidacionVenta
  360. End Get
  361. Set(value As Date)
  362. _FechaLiquidacionVenta = value
  363. CalcularDiasAcumuladosVenta()
  364. CalcularDiasAlVencimientoVenta()
  365. CalcularYTMAlVencimientoVenta()
  366. CalcularDiasPlazoRO()
  367. End Set
  368. End Property
  369. Public Property FechaVencimientoVenta As Date
  370. Get
  371. Return _FechaVencimientoVenta
  372. End Get
  373. Set(value As Date)
  374. _FechaVencimientoVenta = value
  375. CalcularDiasAlVencimientoVenta()
  376. CalcularYTMAlVencimientoVenta()
  377. End Set
  378. End Property
  379. Public Property PorcentajeCuponVenta As Double
  380. Get
  381. Return _PorcentajeCuponVenta
  382. End Get
  383. Set(value As Double)
  384. _PorcentajeCuponVenta = value
  385. CalcularYTMAlVencimientoVenta()
  386. CalcularInteresAcumuladoVenta()
  387. CalcularInteresAcumuladoPorcentajeVenta()
  388. End Set
  389. End Property
  390. Public ReadOnly Property YTMAlVencimientoComisionVenta As Double
  391. Get
  392. Return _YTMAlVencimientoComisionVenta
  393. End Get
  394. End Property
  395. Public ReadOnly Property YTMAlVencimientoVenta As Double
  396. Get
  397. Return _YTMAlVencimientoVenta
  398. End Get
  399. 'Set(value As Double)
  400. ' _YTMAlVencimientoVenta = value
  401. 'End Set
  402. End Property
  403. Public Property PrecioAlVencimientoVenta As Double
  404. Get
  405. Return _PrecioAlVencimientoVenta
  406. End Get
  407. Set(value As Double)
  408. _PrecioAlVencimientoVenta = value
  409. CalcularYTMAlVencimientoVenta()
  410. End Set
  411. End Property
  412. Public Property PrecioVenta As Double
  413. Get
  414. Return _PrecioVenta
  415. End Get
  416. Set(value As Double)
  417. _PrecioVenta = value
  418. CalcularYTMAlVencimientoVenta()
  419. CalcularPrecioSucioVenta()
  420. CalcularValorTransadoVenta()
  421. End Set
  422. End Property
  423. Public Property DiasBaseVenta As Integer
  424. Get
  425. Return _DiasBaseVenta
  426. End Get
  427. Set(value As Integer)
  428. _DiasBaseVenta = value
  429. CalcularYTMAlVencimientoComisionVenta()
  430. CalcularDiasAcumuladosVenta()
  431. CalcularDiasAlVencimientoVenta()
  432. CalcularInteresAcumuladoVenta()
  433. CalcularInteresAcumuladoPorcentajeVenta()
  434. CalcularInteresAcumuladoPorcentajeVenta()
  435. End Set
  436. End Property
  437. Public ReadOnly Property DiasAcumuladosVenta As Integer
  438. Get
  439. Return _DiasAcumuladosVenta
  440. End Get
  441. End Property
  442. Public ReadOnly Property DiasAlVencimientoVenta As Integer
  443. Get
  444. Return _DiasAlVencimientoVenta
  445. End Get
  446. End Property
  447. 'Public ReadOnly Property PorcentajeInteresAcumuladoVenta As Double
  448. ' Get
  449. ' Return _PorcentajeInteresAcumuladoVenta
  450. ' End Get
  451. 'End Property
  452. Public ReadOnly Property InteresAcumuladoVenta As Double
  453. Get
  454. Return _InteresAcumuladoVenta
  455. End Get
  456. End Property
  457. Public ReadOnly Property InteresAcumuladoPorcentajeVenta As Double
  458. Get
  459. Return _InteresAcumuladoPorcentajeVenta
  460. End Get
  461. End Property
  462. Public ReadOnly Property PrecioSucioVenta As Double
  463. Get
  464. Return _PrecioSucioVenta
  465. End Get
  466. End Property
  467. Public ReadOnly Property ValorTransadoVenta As Double
  468. Get
  469. Return _ValorTransadoVenta
  470. End Get
  471. End Property
  472. Public ReadOnly Property MontoARecibirVenta As Double
  473. Get
  474. Return _MontoARecibirVenta
  475. End Get
  476. End Property
  477. Public Property CostoDeTransferenciaVenta As Double
  478. Get
  479. Return _CostoDeTransferenciaVenta
  480. End Get
  481. Set(value As Double)
  482. _CostoDeTransferenciaVenta = value
  483. End Set
  484. End Property
  485. Public ReadOnly Property ValorNominalRO As Double
  486. Get
  487. Return _ValorNominalRO
  488. End Get
  489. End Property
  490. Public ReadOnly Property DiasPlazoRO As Integer
  491. Get
  492. Return _DiasPlazoRO
  493. End Get
  494. End Property
  495. Public ReadOnly Property PrecioCompraRO As Double
  496. Get
  497. Return _PrecioCompraRO
  498. End Get
  499. End Property
  500. Public ReadOnly Property PrecioVentaRO As Double
  501. Get
  502. Return _PrecioVentaRO
  503. End Get
  504. End Property
  505. Public ReadOnly Property GananciaPerdidaDeCapital As Double
  506. Get
  507. Return _GananciaPerdidaDeCapital
  508. End Get
  509. End Property
  510. Public ReadOnly Property IngresoPorInteres As Double
  511. Get
  512. Return _IngresoPorInteres
  513. End Get
  514. End Property
  515. Public ReadOnly Property CostosTotales As Double
  516. Get
  517. Return _CostosTotales
  518. End Get
  519. End Property
  520. Public ReadOnly Property GananciaPerdidaTotal As Double
  521. Get
  522. Return _GananciaPerdidaTotal
  523. End Get
  524. End Property
  525. Public ReadOnly Property RendimientoGananciaPerdida As Double
  526. Get
  527. Return _RendimientoGananciaPerdida
  528. End Get
  529. End Property
  530. Public ReadOnly Property RendimientoDeIntereses As Double
  531. Get
  532. Return _RendimientoDeIntereses
  533. End Get
  534. End Property
  535. Public ReadOnly Property RendimientoAntesImpuestos As Double
  536. Get
  537. Return _RendimientoAntesImpuestos
  538. End Get
  539. End Property
  540. Public ReadOnly Property RendimientoDespuesImpuestos As Double
  541. Get
  542. Return _RendimientoDespuesImpuestos
  543. End Get
  544. End Property
  545. Public Property PeriodicidadVenta As String
  546. Get
  547. Return _PeriodicidadVenta
  548. End Get
  549. Set(value As String)
  550. _PeriodicidadVenta = value
  551. CalcularYTMAlVencimientoVenta()
  552. CalcularInteresAcumuladoPorcentajeVenta()
  553. End Set
  554. End Property
  555. Public Sub New()
  556. _ValorNominalCompra = 0
  557. _UltimaFechaCuponCompra = Date.Now.Date
  558. _SiguienteFechaCuponCompra = Date.Now.Date
  559. _FechaLiquidacionCompra = Date.Now.Date
  560. _FechaVencimientoCompra = Date.Now.Date
  561. _ValorNominalVenta = 0
  562. _SiguienteFechaCuponVenta = Date.Now.Date
  563. _FechaLiquidacionVenta = Date.Now.Date
  564. _FechaVencimientoVenta = Date.Now.Date
  565. End Sub
  566. 'CALCULOS
  567. Private Sub CalcularYTMAlVencimientoComisionCompra()
  568. Dim valor As Double
  569. Try
  570. valor = _YTMAlVencimientoCompra - (_SumaImpuestosyComisionesCompra * _DiasBaseCompra / _DiasAlVencimientoCompra)
  571. Catch ex As Exception
  572. valor = 0
  573. End Try
  574. _YTMAlVencimientoComisionCompra = valor
  575. End Sub
  576. Private Sub CalcularDiasAcumuladosCompra()
  577. Dim valor As Integer
  578. valor = Utilidades.Days360(_UltimaFechaCuponCompra, _FechaLiquidacionCompra)
  579. _DiasAcumuladosCompra = valor
  580. CalcularInteresAcumuladoCompra()
  581. End Sub
  582. Private Sub CalcularDiasAlVencimientoCompra()
  583. Dim valor As Integer
  584. If _DiasBaseCompra = 360 Then
  585. valor = Utilidades.Days360(_FechaLiquidacionCompra, _FechaVencimientoCompra)
  586. Else
  587. valor = DateDiff(DateInterval.Day, _FechaLiquidacionCompra, _FechaVencimientoCompra)
  588. End If
  589. _DiasAlVencimientoCompra = valor
  590. CalcularYTMAlVencimientoComisionCompra()
  591. CalcularYTMAlVencimientoCompra()
  592. End Sub
  593. Private Sub CalcularInteresAcumuladoCompra()
  594. Dim valor As Double
  595. Try
  596. valor = _ValorNominalCompra * _PorcentajeCuponCompra * _DiasAcumuladosCompra / _DiasBaseCompra
  597. Catch ex As Exception
  598. valor = 0
  599. End Try
  600. _InteresAcumuladoCompra = valor
  601. 'CalcularDiasAcumuladosCompra()
  602. CalcularPorcentajeInteresAcumuladoCompra()
  603. CalcularMontoAPagarCompra()
  604. End Sub
  605. Private Sub CalcularPorcentajeInteresAcumuladoCompra()
  606. Dim valor As Double
  607. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(_PeriodicidadCompra)
  608. Try
  609. valor = _InteresAcumuladoCompra / _ValorNominalCompra * _DiasBaseCompra / vDiasPeriodo
  610. Catch ex As Exception
  611. valor = 0
  612. End Try
  613. _PorcentajeInteresAcumuladoCompra = valor
  614. CalcularPrecioSucioCompra()
  615. End Sub
  616. Private Sub CalcularPrecioSucioCompra()
  617. Dim valor As Double
  618. Try
  619. 'valor = _PrecioCompra * 0.01 + _PorcentajeInteresAcumuladoCompra
  620. valor = _PrecioCompra + _PorcentajeInteresAcumuladoCompra
  621. Catch ex As Exception
  622. valor = 0
  623. End Try
  624. _PrecioSucioCompra = valor
  625. End Sub
  626. Private Sub CalcularValorTransadoCompra()
  627. Dim valor As Double
  628. valor = (_PrecioCompra) * _ValorNominalCompra
  629. _ValorTransadoCompra = valor
  630. CalcularMontoAPagarCompra()
  631. CalcularGananciaPerdidaDeCapital()
  632. CalcularRendimientoGananciaPerdida()
  633. CalcularRendimientoDeIntereses()
  634. CalcularRendimientoDespuesImpuestos()
  635. End Sub
  636. Private Sub CalcularMontoAPagarCompra()
  637. Dim valor As Double
  638. Try
  639. valor = _ValorTransadoCompra + _SumaImpuestosyComisionesCompra + _InteresAcumuladoCompra + _CostoDeTransferenciaCompra
  640. Catch ex As Exception
  641. valor = 0
  642. End Try
  643. _MontoAPagarCompra = valor
  644. End Sub
  645. 'CALCULOS VENTA
  646. Private Sub CalcularUltimaFechaCuponVenta()
  647. Dim valor As Date
  648. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(_PeriodicidadVenta)
  649. Try
  650. _SiguienteFechaCuponCompra.AddDays(vDiasPeriodo + 1)
  651. valor = _SiguienteFechaCuponCompra
  652. Catch ex As Exception
  653. valor = Date.Now.Date
  654. End Try
  655. _UltimaFechaCuponVenta = valor
  656. CalcularSiguienteFechaCuponVenta()
  657. CalcularDiasAcumuladosVenta()
  658. End Sub
  659. Private Sub CalcularSiguienteFechaCuponVenta()
  660. Dim valor As Date
  661. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(_PeriodicidadVenta)
  662. valor = _UltimaFechaCuponVenta.AddDays(vDiasPeriodo + 1)
  663. _SiguienteFechaCuponVenta = valor
  664. End Sub
  665. Private Sub CalcularFechaLiquidacionVenta()
  666. Dim valor As Date
  667. valor = DateTime.Now.Date + DateTime.Now.AddDays(3)
  668. _FechaLiquidacionVenta = valor
  669. End Sub
  670. Private Sub CalcularYTMAlVencimientoComisionVenta()
  671. Dim valor As Double
  672. Try
  673. valor = _YTMAlVencimientoVenta - (_PorcentajeComisionCasaVenta * _DiasBaseVenta / _DiasAlVencimientoVenta) - (_PorcentajeComisionBolsaVenta * _DiasBaseVenta / _DiasAlVencimientoVenta)
  674. 'valor = valor * 100
  675. Catch ex As Exception
  676. valor = 0
  677. End Try
  678. _YTMAlVencimientoComisionVenta = valor
  679. End Sub
  680. Private Sub CalcularDiasAcumuladosVenta()
  681. Dim valor As Integer
  682. If _DiasBaseVenta = 360 Then
  683. valor = Utilidades.Days360(_UltimaFechaCuponVenta, _FechaLiquidacionVenta)
  684. Else
  685. valor = DateDiff(DateInterval.Day, _UltimaFechaCuponVenta, _FechaLiquidacionVenta)
  686. End If
  687. _DiasAcumuladosVenta = valor
  688. CalcularYTMAlVencimientoVenta()
  689. CalcularInteresAcumuladoVenta()
  690. CalcularInteresAcumuladoPorcentajeVenta()
  691. End Sub
  692. Private Sub CalcularDiasAlVencimientoVenta()
  693. Dim valor As Integer
  694. If _DiasBaseVenta = 360 Then
  695. valor = Utilidades.Days360(_FechaLiquidacionVenta, _FechaVencimientoVenta)
  696. Else
  697. valor = DateDiff(DateInterval.Day, _FechaLiquidacionVenta, _FechaVencimientoVenta)
  698. End If
  699. _DiasAlVencimientoVenta = valor
  700. CalcularYTMAlVencimientoVenta()
  701. CalcularYTMAlVencimientoComisionVenta()
  702. End Sub
  703. Private Sub CalcularInteresAcumuladoVenta()
  704. Dim valor As Double
  705. Try
  706. valor = _ValorNominalVenta * _PorcentajeCuponVenta * _DiasAcumuladosVenta / _DiasBaseVenta
  707. Catch ex As Exception
  708. valor = 0
  709. End Try
  710. _InteresAcumuladoVenta = valor
  711. CalcularInteresAcumuladoPorcentajeVenta()
  712. CalcularMontoARecibirVenta()
  713. End Sub
  714. Private Sub CalcularInteresAcumuladoPorcentajeVenta()
  715. Dim valor As Double
  716. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(_PeriodicidadVenta)
  717. Try
  718. valor = _InteresAcumuladoVenta / _ValorNominalVenta * _DiasBaseVenta / vDiasPeriodo
  719. valor = valor * 100
  720. Catch ex As Exception
  721. valor = 0
  722. End Try
  723. _InteresAcumuladoPorcentajeVenta = valor
  724. CalcularPrecioSucioVenta()
  725. End Sub
  726. Private Sub CalcularPrecioSucioVenta()
  727. Dim valor As Double
  728. Try
  729. valor = _PrecioVenta + _InteresAcumuladoPorcentajeVenta
  730. valor = valor
  731. Catch ex As Exception
  732. valor = 0
  733. End Try
  734. _PrecioSucioVenta = valor
  735. End Sub
  736. Private Sub CalcularValorTransadoVenta()
  737. Dim valor As Double
  738. Try
  739. valor = _PrecioVenta * _ValorNominalVenta
  740. Catch ex As Exception
  741. valor = 0
  742. End Try
  743. _ValorTransadoVenta = valor
  744. CalcularMontoARecibirVenta()
  745. CalcularGananciaPerdidaDeCapital()
  746. End Sub
  747. Private Sub CalcularMontoARecibirVenta()
  748. Dim valor As Double
  749. Try
  750. valor = _ValorTransadoVenta - _ComisionBolsaVenta - _ComisionCasaVenta + _InteresAcumuladoVenta
  751. Catch ex As Exception
  752. valor = 0
  753. End Try
  754. _MontoARecibirVenta = valor
  755. End Sub
  756. Private Sub CalcularDiasPlazoRO()
  757. Dim valor As Integer
  758. If _DiasBaseCompra = 360 Then
  759. valor = Utilidades.Days360(_FechaLiquidacionCompra, _FechaLiquidacionVenta)
  760. Else
  761. valor = DateDiff(DateInterval.Day, _FechaLiquidacionCompra, _FechaLiquidacionVenta)
  762. End If
  763. _DiasPlazoRO = valor
  764. CalcularRendimientoGananciaPerdida()
  765. CalcularRendimientoDeIntereses()
  766. CalcularRendimientoDespuesImpuestos()
  767. End Sub
  768. Private Sub CalcularGananciaPerdidaDeCapital()
  769. Dim valor As Double
  770. valor = _ValorTransadoVenta - _ValorTransadoCompra
  771. _GananciaPerdidaDeCapital = valor
  772. CalcularGananciaPerdidaTotal()
  773. CalcularRendimientoGananciaPerdida()
  774. End Sub
  775. Private Sub CalcularIngresoPorInteres()
  776. Dim valor As Double
  777. 'Dim vCuponesPagados As Double = 0 'FALTA VALOR
  778. 'Dim vInteresAcumulado As Double = GetInteresAcumuladoCompra()
  779. 'valor = vCuponesPagados + vInteresAcumulado
  780. valor = 0
  781. _IngresoPorInteres = valor
  782. CalcularGananciaPerdidaTotal()
  783. CalcularRendimientoDeIntereses()
  784. End Sub
  785. Private Sub CalcularGananciaPerdidaTotal()
  786. Dim valor As Double
  787. valor = _GananciaPerdidaDeCapital + _IngresoPorInteres
  788. _GananciaPerdidaTotal = valor
  789. CalcularRendimientoDespuesImpuestos()
  790. End Sub
  791. Private Sub CalcularRendimientoGananciaPerdida()
  792. Dim valor As Double
  793. Try
  794. valor = _GananciaPerdidaDeCapital / _ValorTransadoCompra * _DiasBaseCompra / _DiasPlazoRO
  795. 'valor = valor * 100
  796. Catch ex As Exception
  797. valor = 0
  798. End Try
  799. _RendimientoGananciaPerdida = valor
  800. End Sub
  801. Private Sub CalcularRendimientoDeIntereses()
  802. Dim valor As Double
  803. Try
  804. valor = _IngresoPorInteres / _ValorTransadoCompra * _DiasBaseCompra / _DiasPlazoRO
  805. 'valor = valor * 100
  806. Catch ex As Exception
  807. valor = 0
  808. End Try
  809. _RendimientoDeIntereses = valor
  810. End Sub
  811. Private Sub CalcularRendimientoDespuesImpuestos()
  812. Dim valor As Double
  813. Try
  814. valor = _GananciaPerdidaTotal / _ValorTransadoCompra * _DiasBaseCompra / _DiasPlazoRO
  815. valor = valor * 100
  816. Catch ex As Exception
  817. valor = 0
  818. End Try
  819. _RendimientoDespuesImpuestos = valor
  820. End Sub
  821. Private Sub CalcularSiguienteFechaCuponCompra()
  822. Dim valor As Date
  823. Dim vUltimaFechCupon As Date = _UltimaFechaCuponCompra
  824. Dim vPeriodicidad As String = _PeriodicidadCompra
  825. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(vPeriodicidad)
  826. valor = vUltimaFechCupon.AddDays(vDiasPeriodo + 1)
  827. _SiguienteFechaCuponCompra = valor
  828. End Sub
  829. Private Sub CalcularSumaImpuestosyComisionesCompra()
  830. _SumaImpuestosyComisionesCompra = 0
  831. End Sub
  832. 'Private Sub CalcularPorcentajeInteresAcumuladoVenta()
  833. ' Dim valor As Double
  834. ' Try
  835. ' valor = _ValorNominalVenta * _PorcentajeCuponVenta * _DiasAcumuladosVenta / _DiasBaseVenta
  836. ' Catch ex As Exception
  837. ' valor = 0
  838. ' End Try
  839. ' _PorcentajeInteresAcumuladoVenta = valor
  840. ' CalcularPrecioSucioVenta()
  841. 'End Sub
  842. Private Sub CalcularComisionBolsaVenta()
  843. _ComisionBolsaVenta = 0
  844. CalcularMontoARecibirVenta()
  845. End Sub
  846. Private Sub CalcularComisionCasaVenta()
  847. _ComisionCasaVenta = 0
  848. CalcularMontoARecibirVenta()
  849. End Sub
  850. Private Sub CalcularSumaImpuestosyComisiones()
  851. If Not Double.TryParse(_dtImpuestosYComisiones.Compute("SUM(MontoImp)", "TipoOper='C'").ToString, _SumaImpuestosyComisionesCompra) Then
  852. _SumaImpuestosyComisionesCompra = 0
  853. End If
  854. If Not Double.TryParse(_dtImpuestosYComisiones.Compute("SUM(MontoImp)", "TipoOper='V'").ToString, _SumaImpuestosYComisionesVenta) Then
  855. _SumaImpuestosYComisionesVenta = 0
  856. End If
  857. End Sub
  858. Private Sub CalcularSumasIngresos()
  859. If Not Double.TryParse(_dtIngresos.Compute("SUM(Ingreso)", "").ToString, _SumaIngresos) Then
  860. _SumaIngresos = 0
  861. End If
  862. If Not Double.TryParse(_dtIngresos.Compute("SUM(MontoImpuesto)", "").ToString, _SumaImpuestosIngresos) Then
  863. _SumaImpuestosIngresos = 0
  864. End If
  865. If Not Double.TryParse(_dtIngresos.Compute("SUM(Liquido)", "").ToString, _SumaliquidoIngresos) Then
  866. _SumaliquidoIngresos = 0
  867. End If
  868. End Sub
  869. Private Sub CalcularYTMAlVencimientoCompra()
  870. Dim vRedemption As Double = (_PrecioAlVencimientoCompra * 100) 'Amortizacion,Precio al vencimiento
  871. Dim vRate As Double = _PorcentajeCuponCompra 'Porcentaje de cupon, tasa
  872. Dim vFrecuency As Integer = 0 'For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
  873. Dim vPar As Double = (_PrecioCompra * 100) 'Precio de Compra
  874. Dim vA As Integer = _DiasAcumuladosCompra 'Dias Acumulados
  875. Dim vE As Integer = Utilidades.DiasDeUnPeriodo(_PeriodicidadCompra) 'número de días en el período del cupón.
  876. Dim vDSR As Integer = _DiasAlVencimientoCompra 'número de días desde la fecha de liquidación hasta la fecha de amortización.
  877. 'If vA = 0 Then vA = 1
  878. If _PeriodicidadCompra = "A" Then vFrecuency = 1
  879. If _PeriodicidadCompra = "S" Then vFrecuency = 2
  880. If _PeriodicidadCompra = "T" Then vFrecuency = 4
  881. _YTMAlVencimientoCompra = (vRedemption / 100) + (vRate / vFrecuency)
  882. _YTMAlVencimientoCompra = _YTMAlVencimientoCompra - ((vPar / 100) + ((vA / vE) * (vRate / vFrecuency)))
  883. _YTMAlVencimientoCompra = _YTMAlVencimientoCompra / ((vPar / 100) + ((vA / vE) * (vRate / vFrecuency)))
  884. _YTMAlVencimientoCompra = _YTMAlVencimientoCompra * ((vFrecuency * vE) / vDSR)
  885. End Sub
  886. Public Function CalcularYTMAl(ByVal PrecioVencimiento As Double, ByVal PorcentajeCupon As Double, ByVal PrecioCompra As Double, ByVal DiasAcumulados As Integer, ByVal Periodicidad As String, ByVal DiasVencimiento As Integer)
  887. 'Dim vRedemption As Double = (PrecioVencimiento * 100) 'Amortizacion,Precio al vencimiento
  888. 'Dim vRate As Double = PorcentajeCupon 'Porcentaje de cupon, tasa
  889. 'Dim vFrecuency As Integer = 0 'For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
  890. 'Dim vPar As Double = (PrecioCompra * 100) 'Precio de Compra
  891. 'Dim vA As Integer = DiasAcumulados 'Dias Acumulados
  892. 'Dim vE As Integer = Utilidades.DiasDeUnPeriodo(Periodicidad) 'número de días en el período del cupón.
  893. 'Dim vDSR As Integer = DiasVencimiento 'número de días desde la fecha de liquidación hasta la fecha de amortización.
  894. 'Dim Vencimiento
  895. 'If vA = 0 Then vA = 1
  896. Dim vFrecuency As Integer
  897. If Periodicidad = "A" Then vFrecuency = 1
  898. If Periodicidad = "S" Then vFrecuency = 2
  899. If Periodicidad = "T" Then vFrecuency = 4
  900. Dim vRedemption As Double = PrecioVencimiento 'Amortizacion,Precio al vencimiento
  901. Dim vRate As Double = PorcentajeCupon 'Porcentaje de cupon, tasa
  902. 'Dim vFrecuency As Integer = 'For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
  903. Dim vPar As Double = PrecioCompra 'Precio de Compra
  904. Dim vA As Integer = DiasAcumulados 'Dias Acumulados
  905. Dim vE As Integer = Utilidades.DiasDeUnPeriodo(Periodicidad) 'número de días en el período del cupón.
  906. Dim vDSR As Integer = DiasVencimiento 'número de días desde la fecha de liquidación hasta la fecha de amortización.
  907. Dim Vencimiento
  908. 'If vA = 0 Then vA = 1
  909. Vencimiento = (vRedemption / 100) + (vRate / vFrecuency)
  910. Vencimiento = Vencimiento - ((vPar / 100) + ((vA / vE) * (vRate / vFrecuency)))
  911. Vencimiento = Vencimiento / ((vPar / 100) + ((vA / vE) * (vRate / vFrecuency)))
  912. Vencimiento = Vencimiento * ((vFrecuency * vE) / vDSR)
  913. 'Dim pr = (vRedemption / (1 + Vencimiento / vFrecuency) ^ (50 - 1 + (vDSR / vE))) + (100 * (vRate / vFrecuency)) / (1 + (Vencimiento / vFrecuency)) ^ (vDSR / vE) - (100 * (vRate / vFrecuency) * vA / vE)
  914. Return Vencimiento
  915. End Function
  916. Public Function CalcularYTMComision(ByVal YTMVen As Double, ByVal ComisionCasa As Double, ByVal DiasVencimiento As Integer, ByVal ComisionBolsa As Double, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
  917. Dim Valor As Double = 0.0
  918. If (DiasVencimiento <> 0) Then
  919. If (IndexBase = 0) Then
  920. Valor = YTMVen - ((ComisionCasa) * 360 / DiasVencimiento) - ((ComisionBolsa) * 360 / DiasVencimiento)
  921. Return Valor
  922. ElseIf (IndexBase = 1) Then
  923. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  924. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  925. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
  926. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
  927. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  928. PrOpc1 = ((ComisionCasa) * 366 / DiasPrimeraFecha) - ((ComisionBolsa) * 366 / DiasPrimeraFecha)
  929. PrOpc2 = ((ComisionCasa) * 365 / DiasSegundaFecha) - ((ComisionBolsa) * 365 / DiasSegundaFecha)
  930. Valor = YTMVen - PrOpc1 + PrOpc2
  931. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  932. Valor = YTMVen - ((ComisionCasa) * 365 / DiasSegundaFecha) - ((ComisionBolsa) * 365 / DiasSegundaFecha)
  933. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  934. Valor = YTMVen - ((ComisionCasa) * 366 / DiasPrimeraFecha) - ((ComisionBolsa) * 366 / DiasPrimeraFecha)
  935. Else
  936. Valor = 0
  937. End If
  938. Return Valor
  939. ElseIf (IndexBase = 2) Then
  940. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  941. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  942. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2)
  943. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2)
  944. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  945. PrOpc1 = ((ComisionCasa) * 366 / DiasPrimeraFecha) - ((ComisionBolsa) * 366 / DiasPrimeraFecha)
  946. PrOpc2 = ((ComisionCasa) * 365 / DiasSegundaFecha) - ((ComisionBolsa) * 365 / DiasSegundaFecha)
  947. Valor = YTMVen - PrOpc1 + PrOpc2
  948. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  949. Valor = YTMVen - ((ComisionCasa) * 365 / DiasSegundaFecha) - ((ComisionBolsa) * 365 / DiasSegundaFecha)
  950. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  951. Valor = YTMVen - ((ComisionCasa) * 366 / DiasPrimeraFecha) - ((ComisionBolsa) * 366 / DiasPrimeraFecha)
  952. Else
  953. Valor = 0
  954. End If
  955. Return Valor
  956. Else
  957. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  958. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  959. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
  960. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
  961. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  962. PrOpc1 = ((ComisionCasa) * 360 / DiasPrimeraFecha) - ((ComisionBolsa) * 360 / DiasPrimeraFecha)
  963. PrOpc2 = ((ComisionCasa) * 360 / DiasSegundaFecha) - ((ComisionBolsa) * 360 / DiasSegundaFecha)
  964. Valor = YTMVen - PrOpc1 + PrOpc2
  965. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  966. Valor = YTMVen - ((ComisionCasa) * 360 / DiasSegundaFecha) - ((ComisionBolsa) * 360 / DiasSegundaFecha)
  967. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  968. Valor = YTMVen - ((ComisionCasa) * 360 / DiasPrimeraFecha) - ((ComisionBolsa) * 360 / DiasPrimeraFecha)
  969. Else
  970. Valor = 0
  971. End If
  972. Return Valor
  973. End If
  974. End If
  975. Return Valor
  976. End Function
  977. Private Sub CalcularYTMAlVencimientoVenta()
  978. Dim vRedemption As Double = (_PrecioAlVencimientoVenta * 100) 'Amortizacion,Precio al vencimiento
  979. Dim vRate As Double = _PorcentajeCuponVenta 'Porcentaje de cupon, tasa
  980. Dim vFrecuency As Integer = 0 'For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
  981. Dim vPar As Double = (_PrecioVenta * 100) 'Precio de Compra
  982. Dim vA As Integer = _DiasAcumuladosVenta 'Dias Acumulados
  983. Dim vE As Integer = Utilidades.DiasDeUnPeriodo(_PeriodicidadVenta) 'número de días en el período del cupón.
  984. Dim vDSR As Integer = _DiasAlVencimientoVenta 'número de días desde la fecha de liquidación hasta la fecha de amortización.
  985. 'If vA = 0 Then vA = 1
  986. If _PeriodicidadVenta = "A" Then vFrecuency = 1
  987. If _PeriodicidadVenta = "S" Then vFrecuency = 2
  988. If _PeriodicidadVenta = "T" Then vFrecuency = 4
  989. _YTMAlVencimientoVenta = (vRedemption / 100) + (vRate / vFrecuency)
  990. _YTMAlVencimientoVenta = _YTMAlVencimientoVenta - ((vPar / 100) + ((vA / vE) * (vRate / vFrecuency)))
  991. _YTMAlVencimientoVenta = _YTMAlVencimientoVenta / ((vPar / 100) + ((vA / vE) * (vRate / vFrecuency)))
  992. _YTMAlVencimientoVenta = _YTMAlVencimientoVenta * ((vFrecuency * vE) / vDSR)
  993. End Sub
  994. End Class