0
$\begingroup$

I'm trying to write a program that would help me make wiser decisions for stock trading.

I've built my logic, which is made of two sub-logics. The first is a general logic - Targeting the stock data (mostly pattern analysis). The second is personal behavior logic - Targeting the personal playing behavior (how risky to be and such).

Together, those logics are dependent on ~15 parameters defining the trading behavior. (e.g. number of symbols to hold in the portfolio, percentage of cash to use, share prices smoothing parameters, etc.)

I've built historical simulator to test the logic against historical stock market data. The simulator generates:

  1. Random starting date
  2. Random run period
  3. N different random players

Each of the N players is a essentially a collection of the parameters, where each is being assigned a random value (within, of course, legal values boundaries).

Then I let the simulator run, and at the end of the run I save all the data into a database. I let it run many times, generating many different players at each run. Each entry is made of something like (start_date, end_date, general_params, personal_params, initial_value, final_value)

My goal is to find a collection of parameters (both general and personal), that would maximize the final_value, regardless of the start_date and the length of the run.

I've tried in a previous iteration of the project some naive approach of finding maximum by running many times, identifying the configurations which, in general, out performed the others, and then attempted to hold all the parameters except a single one. modify that one a little (+-0.1% each time) and see if I get a better outcome. After finding local maximum, moving to the next param and so on. It was a very time consuming process (it takes approx 30 seconds / player / history day) and it didn't bring me anywhere. The final player did ok but very often, other randomly generated players did much better.

I've done some research into SGD, optimization problems, linear models and generative models, but honestly, I consider myself to be quite newbie in this field and would appreciate your educated thoughts on the matter.

How would you recommend me to transform the data collected in my DB to a set of parameters which is optimized for the problem?

Thanks in advance.

$\endgroup$
1
$\begingroup$

It sounds like you're trying to accomplish an optimization task using a grid search method. As you see, this is computationally expensive. Also, as you're doing it, trade-offs between parameters isn't accounted for.

You should be using a minimization routine. A list of all possibilities would be cumbersome, but for some background look into simplex, nelder-mead, and genetic algorithms to get grounded. These algorithms have ways to automatically vary all of your parameters to (hopefully) identify a global minimum. The trick will be defining your objective function that outputs some measure of performance for a given parameter set. The algorithms then try to make that number small.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ My intention is to avoid the process of make a change => run and see if better or worse => go in that direction or the other. I wish to use the already generated data that exists in the DB in order to "extract" meaning from the configurations. It seems like your suggested methods require additional runs of the simulator. Am I correct or can those methods be applied on "static" existing data? $\endgroup$ – Hemulin May 17 '17 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.