This commit is contained in:
sofusmortensen 2016-06-13 23:05:32 +02:00
parent b2382e5a7f
commit 0115df6e9a
3 changed files with 18 additions and 4 deletions

View File

@ -58,6 +58,18 @@ The ``Action`` combinator removes the need for an integral scheduler. The respon
## Examples ## Examples
### Zero coupon bond
Example of a zero coupon bond:
```
val zero_coupon_bond =
(roadRunner or wileECoyote).may {
"execute".givenThat(after("01/09/2017")) {
wileECoyote.gives(roadRunner, 100.K*GBP)
}
}
```
### CDS contract ### CDS contract
Simple example of a credit default swap written by 'Wile E Coyote' paying 1,000,000 USD to beneficiary 'Road Runner' in the event of a default of 'ACME Corporation'. Simple example of a credit default swap written by 'Wile E Coyote' paying 1,000,000 USD to beneficiary 'Road Runner' in the event of a default of 'ACME Corporation'.
@ -78,13 +90,12 @@ exercised).
Note that it is always the task of the beneficiary of an event to trigger the event. This way a scheduler is not needed as a core component of Corda (but may be a convenient addition on top of Corda). Note that it is always the task of the beneficiary of an event to trigger the event. This way a scheduler is not needed as a core component of Corda (but may be a convenient addition on top of Corda).
### FX call option ### FX call option
Example of a european FX vanilla call option: Example of a european FX vanilla call option:
``` ```
val my_fx_option = val my_fx_option =
(roadRunner).may { roadRunner.may {
"exercise".anytime { "exercise".anytime {
(roadRunner or wileECoyote).may { (roadRunner or wileECoyote).may {
"execute".givenThat(after("2017-09-01")) { "execute".givenThat(after("2017-09-01")) {
@ -106,7 +117,7 @@ There are two actors. The contract holder _exercise_ at anytime, resulting in th
- Date shift, date rolling, according to holiday calendar - Date shift, date rolling, according to holiday calendar
- Underlying conventions for contracts - Underlying conventions for contracts (important to avoid cluttering)
- For convenience - automatic roll out of date sequences - For convenience - automatic roll out of date sequences

View File

@ -30,6 +30,10 @@ class ContractBuilder {
contracts.add( Transfer(amount, this, beneficiary)) contracts.add( Transfer(amount, this, beneficiary))
} }
fun Party.gives(beneficiary: Party, amount: Observable<Long>, currency: Currency) {
contracts.add( Transfer(amount, currency, this, beneficiary))
}
fun final() = fun final() =
when (contracts.size) { when (contracts.size) {
0 -> zero 0 -> zero

View File

@ -21,7 +21,6 @@ val acmeCorporationHasDefaulted = DummyObservable<Boolean>()
// example: // example:
val euribor3M = DummyObservable<BigDecimal>() val euribor3M = DummyObservable<BigDecimal>()
// Test parties // Test parties
val roadRunner = Party("Road Runner", generateKeyPair().public) val roadRunner = Party("Road Runner", generateKeyPair().public)
val wileECoyote = Party("Wile E. Coyote", generateKeyPair().public) val wileECoyote = Party("Wile E. Coyote", generateKeyPair().public)