-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90839a3
commit 4e18a23
Showing
5 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/abacus/optimizer/optimization_models/sp_maximize_gain.mod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
problem spMaximizeGain; | ||
|
||
set assets; | ||
|
||
param dt > 0; | ||
param risk_free_rate; | ||
param inital_cash > 0; | ||
param number_of_scenarios > 0 integer; | ||
param number_of_assets > 0 integer; | ||
param inital_holdings {assets}; | ||
param inital_prices {assets}; | ||
param prices {1..number_of_scenarios, assets}; | ||
|
||
var x_buy {assets}; | ||
var x_sell {assets}; | ||
|
||
maximize Objective: | ||
sum{i in 1..number_of_scenarios} 1/number_of_scenarios * ((inital_cash + sum{j in assets} (inital_prices[j] * (x_sell[j] - x_buy[j]))) * exp(risk_free_rate * dt) + sum{j in assets} (prices[i, j] * (inital_holdings[j] + x_buy[j] - x_sell[j]))); | ||
|
||
|
||
subject to SHORTING_CONSTRAINT {j in assets}: | ||
inital_holdings[j] + x_buy[j] - x_sell[j] >= 0 | ||
; | ||
|
||
subject to LEVERAGE_CONSTRAINT: | ||
inital_cash + sum{j in assets} ( (x_sell[j] - x_buy[j]) * inital_prices[j]) >= 0 | ||
; | ||
|
||
subject to FEASIBLE_CONSTRAINT_BUY {j in assets}: | ||
x_buy[j] >= 0 | ||
; | ||
|
||
subject to FEASIBLE_CONSTRAINT_SELL {j in assets}: | ||
x_sell[j] >= 0 | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters