credmark.cmf.types.compose.MapBlockTimeSeriesOutput

DTO class MapBlockTimeSeriesOutput(*, results=[], endTimestamp, interval, exclusive)[source]

Bases: MapBlocksOutput, Generic[DTOCLS]

Output for the compose.map-block-time-series model.

Show JSON schema
{
   "title": "MapBlockTimeSeriesOutput",
   "description": "Output for the compose.map-block-time-series model.",
   "type": "object",
   "properties": {
      "results": {
         "title": "Results",
         "description": "List of results of block model run outputs",
         "default": [],
         "type": "array",
         "items": {
            "$ref": "#/definitions/MapBlockResult"
         }
      },
      "endTimestamp": {
         "title": "Endtimestamp",
         "description": "End timestamp of block series, inclusive unless exclusive is True.",
         "type": "integer"
      },
      "interval": {
         "title": "Interval",
         "description": "Interval in seconds of the sample timestamp.",
         "type": "integer"
      },
      "exclusive": {
         "title": "Exclusive",
         "description": "If true, blocks are exclusive of end timestamp.",
         "type": "boolean"
      }
   },
   "required": [
      "endTimestamp",
      "interval",
      "exclusive"
   ],
   "definitions": {
      "ModelCallStackEntry": {
         "title": "ModelCallStackEntry",
         "description": "An item in an error's call stack.",
         "type": "object",
         "properties": {
            "slug": {
               "title": "Slug",
               "description": "Model slug",
               "type": "string"
            },
            "version": {
               "title": "Version",
               "description": "Model version",
               "type": "string"
            },
            "chainId": {
               "title": "Chainid",
               "description": "Context chain id",
               "type": "integer"
            },
            "blockNumber": {
               "title": "Blocknumber",
               "description": "Context block number",
               "type": "integer"
            },
            "input": {
               "title": "Input",
               "description": "Context input"
            },
            "trace": {
               "title": "Trace",
               "description": "Trace of code that generated the error",
               "type": "string"
            }
         },
         "required": [
            "slug",
            "version"
         ]
      },
      "ModelErrorDTO": {
         "title": "ModelErrorDTO",
         "description": "Data fields common to all error types:\nModelDataError, ModelRunError, ModelInputError etc.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "description": "Error type",
               "type": "string"
            },
            "message": {
               "title": "Message",
               "description": "Error message",
               "type": "string"
            },
            "stack": {
               "title": "Stack",
               "description": "Model call stack. Last element is the model that raised the error.",
               "default": [],
               "type": "array",
               "items": {
                  "$ref": "#/definitions/ModelCallStackEntry"
               }
            },
            "code": {
               "title": "Code",
               "description": "Short identifier for the type of error",
               "default": "generic",
               "type": "string"
            },
            "detail": {
               "title": "Detail",
               "description": "Arbitrary data object related to the error."
            },
            "permanent": {
               "title": "Permanent",
               "description": "If true, the error will always give the same result for the same context.",
               "default": false,
               "type": "boolean"
            }
         },
         "required": [
            "type",
            "message"
         ]
      },
      "MapBlockResult": {
         "title": "MapBlockResult",
         "description": "A data row in a block series.\nThe generic type specifies the class to use as the output.\n\nFor example ``row = MapBlockResult[MyOutputClass](**data)``\nwhere ``row.output`` will be an instance of ``MyOutputClass``.",
         "type": "object",
         "properties": {
            "blockNumber": {
               "title": "Blocknumber",
               "description": "Block number of result.",
               "type": "integer"
            },
            "output": {
               "title": "Output",
               "description": "Model output of result. Will not be present if there is an error."
            },
            "error": {
               "title": "Error",
               "description": "Error DTO from model run. Will not be present if output exists.",
               "allOf": [
                  {
                     "$ref": "#/definitions/ModelErrorDTO"
                  }
               ]
            }
         },
         "required": [
            "blockNumber"
         ]
      }
   }
}

Fields
Parameters
Return type

None

field endTimestamp: int [Required]

End timestamp of block series, inclusive unless exclusive is True.

field exclusive: bool [Required]

If true, blocks are exclusive of end timestamp.

field interval: int [Required]

Interval in seconds of the sample timestamp.

field results: List[MapBlockResult[DTOCLS]] = []

List of results of block model run outputs

append(obj)
extend(obj)
get(block_number=None, timestamp=None)
Return type

Optional[MapBlockResult]

to_dataframe(fields=None)
Parameters

fields (List[Tuple[str, Callable]] | None) – List of field name and lambda to extract certain field from output. Leave empty to extract the entire output.

Return type

DataFrame

Extract tuples from results data

to_list(fields=None)
Parameters

fields (List[Callable] | None) – List of lambda to extract certain field from output. Leave empty to extract the entire output.

Return type

List[List]

Extract tuples from results data