Problem
Currently, the Time In Force (TIF) parameter in Limit and ClientLimit structs is represented as a String. This approach is error-prone as it allows for invalid TIF values to be passed at compile time, leading to runtime errors or unexpected behavior. It also requires manual string management and lacks the type safety that Rust's enum system provides.
Solution
Refactor the tif: String field into a tif: Tif field, where Tif is a new enum. The Tif enum should include the supported Time In Force values, such as Gtc (Good 'Til Cancelled) and Ioc (Immediate Or Cancel).
Proposed enum:
#[derive(Deserialize, Serialize, Clone, Debug)]
#[serde(rename_all = "PascalCase")]
pub enum Tif {
Gtc,
Ioc,
// Add other TIF types as needed
}
This change will improve type safety, code readability, and maintainability.
Happy to submit PR if this makes sense
Problem
Currently, the Time In Force (TIF) parameter in
LimitandClientLimitstructs is represented as aString. This approach is error-prone as it allows for invalid TIF values to be passed at compile time, leading to runtime errors or unexpected behavior. It also requires manual string management and lacks the type safety that Rust's enum system provides.Solution
Refactor the
tif: Stringfield into atif: Tiffield, whereTifis a new enum. TheTifenum should include the supported Time In Force values, such asGtc(Good 'Til Cancelled) andIoc(Immediate Or Cancel).Proposed enum:
This change will improve type safety, code readability, and maintainability.
Happy to submit PR if this makes sense