Explorar o código

course created, lilla, lucy moved over

Tamas %!s(int64=2) %!d(string=hai) anos
pai
achega
0d8a03c29f
Modificáronse 95 ficheiros con 1509 adicións e 0 borrados
  1. 192 0
      bin/bonds.ipynb
  2. 955 0
      bin/lilla.ipynb
  3. 362 0
      bin/lucy.ipynb
  4. 0 0
      course/Chap01/hello - workingy.py
  5. 0 0
      course/Chap01/hello-version.py
  6. 0 0
      course/Chap01/hello-working.py
  7. 0 0
      course/Chap01/hello.py
  8. 0 0
      course/Chap02/blocks.py
  9. 0 0
      course/Chap02/class.py
  10. 0 0
      course/Chap02/conditionals.py
  11. 0 0
      course/Chap02/fibonacci.py
  12. 0 0
      course/Chap02/for.py
  13. 0 0
      course/Chap02/function.py
  14. 0 0
      course/Chap02/hello - working.py
  15. 0 0
      course/Chap02/hello-cwd.py
  16. 0 0
      course/Chap02/hello-main.py
  17. 0 0
      course/Chap02/hello-version - working.py
  18. 0 0
      course/Chap02/hello-version.py
  19. 0 0
      course/Chap02/hello.py
  20. 0 0
      course/Chap02/primes.py
  21. 0 0
      course/Chap02/statements.py
  22. 0 0
      course/Chap02/while.py
  23. 0 0
      course/Chap03/hello.py
  24. 0 0
      course/Chap03/sequence.py
  25. 0 0
      course/Chap03/types.py
  26. 0 0
      course/Chap04/conditional.py
  27. 0 0
      course/Chap04/hello.py
  28. 0 0
      course/Chap04/ternary.py
  29. 0 0
      course/Chap05/arithmetic.py
  30. 0 0
      course/Chap05/bitwise.py
  31. 0 0
      course/Chap05/boolean.py
  32. 0 0
      course/Chap05/comparison.py
  33. 0 0
      course/Chap05/hello.py
  34. 0 0
      course/Chap06/for.py
  35. 0 0
      course/Chap06/hello.py
  36. 0 0
      course/Chap06/while.py
  37. 0 0
      course/Chap07/args.py
  38. 0 0
      course/Chap07/decorator.py
  39. 0 0
      course/Chap07/function.py
  40. 0 0
      course/Chap07/generator.py
  41. 0 0
      course/Chap07/hello.py
  42. 0 0
      course/Chap07/kwargs.py
  43. 0 0
      course/Chap08/comprehension.py
  44. 0 0
      course/Chap08/dict.py
  45. 0 0
      course/Chap08/hello.py
  46. 0 0
      course/Chap08/lists.py
  47. 0 0
      course/Chap08/mixed.py
  48. 0 0
      course/Chap08/sets.py
  49. 0 0
      course/Chap09/class.py
  50. 0 0
      course/Chap09/constructor.py
  51. 0 0
      course/Chap09/hello.py
  52. 0 0
      course/Chap09/inheritance.py
  53. 0 0
      course/Chap09/iterator.py
  54. 0 0
      course/Chap09/methods.py
  55. 0 0
      course/Chap09/string.py
  56. 0 0
      course/Chap09/variables.py
  57. 0 0
      course/Chap10/exceptions.py
  58. 0 0
      course/Chap10/hello.py
  59. 0 0
      course/Chap11/hello.py
  60. 0 0
      course/Chap11/split-join.py
  61. 0 0
      course/Chap12/berlin.jpg
  62. 0 0
      course/Chap12/copy-bin.py
  63. 0 0
      course/Chap12/copy-text.py
  64. 0 0
      course/Chap12/files.py
  65. 0 0
      course/Chap12/hello.py
  66. 0 0
      course/Chap12/lines.txt
  67. 0 0
      course/Chap13/hello.py
  68. 0 0
      course/Chap13/types.py
  69. 0 0
      course/Chap14/hello.py
  70. 0 0
      course/Chap14/modules.py
  71. 0 0
      course/Chap14/saytime-test.py
  72. 0 0
      course/Chap14/saytime.py
  73. 0 0
      course/Chap15/bwDB.py
  74. 0 0
      course/Chap15/db-api.py
  75. 0 0
      course/Chap15/hello.py
  76. 0 0
      course/Chap15/jurl/.htaccess
  77. 0 0
      course/Chap15/jurl/bwCGI.py
  78. 0 0
      course/Chap15/jurl/bwConfig.py
  79. 0 0
      course/Chap15/jurl/bwDB.py
  80. 0 0
      course/Chap15/jurl/bwTL.py
  81. 0 0
      course/Chap15/jurl/cgi-test.py
  82. 0 0
      course/Chap15/jurl/data/jurl.db
  83. 0 0
      course/Chap15/jurl/data/jurl.sql
  84. 0 0
      course/Chap15/jurl/db.conf
  85. 0 0
      course/Chap15/jurl/db.py
  86. 0 0
      course/Chap15/jurl/html/db.css
  87. 0 0
      course/Chap15/jurl/html/delconfirm.html
  88. 0 0
      course/Chap15/jurl/html/edit.html
  89. 0 0
      course/Chap15/jurl/html/footer.html
  90. 0 0
      course/Chap15/jurl/html/header.html
  91. 0 0
      course/Chap15/jurl/html/index.html
  92. 0 0
      course/Chap15/jurl/html/main.html
  93. 0 0
      course/Chap15/jurl/html/nextprev.html
  94. 0 0
      course/Chap15/jurl/html/recline.html
  95. 0 0
      course/Chap15/jurl/jurl.py

+ 192 - 0
bin/bonds.ipynb

@@ -0,0 +1,192 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "id": "9a5b00b8-2d18-4540-80ff-cf985f653dce",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "100 30 0.5 3 5 False\n"
+     ]
+    }
+   ],
+   "source": [
+    "class Bond:\n",
+    "    def __init__(\n",
+    "            self,\n",
+    "            par,\n",
+    "            term,\n",
+    "            couponInt,\n",
+    "            paymentFreq,\n",
+    "            intRate,\n",
+    "            amortizing=False):\n",
+    "        self.par=par\n",
+    "        self.term=term\n",
+    "        self.couponInt=couponInt\n",
+    "        self.paymentFreq=paymentFreq\n",
+    "        self.intRate=intRate\n",
+    "        self.amortizing=amortizing\n",
+    "        \n",
+    "    def calculate(self):\n",
+    "        if self.amortizing==True:\n",
+    "            self.par*self.couponInt\n",
+    "        \n",
+    "        print(self.par,self.term,self.couponInt,self.paymentFreq,self.intRate,self.amortizing)\n",
+    "\n",
+    "Ex1=Bond(100, 30,0.5, 3,5, False)\n",
+    "Ex1.calculate()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "id": "7d04967a-d8b9-46f1-8bd4-60b38370a956",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "#Price = ( Coupon × 1 − ( 1 + r ) − n r ) + Par Value ( 1 + r ) n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "id": "365a82d5-7799-4ef0-9735-8f6eb0da9e67",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "#Bond Premium Amortized= P x R – N x Y\n",
+    "#P = Bond issue price, R = Market Rate of interest, N = Nominal or face value and, Y = coupon rate of interest/ Yield."
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 10,
+   "id": "f0143155-7445-417a-ac26-4a7bab893295",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "1375.7049230300258"
+      ]
+     },
+     "execution_count": 10,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "class Bond:\n",
+    "    def __init__(\n",
+    "            self,\n",
+    "            par,\n",
+    "            term,\n",
+    "            couponInt,\n",
+    "            paymentFreq,\n",
+    "            intRate,\n",
+    "            amortizing=False):\n",
+    "        self.par=par\n",
+    "        self.term=term\n",
+    "        self.couponInt=couponInt\n",
+    "        self.paymentFreq=paymentFreq\n",
+    "        self.intRate=intRate\n",
+    "        self.amortizing=amortizing\n",
+    "        \n",
+    "    def calculate(self):\n",
+    "        if self.amortizing==False:\n",
+    "            price=(((self.par*self.couponInt)*(1-(1+self.intRate)**-self.paymentFreq)/self.intRate)+(self.par/(1+self.intRate)**self.term))\n",
+    "            return(price)\n",
+    "        else:\n",
+    "            1==1\n",
+    "            \n",
+    "\n",
+    "Ex1 = Bond(1000, 4, .25, 4, .125, False)\n",
+    "Ex1.calculate()\n",
+    "\n"
+   ]
+  },
+  {
+   "cell_type": "raw",
+   "id": "ca78ef5f-b510-4046-9e25-b25774acc50f",
+   "metadata": {},
+   "source": [
+    "non-amortizing\n",
+    "month  balance  principal  interest\n",
+    "0      100      0          5\n",
+    "1      100      0          5\n",
+    "2\n",
+    "3\n",
+    "...\n",
+    "119   100       0          5\n",
+    "120   0         100        5\n",
+    "\n",
+    "\n",
+    "Amortizing bond:\n",
+    "r = 6%\n",
+    "month  balance  principal  interest\n",
+    "0      100      0.          0\n",
+    "1      99.9      .1         0.5\n",
+    "2      99.799    .101       0.499\n",
+    "...\n",
+    "119    1        1          0.051\n",
+    "120    0        1          0.05\n",
+    "\n",
+    "condition: \n",
+    "r = a given number (yearly interest rate) \n",
+    "interest = previuos balance * r / 12\n",
+    "principal + intersst = constant for the life of the bond\n",
+    "balance at the final month = 0\n",
+    "\n",
+    "create a function:\n",
+    "f( first principal) -> last balance\n",
+    "\n",
+    "def lastBalance( fp):\n",
+    "    ....\n",
+    "    ....\n",
+    "    ....\n",
+    "    \n",
+    "lastBalance(0.1) \n",
+    "2\n",
+    "\n",
+    "lastBalance(1) \n",
+    "-20\n",
+    "\n",
+    "\n",
+    "\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "b1adb876-0acb-439f-a32c-5b20d87c0e02",
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3 (ipykernel)",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.10.7"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 955 - 0
bin/lilla.ipynb


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 362 - 0
bin/lucy.ipynb


Chap01/hello - workingy.py → course/Chap01/hello - workingy.py


Chap01/hello-version.py → course/Chap01/hello-version.py


Chap01/hello-working.py → course/Chap01/hello-working.py


Chap01/hello.py → course/Chap01/hello.py


Chap02/blocks.py → course/Chap02/blocks.py


Chap02/class.py → course/Chap02/class.py


Chap02/conditionals.py → course/Chap02/conditionals.py


Chap02/fibonacci.py → course/Chap02/fibonacci.py


Chap02/for.py → course/Chap02/for.py


Chap02/function.py → course/Chap02/function.py


Chap02/hello - working.py → course/Chap02/hello - working.py


Chap02/hello-cwd.py → course/Chap02/hello-cwd.py


Chap02/hello-main.py → course/Chap02/hello-main.py


Chap02/hello-version - working.py → course/Chap02/hello-version - working.py


Chap02/hello-version.py → course/Chap02/hello-version.py


Chap02/hello.py → course/Chap02/hello.py


Chap02/primes.py → course/Chap02/primes.py


Chap02/statements.py → course/Chap02/statements.py


Chap02/while.py → course/Chap02/while.py


Chap03/hello.py → course/Chap03/hello.py


Chap03/sequence.py → course/Chap03/sequence.py


Chap03/types.py → course/Chap03/types.py


Chap04/conditional.py → course/Chap04/conditional.py


Chap04/hello.py → course/Chap04/hello.py


Chap04/ternary.py → course/Chap04/ternary.py


Chap05/arithmetic.py → course/Chap05/arithmetic.py


Chap05/bitwise.py → course/Chap05/bitwise.py


Chap05/boolean.py → course/Chap05/boolean.py


Chap05/comparison.py → course/Chap05/comparison.py


Chap05/hello.py → course/Chap05/hello.py


Chap06/for.py → course/Chap06/for.py


Chap06/hello.py → course/Chap06/hello.py


Chap06/while.py → course/Chap06/while.py


Chap07/args.py → course/Chap07/args.py


Chap07/decorator.py → course/Chap07/decorator.py


Chap07/function.py → course/Chap07/function.py


Chap07/generator.py → course/Chap07/generator.py


Chap07/hello.py → course/Chap07/hello.py


Chap07/kwargs.py → course/Chap07/kwargs.py


Chap08/comprehension.py → course/Chap08/comprehension.py


Chap08/dict.py → course/Chap08/dict.py


Chap08/hello.py → course/Chap08/hello.py


Chap08/lists.py → course/Chap08/lists.py


Chap08/mixed.py → course/Chap08/mixed.py


Chap08/sets.py → course/Chap08/sets.py


Chap09/class.py → course/Chap09/class.py


Chap09/constructor.py → course/Chap09/constructor.py


Chap09/hello.py → course/Chap09/hello.py


Chap09/inheritance.py → course/Chap09/inheritance.py


Chap09/iterator.py → course/Chap09/iterator.py


Chap09/methods.py → course/Chap09/methods.py


Chap09/string.py → course/Chap09/string.py


Chap09/variables.py → course/Chap09/variables.py


Chap10/exceptions.py → course/Chap10/exceptions.py


Chap10/hello.py → course/Chap10/hello.py


Chap11/hello.py → course/Chap11/hello.py


Chap11/split-join.py → course/Chap11/split-join.py


Chap12/berlin.jpg → course/Chap12/berlin.jpg


Chap12/copy-bin.py → course/Chap12/copy-bin.py


Chap12/copy-text.py → course/Chap12/copy-text.py


Chap12/files.py → course/Chap12/files.py


Chap12/hello.py → course/Chap12/hello.py


Chap12/lines.txt → course/Chap12/lines.txt


Chap13/hello.py → course/Chap13/hello.py


Chap13/types.py → course/Chap13/types.py


Chap14/hello.py → course/Chap14/hello.py


Chap14/modules.py → course/Chap14/modules.py


Chap14/saytime-test.py → course/Chap14/saytime-test.py


Chap14/saytime.py → course/Chap14/saytime.py


Chap15/bwDB.py → course/Chap15/bwDB.py


Chap15/db-api.py → course/Chap15/db-api.py


Chap15/hello.py → course/Chap15/hello.py


Chap15/jurl/.htaccess → course/Chap15/jurl/.htaccess


Chap15/jurl/bwCGI.py → course/Chap15/jurl/bwCGI.py


Chap15/jurl/bwConfig.py → course/Chap15/jurl/bwConfig.py


Chap15/jurl/bwDB.py → course/Chap15/jurl/bwDB.py


Chap15/jurl/bwTL.py → course/Chap15/jurl/bwTL.py


Chap15/jurl/cgi-test.py → course/Chap15/jurl/cgi-test.py


Chap15/jurl/data/jurl.db → course/Chap15/jurl/data/jurl.db


Chap15/jurl/data/jurl.sql → course/Chap15/jurl/data/jurl.sql


Chap15/jurl/db.conf → course/Chap15/jurl/db.conf


Chap15/jurl/db.py → course/Chap15/jurl/db.py


Chap15/jurl/html/db.css → course/Chap15/jurl/html/db.css


Chap15/jurl/html/delconfirm.html → course/Chap15/jurl/html/delconfirm.html


Chap15/jurl/html/edit.html → course/Chap15/jurl/html/edit.html


Chap15/jurl/html/footer.html → course/Chap15/jurl/html/footer.html


Chap15/jurl/html/header.html → course/Chap15/jurl/html/header.html


Chap15/jurl/html/index.html → course/Chap15/jurl/html/index.html


Chap15/jurl/html/main.html → course/Chap15/jurl/html/main.html


Chap15/jurl/html/nextprev.html → course/Chap15/jurl/html/nextprev.html


Chap15/jurl/html/recline.html → course/Chap15/jurl/html/recline.html


Chap15/jurl/jurl.py → course/Chap15/jurl/jurl.py