Example:
-```javascript
+:::: tabs
+
+::: tab DSL
+
+```java
var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant(), now.plusHours(12).toInstant(), Duration.ofMinutes(90))
```
+:::
+
+::::
+
#### `calculateCheapestPeriod` from Duration and Power
| Parameter | Type | Description |
Example:
-```javascript
+:::: tabs
+
+::: tab DSL
+
+```java
var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant(), now.plusHours(12).toInstant(), Duration.ofMinutes(90), 250 | W)
```
+:::
+
+::::
+
#### `calculateCheapestPeriod` from Power Phases
| Parameter | Type | Description |
Example:
-```javascript
+:::: tabs
+
+::: tab DSL
+
+```java
val ArrayList<Duration> durationPhases = new ArrayList<Duration>()
durationPhases.add(Duration.ofMinutes(37))
durationPhases.add(Duration.ofMinutes(8))
var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant(), now.plusHours(12).toInstant(), durationPhases, powerPhases)
```
+:::
+
+::::
+
Please note that the total duration will be calculated automatically as a sum of provided duration phases.
Therefore, if the total duration is longer than the sum of phase durations, the remaining duration must be provided as last item with a corresponding 0 W power item.
This is to ensure that the full program will finish before the provided `latestEnd`.
Example:
-```javascript
+:::: tabs
+
+::: tab DSL
+
+```java
val ArrayList<Duration> durationPhases = new ArrayList<Duration>()
durationPhases.add(Duration.ofMinutes(37))
durationPhases.add(Duration.ofMinutes(8))
var Map<String, Object> result = actions.calculateCheapestPeriod(now.toInstant(), now.plusHours(12).toInstant(), Duration.ofMinutes(236), phases, 0.1 | kWh)
```
+:::
+
+::::
+
### `calculatePrice`
| Parameter | Type | Description |
Example:
-```javascript
+:::: tabs
+
+::: tab DSL
+
+```java
var price = actions.calculatePrice(now.toInstant(), now.plusHours(4).toInstant, 200 | W)
```
+:::
+
+::::
+
### `getPrices`
| Parameter | Type | Description |
Example:
-```javascript
+:::: tabs
+
+::: tab DSL
+
+```java
var priceMap = actions.getPrices("SpotPrice,GridTariff")
```
+:::
+
+::::
+
## Full Example
### Thing Configuration