Metadata-Version: 2.4
Name: cnfixedratebond
Version: 0.3.0
Summary: Fixed rate bond in ib, sse and szse
Author-email: Rho Zhang <rhozhang@163.com>
License-Expression: MIT
Project-URL: Homepage, https://gitee.com/rhozhang/cnfixedratebond
Project-URL: Issues, https://gitee.com/rhozhang/cnfixedratebond/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Dynamic: license-file

# Fixed Rate Bond in China Mainland with Python

We take account frbs in inter-bank market, sse and szse only

## Attributes

- maturitydate
- couponrate
- frequency
- issuedate: optional, None by default

## Methods

method names mimic those in MS-Excel

- yearsresidual(settlement)
- coupnum(settlement)
- couppcd(settlement)
- coupncd(settlement)
- accrint(settlement, *, dcc)
- price(settlement, yld, *, dcc)
- yld(settlement, prc, *, dcc)
- duration(settlement, yld, *, continuous)
- convexity(settlement, yld, *, continuous)
- __cfs(settlement)
  
## Dependencies

- numpy

## Installation

```
pip install cnfixedratebond
```

## Usage

```
from fixedratebond import FRB
from datetime import date
```

**bond basic info (25国债22)**

```
maturity = date(2035, 11, 15)
coupon = 0.0178
freq = 2
```

**instantiation**

```
b = FRB(maturity, coupon, freq)
```

**market info**

```
settle = date(2025, 12, 31)
mkt = 'szse'
prc = 99.947
```

**attributes**

```
b.couponrate
b.maturitydate
b.frequency
```

**years residual**

```
b.yearsresidual(settle)
```

**number of coupon payments**

```
b.coupnum(settle)
```

**previous coupon payment date**

```
b.couppcd(settle)
```

**next coupon payment date**

```
b.coupncd(settle)
```

**accrued interests**

```
b.accrint(settle)
```

**intrinsic value or theoretical clean price** (yld = 0.03)

```
yld = 0.03
b.price(settle, yld, dcc = 'szse')
```

**yield to maturity** (price = prc)

```
y = b.ytm(settle, prc, dcc = 'szse')
```

**duration** (yld = y)

```
b.duration(settle, y)
```

**convexity** (yld = y)

```
b.convexity(settle, y)
```
