Lean  $LEAN_TAG$
QuantConnect.Util.StringDecimalJsonConverter Class Reference

Allows for conversion of string numeric values from JSON to the decimal type More...

Inheritance diagram for QuantConnect.Util.StringDecimalJsonConverter:
[legend]

Public Member Functions

 StringDecimalJsonConverter (bool defaultOnFailure=false)
 Creates an instance of the class, with an optional flag to default to decimal's default value on failure. More...
 
- Public Member Functions inherited from QuantConnect.Util.TypeChangeJsonConverter< decimal, string >
override object ReadJson (JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 Reads the JSON representation of the object. More...
 
override void WriteJson (JsonWriter writer, object value, JsonSerializer serializer)
 Writes the JSON representation of the object. More...
 
override bool CanConvert (Type objectType)
 Determines whether this instance can convert the specified object type. More...
 

Protected Member Functions

override string Convert (decimal value)
 Converts a decimal to a string More...
 
override decimal Convert (string value)
 Converts the input string to a decimal More...
 
- Protected Member Functions inherited from QuantConnect.Util.TypeChangeJsonConverter< decimal, string >
virtual T Create (Type type, JToken token)
 Creates an instance of the un-projected type to be deserialized More...
 
abstract TResult Convert (T value)
 Convert the input value to a value to be serialized More...
 
abstract T Convert (TResult value)
 Converts the input value to be deserialized More...
 

Additional Inherited Members

- Protected Attributes inherited from QuantConnect.Util.TypeChangeJsonConverter< decimal, string >
virtual bool PopulateProperties
 True will populate TResult object returned by Convert(TResult) with json properties More...
 

Detailed Description

Allows for conversion of string numeric values from JSON to the decimal type

Definition at line 25 of file StringDecimalJsonConverter.cs.

Constructor & Destructor Documentation

◆ StringDecimalJsonConverter()

QuantConnect.Util.StringDecimalJsonConverter.StringDecimalJsonConverter ( bool  defaultOnFailure = false)

Creates an instance of the class, with an optional flag to default to decimal's default value on failure.

Parameters
defaultOnFailureDefault to decimal's default value on failure

Definition at line 33 of file StringDecimalJsonConverter.cs.

Member Function Documentation

◆ Convert() [1/2]

override string QuantConnect.Util.StringDecimalJsonConverter.Convert ( decimal  value)
protected

Converts a decimal to a string

Parameters
valueThe input value to be converted before serialization
Returns
String representation of the decimal

Definition at line 43 of file StringDecimalJsonConverter.cs.

◆ Convert() [2/2]

override decimal QuantConnect.Util.StringDecimalJsonConverter.Convert ( string  value)
protected

Converts the input string to a decimal

Parameters
valueThe deserialized value that needs to be converted to T
Returns
The converted value

Definition at line 53 of file StringDecimalJsonConverter.cs.


The documentation for this class was generated from the following file: