Skip to main content

MedianTask

Returns the median (middle) of all the results returned by the provided subtasks and subjobs. Nested tasks must return a Number.

Input: None

Returns: A numerical result.

Example: Returns the median numerical result of 3 tasks.

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

Example: Returns the median numerical result of 3 jobs.

{
"medianTask": {
"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]"
}
}
]
}
]
}
}


Fields

NameTypeDescription
 jobs

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

 maxRangePercent

string

The maximum range between the minimum and maximum values before a successful median can be yielded.

 minSuccessfulRequired

int32

The minimum number of values before a successful median can be yielded.

 tasks

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