Parse
QuantConnect.Parse
Bases: Object
Provides methods for parsing strings using CultureInfo.InvariantCulture
date_time_exact
date_time_exact(value: str, format: str) -> datetime
date_time_exact(
value: str,
format: str,
date_time_styles: DateTimeStyles,
) -> datetime
Signature descriptions:
-
Parses the provided value as a System.DateTime using System.DateTime.ParseExact(string,string,IFormatProvider) with the specified format and CultureInfo.InvariantCulture
-
Parses the provided value as a System.DateTime using System.DateTime.ParseExact(string,string,IFormatProvider) with the specified format, date_time_styles and CultureInfo.InvariantCulture
decimal
decimal(value: str) -> float
decimal(value: str, number_styles: NumberStyles) -> float
Signature descriptions:
-
Parses the provided value as a decimal using CultureInfo.InvariantCulture
-
Parses the provided value as a decimal using the specified number_styles and CultureInfo.InvariantCulture
long
Signature descriptions:
-
Parses the provided value as a long using CultureInfo.InvariantCulture
-
Parses the provided value as a long using CultureInfo.InvariantCulture and the specified number_styles
try_parse
try_parse(
input: str, value: Optional[timedelta]
) -> Tuple[bool, timedelta]
try_parse(
input: str,
date_time_style: DateTimeStyles,
value: Optional[Union[datetime, date]],
) -> Tuple[bool, Union[datetime, date]]
try_parse(
input: str,
number_style: NumberStyles,
value: Optional[float],
) -> Tuple[bool, float]
Signature descriptions:
-
Tries to parse the provided value with TryParse as a System.TimeSpan using CultureInfo.InvariantCulture.
-
Tries to parse the provided value with TryParse as a System.DateTime using the specified date_time_style and CultureInfo.InvariantCulture.
-
Tries to parse the provided value with TryParse as a double using the specified number_style and CultureInfo.InvariantCulture.
-
Tries to parse the provided value with TryParse as a int using the specified number_style and CultureInfo.InvariantCulture.
try_parse_exact
try_parse_exact(
input: str,
format: str,
time_span_style: TimeSpanStyles,
value: Optional[timedelta],
) -> Tuple[bool, timedelta]
try_parse_exact(
input: str,
format: str,
date_time_style: DateTimeStyles,
value: Optional[Union[datetime, date]],
) -> Tuple[bool, Union[datetime, date]]
Signature descriptions:
-
Tries to parse the provided value with TryParse as a System.TimeSpan, format string, TimeSpanStyles, and using CultureInfo.InvariantCulture
-
Tries to parse the provided value with TryParse as a System.DateTime using the specified date_time_style, the format format, and CultureInfo.InvariantCulture.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
str
|
|
required |
format
|
str
|
|
required |
time_span_style
|
Optional[TimeSpanStyles]
|
|
None
|
value
|
Optional[timedelta] | Optional[Union[datetime, date]]
|
|
required |
date_time
date_time(value: str) -> datetime
Parses the provided value as a System.DateTime using System.DateTime.Parse(string,IFormatProvider) with CultureInfo.InvariantCulture
double
double(value: str) -> float
Parses the provided value as a double using CultureInfo.InvariantCulture
time_span
time_span(value: str) -> timedelta
Parses the provided value as a System.TimeSpan using System.TimeSpan.Parse(string,IFormatProvider) with CultureInfo.InvariantCulture