DoubleUnixSecondsDateTimeJsonConverter
QuantConnect.Util.DoubleUnixSecondsDateTimeJsonConverter
Bases: TypeChangeJsonConverter[Optional[datetime], Optional[float]]
Defines a JsonConverter that serializes DateTime use the number of whole and fractional seconds since unix epoch
populate_properties
populate_properties: bool
True will populate TResult object returned by convert(TResult) with json properties
This codeEntityType is protected.
convert
convert(value: Optional[datetime]) -> Optional[float]
convert(value: Optional[float]) -> Optional[datetime]
Signature descriptions:
-
Convert the input value to a value to be serialzied
-
Converts the input value to be deserialized
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Optional[datetime] | Optional[float]
|
The input value to be converted before serialziation |
required |
Returns:
| Type | Description |
|---|---|
Optional[float] | Optional[datetime]
|
Depends on the signature used. Case 1: [A new instance of TResult that is to be serialzied.]; Case 2: [The converted value.] |
can_convert
can_convert(object_type: Type) -> bool
Determines whether this instance can convert the specified object type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_type
|
Type
|
Type of the object. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
true if this instance can convert the specified object type; otherwise, false. |
create
create(
type: Type, token: Any
) -> QuantConnect_Util_TypeChangeJsonConverter_T
Creates an instance of the un-projected type to be deserialized
This codeEntityType is protected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
Type
|
The input object type, this is the data held in the token |
required |
token
|
Any
|
The input data to be converted into a T |
required |
Returns:
| Type | Description |
|---|---|
QuantConnect_Util_TypeChangeJsonConverter_T
|
A new instance of T that is to be serialized using default rules. |
read_json
read_json(
reader: Any,
object_type: Type,
existing_value: Any,
serializer: Any,
) -> Object
Reads the JSON representation of the object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reader
|
Any
|
The Newtonsoft.Json.JsonReader to read from. |
required |
object_type
|
Type
|
Type of the object. |
required |
existing_value
|
Any
|
The existing value of object being read. |
required |
serializer
|
Any
|
The calling serializer. |
required |
Returns:
| Type | Description |
|---|---|
Object
|
The object value. |
write_json
write_json(
writer: Any, value: Any, serializer: Any
) -> None
Writes the JSON representation of the object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
writer
|
Any
|
The Newtonsoft.Json.JsonWriter to write to. |
required |
value
|
Any
|
The value. |
required |
serializer
|
Any
|
The calling serializer. |
required |