Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Support for Mass Action and Standard Incidence Selection and the Models SI, SIS, and SIRS #301

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
9 changes: 9 additions & 0 deletions dco/Maximilian Boeck.dco
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
1) I, Maximilian Boeck, certify that all work committed with the commit message
"covered by: Maximilian Boeck.dco" is my original work and I own the copyright
to this work. I agree to contribute this code under the Apache 2.0 license.

2) I understand and agree all contribution including all personal
information I submit with it is maintained indefinitely and may be
redistributed consistent with the open source license(s) involved.

This certification is effective for all code contributed from 2024-08-05 to 9999-01-01.
3 changes: 2 additions & 1 deletion docs/classes/gs_quant.models.epidemiology.EpidemicModel.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gs\_quant.models.epidemiology.EpidemicModel
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.models.epidemiology.EpidemicModel
===========================================

.. currentmodule:: gs_quant.models.epidemiology
Expand Down
4 changes: 3 additions & 1 deletion docs/classes/gs_quant.models.epidemiology.SEIR.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
gs\_quant.models.epidemiology.SEIR
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license

gs\_quant.models.epidemiology.SEIR
==================================

.. currentmodule:: gs_quant.models.epidemiology
Expand Down
25 changes: 25 additions & 0 deletions docs/classes/gs_quant.models.epidemiology.SI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.models.epidemiology.SI
=================================

.. currentmodule:: gs_quant.models.epidemiology

.. autoclass:: SI


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~SI.__init__
~SI.calibrate
~SI.get_parameters






3 changes: 2 additions & 1 deletion docs/classes/gs_quant.models.epidemiology.SIR.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gs\_quant.models.epidemiology.SIR
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.models.epidemiology.SIR
=================================

.. currentmodule:: gs_quant.models.epidemiology
Expand Down
25 changes: 25 additions & 0 deletions docs/classes/gs_quant.models.epidemiology.SIRS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.models.epidemiology.SIRS
=================================

.. currentmodule:: gs_quant.models.epidemiology

.. autoclass:: SIRS


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~SIRS.__init__
~SIRS.calibrate
~SIRS.get_parameters






25 changes: 25 additions & 0 deletions docs/classes/gs_quant.models.epidemiology.SIS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.models.epidemiology.SIS
=================================

.. currentmodule:: gs_quant.models.epidemiology

.. autoclass:: SIS


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~SIS.__init__
~SIS.calibrate
~SIS.get_parameters






3 changes: 2 additions & 1 deletion docs/classes/gs_quant.timeseries.statistics.SEIRModel.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gs\_quant.timeseries.statistics.SEIRModel
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.timeseries.statistics.SEIRModel
=========================================

.. currentmodule:: gs_quant.timeseries.statistics
Expand Down
25 changes: 25 additions & 0 deletions docs/classes/gs_quant.timeseries.statistics.SIModel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license

gs\_quant.timeseries.statistics.SIModel
========================================

.. currentmodule:: gs_quant.timeseries.statistics

.. autoclass:: SIModel



.. rubric:: Methods
.. autosummary::

~SIModel.beta

~SIModel.i0

~SIModel.predict_i

~SIModel.predict_s

~SIModel.s0


3 changes: 2 additions & 1 deletion docs/classes/gs_quant.timeseries.statistics.SIRModel.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
gs\_quant.timeseries.statistics.SIRModel
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.timeseries.statistics.SIRModel
========================================

.. currentmodule:: gs_quant.timeseries.statistics
Expand Down
32 changes: 32 additions & 0 deletions docs/classes/gs_quant.timeseries.statistics.SIRSModel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.timeseries.statistics.SIRSModel
========================================

.. currentmodule:: gs_quant.timeseries.statistics

.. autoclass:: SIRSModel



.. rubric:: Methods
.. autosummary::

~SIRSModel.beta

~SIRSModel.gamma

~SIRSModel.delta

~SIRSModel.i0

~SIRSModel.predict_i

~SIRSModel.predict_r

~SIRSModel.predict_s

~SIRSModel.r0

~SIRSModel.s0


26 changes: 26 additions & 0 deletions docs/classes/gs_quant.timeseries.statistics.SISModel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
gs\_quant.timeseries.statistics.SISModel
========================================

.. currentmodule:: gs_quant.timeseries.statistics

.. autoclass:: SISModel



.. rubric:: Methods
.. autosummary::

~SISModel.beta

~SISModel.delta

~SISModel.i0

~SISModel.predict_i

~SISModel.predict_s

~SISModel.s0


5 changes: 4 additions & 1 deletion docs/models.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
Models Package
==============

Expand All @@ -10,7 +10,10 @@ Epidemiology
.. autosummary::
:toctree: classes

SI
SIS
SIR
SIRS
SEIR
EpidemicModel

Expand Down
5 changes: 4 additions & 1 deletion docs/module/models.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
Models Package
==============

Expand All @@ -10,7 +10,10 @@ Epidemiology
.. autosummary::
:toctree: classes

SI
SIS
SIR
SIRS
SEIR
EpidemicModel

Expand Down
3 changes: 2 additions & 1 deletion docs/timeseries.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

.. This product contains code copyright Maximilian Boeck, licensed under Apache 2.0 license
Timeseries Package
==================

Expand Down Expand Up @@ -149,6 +149,7 @@ Statistics

LinearRegression
RollingLinearRegression
SIModel
SIRModel
SEIRModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@
"pycharm": {
"stem_cell": {
"cell_type": "raw",
"source": [],
"metadata": {
"collapsed": false
}
},
"source": []
}
}
},
Expand Down
9 changes: 6 additions & 3 deletions gs_quant/markets/securities.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

//Portions copyright Maximilian Boeck. Licensed under Apache 2.0 license
"""

import calendar
import datetime
import datetime as dt
Expand Down Expand Up @@ -1521,7 +1524,7 @@ def get_asset(cls,

Get asset by bloomberg id:

>>> gs = SecurityMaster.get_asset("GS UN", AssetIdentifier.BLOOMBERG_ID)
>>> gs = SecurityMaster.get_asset("GS UN", AssetIdentifier.BLOOMBERG_ID, as_of=dt.datetime(2022, 2, 2, 22, 22))

Get asset by ticker and exchange code:

Expand Down Expand Up @@ -1590,7 +1593,7 @@ def _get_security_master_asset(cls,
type_ = id_type.value
params = {
type_: id_value,
'asOfDate': as_of.strftime('%Y-%m-%d') # TODO: update endpoint to take times
'asOfDate': as_of.strftime('%Y-%m-%dT%H:%M:%S') if isinstance(as_of, dt.datetime) else as_of.strftime('%Y-%m-%d')
}
if fields is not None:
request_fields = {
Expand Down Expand Up @@ -1651,7 +1654,7 @@ def get_identifiers(cls, id_values: List[str], id_type: SecurityIdentifier, as_o
params = {
type_: id_values,
'fields': ['id', 'identifiers'],
'asOfDate': as_of.strftime('%Y-%m-%d') # TODO: update endpoint to take times
'asOfDate': as_of.strftime('%Y-%m-%dT%H:%M:%S') if isinstance(as_of, dt.datetime) else as_of.strftime('%Y-%m-%d')
}

r = GsSession.current._get('/markets/securities', payload=params)
Expand Down
Loading