-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels