Skip to content

ohmycloud/rust-design-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns in Rust

https://siddharthqs.com/design-patterns-in-rust

Strategy pattern Class Diagram

+-----------------------------------------------------------------+
| <<interface>>                                                   |
| ExecutionStrategy                                               |
|-----------------------------------------------------------------|
| + execute_order(...)                                            |
+-----------------------------------------------------------------+

     /|\                  /|\                   /|\
      |                    |                     |
      |                    |                     |
+---------------+     +--------------+       +--------------+
| TwapStrategy  |     | VwapStrategy |       | PovStrategy  |
|---------------|     |--------------|       |--------------|
|               |     |              |       | - participation_rate: f64 |
|---------------|     |--------------|       |--------------|
| + execute_order(...)|+ execute_order(...)  |+ execute_order(...)|
+---------------+     +--------------+       +--------------+

+-----------------------------+
| OrderExecutor               |
|-----------------------------|
| - strategy: ExecutionStrategy |
|-----------------------------|
| + new(strategy)             |
| + set_strategy(strategy)    |
| + execute(order_id, quantity) |
+-----------------------------+

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages