# Optimization algorithms - use cases in finance

#### Quasar Chunawala

Hi all,

I have been programming some optimization algorithms during my spare time [link to the git repo] - just the basics such as GD, CGD, DIRECT, simulated annealing. I thought of creating my own little Julia package out of it - inspired by Optim.jl. What areas of finance is mathematical programming used?

If possible, I'd like to implement a small homegrown toy project.

Thanks,
Quasar.

#### Daniel Duffy

##### C++ author, trainer
Hi all,

I have been programming some optimization algorithms during my spare time [link to the git repo] - just the basics such as GD, CGD, DIRECT, simulated annealing. I thought of creating my own little Julia package out of it - inspired by Optim.jl. What areas of finance is mathematical programming used?

If possible, I'd like to implement a small homegrown toy project.

Thanks,
Quasar.
That's 3 questions

1. optimisation
2. Julia
3. Finance

Learn all 3 at once??

I would focus on least squares in C/C++. Then goto next level.

#### Quasar Chunawala

That's 3 questions

1. optimisation
2. Julia
3. Finance

Learn all 3 at once??

I would focus on least squares in C/C++. Then goto next level.

Hi Daniel,

My maxim : "stay hungry, stay foolish". But, I completely submit, that being structured, trying to learn a thing at a time will help.

I started writing code in Julia, as I felt, it's well suited to the problem domain of OR/optimization, perhaps it's the closest to human readable pseudo-code/algorithms. Super-excited to try and code solvers & implement the formulae from the books(my main reference is (i) Chong & Zak (ii) Nocedal), unit test on test functions.

#### Quasar Chunawala

Portfolio selection is where I've seen QP used. LP is used in defeasing municipal issuances.
Thanks so much Ken.

#### Daniel Duffy

##### C++ author, trainer
Do you mean Nocedal and Wright? mathematically advanced and too theoretical for the current project. It is black belt stuff.

Bronson "Operations Research" (Schaum) is super!

I use Nocedal _And_ Nocedal at different times for different reasons.
Python has all that stuff. You could use it on the same problems as Julia
Julia is probably OK but it is a quiche language IMHO, just like Rust etc.

Anyways, "different strokes for different folks", no one size fits all

Last edited:

#### Ken Abbott

##### Managing Director
Thanks so much Ken.
I believe LP is also used in the leasing business, but I have no direct experience with that.

Last edited:

#### Ken Abbott

##### Managing Director
Thanks so much Ken.

#### Attachments

• Elementary Portfolio Optimization.pdf
225.9 KB · Views: 15

#### Quasar Chunawala

Do you mean Nocedal and Wright? mathematically advanced and too theoretical for the current project. It is black belt stuff.

Bronson "Operations Research" (Schaum) is super!

Yeah, Nocedal and Wright, only, referring to teeny weeny bits of it though, would be an overkill otherwise.

Last edited:

#### Daniel Duffy

##### C++ author, trainer
Another scenario is solving the Portfolio optimisation problem by using the existing libraries in Julia. Of course, it is possible to write your own code but why bother unless you want to become a numerical analyst?

#### Quasar Chunawala

Another scenario is solving the Portfolio optimisation problem by using the existing libraries in Julia. Of course, it is possible to write your own code but why bother unless you want to become a numerical analyst?
Solving the portfolio optimization problem is the number one scenario for me. Daniel, to begin with, I won't feel full, if I don't write a naive implementation of the meat of the algorithm. After a point of course, I'll just start using some QP solvers.

I am also keen to write some automatic differentiation code.

I'll post my stuff in this thread, it'll be good to get some feedback from folks out here.

#### Daniel Duffy

##### C++ author, trainer
The nice thing about Bronson is that it's got good examples that can be done with pencil and paper. Once that is done means the step to coding is easy and better than trial-and-error programming.

#### Ken Abbott

##### Managing Director
Solving the portfolio optimization problem is the number one scenario for me. Daniel, to begin with, I won't feel full, if I don't write a naive implementation of the meat of the algorithm. After a point of course, I'll just start using some QP solvers.

I am also keen to write some automatic differentiation code.

I'll post my stuff in this thread, it'll be good to get some feedback from folks out here.
This was my view. My experience with this was in the 1980s, so I did it using the linear algebra functions in Lotus 123, which for those under 50, is kind of like Latin compared with modern Italian. Getting my hands dirty with the actual calculus was very helpful.

#### Daniel Duffy

##### C++ author, trainer
Anyone out there used Visicalc on Apple II

It represented a revolution in personal computing. It was popular with e.g. cost engineers.

"VisiCalc isn't as easy to use as prepackaged home accounting programs, because you're required to design both the layout and the formulas used by the program. Because it is not pre-packaged, however, it's infinitely more powerful and flexible than such programs. You can use VisiCalc to balance your checkbook, keep track of credit card purchases, calculate your net worth, do your taxes—the possibilities are practically limitless."

Last edited:

#### Daniel Duffy

##### C++ author, trainer
This was my view. My experience with this was in the 1980s, so I did it using the linear algebra functions in Lotus 123, which for those under 50, is kind of like Latin compared with modern Italian. Getting my hands dirty with the actual calculus was very helpful.
Indeed. In many cases the best way to understand a model is to work out all the steps by hand in simplest case with pencil and paper, e.g. 2X2 case. Then automate the process.

Replies
0
Views
328
Replies
3
Views
7K
Replies
6
Views
2K
Replies
8
Views
2K
Replies
10
Views
2K