Loan line members ================= A line created by ``co.bs.loan`` has the series attributes described under :class:`boki.LineItem` and the method below. The method exists on loan lines only, so it is generated here from a live loan. .. py:method:: boki.LineItem.draw_or_repay(amount) Borrow or repay an amount in every period, with cash moving by the same amount. Use it when the borrowing follows from the cash position, such as a revolving facility. It posts in addition to ``draw=`` and ``repay=``; those are unchanged. :Parameters: **amount** : scalar, Quantity, Series, or dict Amount borrowed in each period, in the entity's currency per period: positive to draw, negative to repay. A dict maps period labels or indices to amounts and books 0 in the other periods. A rate per time, such as ``100 * JPY / b.month``, is integrated by period length. :Returns: LineItem This loan line, so calls can be chained. :Raises: TypeError At construction, if the loan is from another entity (created with ``counterparty=``). UnitError At construction, if ``amount`` is in a unit other than the entity's currency. .. rubric:: Notes Each period debits cash and credits the loan by ``amount`` (a negative amount reverses the entry), under the posting name `` (net borrowing)``. The loan's balance includes it, so interest of later periods accrues on it, but the loan's ``draw`` and ``principal`` do not. .. rubric:: Examples Draw 100 and 50, then repay 80, on a loan with no interest: >>> import boki as b >>> m = b.Model("Revolver", start="2027-01", periods=3, step=b.month) >>> co = m.entity("Co", standard=b.IFRS) >>> co.bs.opening(cash=1000) >>> loan = co.bs.loan("Revolver", rate=0) >>> _ = loan.draw_or_repay(m.series("Net", data={0: 100, 1: 50, 2: -80})) >>> r = m.render() >>> r[loan] [100.0, 150.0, 70.0] >>> r[co.bs.cash] [1100.0, 1150.0, 1070.0]