Skip to content

Commit

Permalink
update ref
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed May 29, 2024
1 parent 0f58de8 commit ecf6020
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 34 deletions.
19 changes: 19 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ Since version ``0.26.7``, ``absbox`` ships with a shortcut to connect public/tes
localAPI = API(EnginePath.LOCAL,check=False)
Auto Connect Best Fit Engine
""""""""""""""""""""""""""""""""

The function ``PickApiFrom`` will try to connect to the best fit engine from the list of APIs.

If ``absbox`` is version ``0.28.5``, it will find first engine with version ``0.28.x`` and connect to it.

.. versionadded:: 0.28.5

.. code-block:: python
from absbox import PickApiFrom
# auto connect to the best fit engine
listOfApis = [EnginePath.PROD,EnginePath.DEV,"http://your_own_server:8081"]
api = PickApiFrom(listOfApis,check=False,lang='english')
Use Public Server
^^^^^^^^^^^^^^^^^^^^^

Expand Down
92 changes: 60 additions & 32 deletions docs/source/modeling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1626,9 +1626,6 @@ syntax:
- Yes
- Optional
syntax
``({account name},{account description})``
Bank Account
^^^^^^^^^^^^^^^^^^
Expand All @@ -1651,73 +1648,104 @@ There is one extra field to set for ``Reserve Account`` : ``type``
syntax
``(<account name>,{'balance':<cash on account>,'type':<reserve target amount>})``
* Fix Amount: a single reserve amount
``type`` can be set as :
* Fix Amount: a single reserve amount which fixed during cashflow projection
syntax
``("fix",<Amount>)``
``("fixReserve",<Amount>)``
.. code-block:: python
("ReserveAccountA",{"balance":0
,"type":{"fixReserve":1000}})
# 3 forms are all valid and same
("ReserveAccountA",{"balance":0,"type":{"fixReserve":1000}})
("ReserveAcc1",{"balance":100, "type":("fix",1000)})
("ReserveAcc2",{"balance":100, "type":("fixReserve",1000)})
* Formula: the target reserve amount is derived from a :ref:`Formula` , like 2% of pool balance
syntax
``("target",<Formula>,<Factor>)``
``("target",<Formula>)``
.. code-block:: python
("ReserveAccountB",{"balance":0
,"type":{"targetReserve":[("poolBalance",),0.015]}})
# type: ("target",<Formula>,<Factor>)
("ReserveAcc3",{"balance":100, "type":("target"
,("poolBalance",)
,0.015)})
# type: ("target",<Formula>)
("ReserveAcc3",{"balance":100, "type":("target"
,("*",("poolBalance",),0.015))})
* Nested Formula, the target reserve amount is base on *higher* or *lower* of two formulas
User can just reuse the powerful expression from :ref:`Formula` to set the reserve amount.
.. code-block:: python
("target",("max"
,("*",("poolBalance",),0.01)
,("const",1000)
))
("target",("floorWith"
,("max"
,("*",("poolBalance",),0.01)
,("const",1000))
,("const",100)))
* Nested Formula, the target reserve amount is base on higher or lower of two formula
* Conditional amount starts with ``When``, the target reserve amount depends on :ref:`Condition`:
* Use 1st formula if condition is true
* Use 2nd formula if condition is false
syntax
``{"when":[<Condition>,<type1>,<type2>]}``
``("when", <Condition>, <type1>, <type2>)``
.. code-block:: python
("ReserveAccountC",{"balance":0
,"type":{"max":[
{"targetReserve":[("poolBalance",),0.015]}
,{"fixReserve":100}]})
("ReserveAccountD",{"balance":0
,"type":{"min":[
{"targetReserve":[("poolBalance",),0.015]}
,{"fixReserve":100}]})
("ReserveAccountE",{"balance":0
,"type":{"min":[
{"max":[{"targetReserve":[("poolBalance",),0.015]}
,{"fixReserve":100}]}
,{"fixReserve":150}]})
("ReserveAccountF",{"balance":0
,"type":{"when":[
[("bondBalance",">",0]
[("bondBalance",),">",0]
,{"max":[{"targetReserve":[("poolBalance",),0.015]}
,{"fixReserve":100}]}
,{"fixReserve":150}]})
("ReserveAccountG",{"balance":0
,"type":{"when":[
["any"
,[("bondBalance",">",0]
,[("poolFactor","<",0.5]]
,[("bondBalance",),">",0]
,[("poolFactor",),"<",0.5]]
,{"max":[{"targetReserve":[("poolBalance",),0.015]}
,{"fixReserve":100}]}
,{"fixReserve":150}]})
Model Reinvestment
Reinvestment Setup
^^^^^^^^^^^^^^^^^^^^^^^^^^
To model the interest or short-term investment income in the account.
To model the interest or short-term investment income in the account. The earning rate can either be fixed rate or floating rate.
* fix rate syntax:
Fix rate syntax:
``{"period": <date Pattern>, "rate": <number>, "lastSettleDate":<date>}``
* floater rate syntax:
Floater rate syntax:
``{"period": <date Pattern>, "index": <index name>, "spread": <number>, "lastSettleDate":<date>}``
Make sure there the index rate curve is supplied in the assumption.
.. code-block:: python
Expand Down
8 changes: 8 additions & 0 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ Videos
- URL
* - 101 - Introduction
- https://www.youtube.com/watch?v=fb8j96beLGQ
* - 102 - Account
- TBD
* - 103 - Assets
- TBD
* - 104 - Bonds
- TBD
* - 105 - Waterfall
- TBD



Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,3 @@ install_requires =
more-itertools
pyxirr
lenses


0 comments on commit ecf6020

Please sign in to comment.