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]"}}]}]}}

Implements

Constructors

  • Constructs a new MedianTask.

    Parameters

    Returns MedianTask

Properties

jobs: IOracleJob[]

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: number

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

tasks: ITask[]

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

Methods

  • Converts this MedianTask to JSON.

    Returns {
        [k: string]: any;
    }

    JSON object

    • [k: string]: any
  • Creates a new MedianTask instance using the specified properties.

    Parameters

    Returns MedianTask

    MedianTask instance

  • Decodes a MedianTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    • Optional length: number

      Message length if known beforehand

    Returns MedianTask

    MedianTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Decodes a MedianTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    Returns MedianTask

    MedianTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Encodes the specified MedianTask message. Does not implicitly verify messages.

    Parameters

    • message: IMedianTask

      MedianTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified MedianTask message, length delimited. Does not implicitly verify messages.

    Parameters

    • message: IMedianTask

      MedianTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a MedianTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: {
          [k: string]: any;
      }

      Plain object

      • [k: string]: any

    Returns MedianTask

    MedianTask

  • Gets the default type url for MedianTask

    Parameters

    • Optional typeUrlPrefix: string

      your custom typeUrlPrefix(default "type.googleapis.com")

    Returns string

    The default type url

  • Creates a plain object from a MedianTask message. Also converts values to other types if specified.

    Parameters

    • message: MedianTask

      MedianTask

    • Optional options: IConversionOptions

      Conversion options

    Returns {
        [k: string]: any;
    }

    Plain object

    • [k: string]: any
  • Verifies a MedianTask message.

    Parameters

    • message: {
          [k: string]: any;
      }

      Plain object to verify

      • [k: string]: any

    Returns string

    null if valid, otherwise the reason why it is not

Generated using TypeDoc