From ed754de498ae1009868ba634e2f12a17b7dfdadf Mon Sep 17 00:00:00 2001 From: Griffiths Lott Date: Wed, 30 Nov 2022 19:06:54 -0500 Subject: [PATCH] Set up structure for module --- src/lib.rs | 1 + src/risk_management.rs | 1 + src/risk_management/portfolio.rs | 12 ++++++++++++ src/risk_management/position.rs | 13 +++++++++++++ src/risk_management/risk_eval.rs | 7 +++++++ src/risk_management/strategy.rs | 12 ++++++++++++ 6 files changed, 46 insertions(+) create mode 100644 src/risk_management.rs create mode 100644 src/risk_management/portfolio.rs create mode 100644 src/risk_management/position.rs create mode 100644 src/risk_management/risk_eval.rs create mode 100644 src/risk_management/strategy.rs diff --git a/src/lib.rs b/src/lib.rs index eee7e66..9306ea2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ mod data; mod order; +mod risk_management; pub type DynResult = Result>; diff --git a/src/risk_management.rs b/src/risk_management.rs new file mode 100644 index 0000000..7681016 --- /dev/null +++ b/src/risk_management.rs @@ -0,0 +1 @@ +pub mod risk_eval; diff --git a/src/risk_management/portfolio.rs b/src/risk_management/portfolio.rs new file mode 100644 index 0000000..6811aef --- /dev/null +++ b/src/risk_management/portfolio.rs @@ -0,0 +1,12 @@ +/* +Deals with things related to the portfolio. +- Details about portfolio + ~ How many strategies simaltanously? + ~ Should we account for concurrent strategies? + ~ Can we cross-trade strategies? + ~ Can we take 'emergency loans' from other strategies +- Interaction with database +- Portfolio restrictions + ~ What assets types can be traded + ~ Order size / time limits +*/ diff --git a/src/risk_management/position.rs b/src/risk_management/position.rs new file mode 100644 index 0000000..6ab77d6 --- /dev/null +++ b/src/risk_management/position.rs @@ -0,0 +1,13 @@ +/* +Define position object and how to interact with positions + - What is the position + - What are the risk characteristics + - How does it fit into the larger portfolio (purpose) +Position monitor object may also be included here + - How should we manage this position? + ~ Do we need to implement a custom trailing SL + ~ Should it close if volatility is too high? + ~ Should it close at a certain time/date + - How frequently does this need to be monitored? + +*/ \ No newline at end of file diff --git a/src/risk_management/risk_eval.rs b/src/risk_management/risk_eval.rs new file mode 100644 index 0000000..15ea7aa --- /dev/null +++ b/src/risk_management/risk_eval.rs @@ -0,0 +1,7 @@ +/* +Determine the risk characterisitcs of an asset/position +What is doomsday senario for an asset/position? +Is this correlated/counter to any of the current strategy or portfolio positions +Are we confortable taking this position? +What is the max allocation we can take in this portfolio? +*/ \ No newline at end of file diff --git a/src/risk_management/strategy.rs b/src/risk_management/strategy.rs new file mode 100644 index 0000000..771de09 --- /dev/null +++ b/src/risk_management/strategy.rs @@ -0,0 +1,12 @@ +/* +How do we bring in some strategy details from a database so that we can easily adjust +the program without need to change hard coded values or restart the application + +This should focus on strategy details that are shared amoung the vast majority of strategies, nothing too obscure +- Max position size +- Max position loss +- Max daily loss +- Max concurrent orders/positions +- Enforeced stop loss +- Min portfolio diversity / max position allocation +*/ \ No newline at end of file