Skip to main content

MaxTask

Returns the maximum value of all the results returned by the provided subtasks and subjobs. Nested tasks or jobs must return a Number.

Input: None

Returns: A numerical result.

Example: Returns the maximum numerical result from 3 tasks.

{
"maxTask": {
"tasks": [
{
"valueTask": {
"value": 10
}
},
{
"valueTask": {
"value": 20
}
},
{
"valueTask": {
"value": 30
}
}
]
}
}

Example: Returns the maximum numerical result from 3 jobs.

{
"maxTask": {
"jobs": [
{
"tasks": [
{
"httpTask": {
"url": "https://www.binance.com/api/v3/ticker/price?symbol=SOLUSDT"
}
},
{
"jsonParseTask": {
"path": "$.price"
}
}
]
},
{
"tasks": [
{
"httpTask": {
"url": "https://www.binance.us/api/v3/ticker/price?symbol=SOLUSD"
}
},
{
"jsonParseTask": {
"path": "$.price"
}
}
]
},
{
"tasks": [
{
"httpTask": {
"url": "https://api-pub.bitfinex.com/v2/tickers?symbols=tSOLUSD"
}
},
{
"jsonParseTask": {
"path": "$[0][7]"
}
}
]
}
]
}
}

See the MaxTask typescript definition in @switchboard-xyz/common

Fields

NameTypeDescription
 tasks

A list of subtasks to process and produce a list of result values.

 jobs

A list of subjobs to process and produce a list of result values.