Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Multiple Systems #36

Open
sykesdev opened this issue Jun 12, 2020 · 1 comment
Open

Support Multiple Systems #36

sykesdev opened this issue Jun 12, 2020 · 1 comment

Comments

@sykesdev
Copy link

sykesdev commented Jun 12, 2020

This change allows the ability to add multiple systems to the market.yml

The modified yaml would look like...

system:
  closer_scaled:
    holdperiod : 0
    longentry  : hc
    longexit   :
    shortentry : lc
    shortexit  :
    scale      : True
  closer_unscaled:
    holdperiod : 0
    longentry  : hc
    longexit   :
    shortentry : lc
    shortexit  :
    scale      : False
@@ -298,26 +299,27 @@ def market_pipeline(model, market_specs):
     system_specs = market_specs['system']
     if system_specs:
         # get the system specs
-        system_name = system_specs['name']
-        longentry = system_specs['longentry']
-        shortentry = system_specs['shortentry']
-        longexit = system_specs['longexit']
-        shortexit = system_specs['shortexit']
-        holdperiod = system_specs['holdperiod']
-        scale = system_specs['scale']
-        logger.info("Running System %s", system_name)
-        logger.info("Long Entry  : %s", longentry)
-        logger.info("Short Entry : %s", shortentry)
-        logger.info("Long Exit   : %s", longexit)
-        logger.info("Short Exit  : %s", shortexit)
-        logger.info("Hold Period : %d", holdperiod)
-        logger.info("Scale       : %r", scale)
-        # create and run the system
-        system = System(system_name, longentry, shortentry,
-                        longexit, shortexit, holdperiod, scale)
-        tfs = run_system(model, system, group, intraday)
-        # generate a portfolio
-        gen_portfolio(model, system_name, group, tfs)
+        for system_name in system_specs:
+            longentry = system_specs[system_name]['longentry']
+            shortentry = system_specs[system_name]['shortentry']
+            longexit = system_specs[system_name]['longexit']
+            shortexit = system_specs[system_name]['shortexit']
+            holdperiod = system_specs[system_name]['holdperiod']
+            scale = system_specs[system_name]['scale']
+            logger.info("Running System %s", system_name)
+            logger.info("Long Entry  : %s", longentry)
+            logger.info("Short Entry : %s", shortentry)
+            logger.info("Long Exit   : %s", longexit)
+            logger.info("Short Exit  : %s", shortexit)
+            logger.info("Hold Period : %d", holdperiod)
+            logger.info("Scale       : %r", scale)
+            # create and run the system
+            system = System(system_name, longentry, shortentry,
+                            longexit, shortexit, holdperiod, scale)
+            tfs = run_system(model, system, group, intraday)
+            # generate a portfolio
+            gen_portfolio(model, system_name, group, tfs)
 
     # Return the completed model
     return model
@mrconway
Copy link
Collaborator

Great suggestion, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants