Controlling multiple portfolios

Discussion in 'Automated Trading' started by dima777, Nov 23, 2019.

  1. dima777



    Wanted to ask how this can be done. An analytical model generates 5 trade ideas each hour. These trade ideas need to be placed immediately at market and tracked as a separate portfolio. Such 5-trade portfolio will be opened each hour (on average 21 each day). Each portfolio will be closed at the loss of 50 points. Or when the holding period reaches 20 hours. I wonder how this can be done?! Can this be done in Python (if yes which libraries you recommend) or it will be easier to do this in VBA?

    Any suggestions are highly welcome

  2. 2rosy


    same exact way you would do it with one portfolio. However, you would want to create an "internalizer" so if portfoio A wants to buy XYZ and portfolio B wants to sell XYZ they just swap
    Baron and TooEffingOld like this.
  3. dima777


    each portfolio will need to be held for 20 hours and they are opened at differnt times/opprices...there wil be 28 instruemnts to select from...soemtime porfolios will overlap,,,,how do you think thsi can be automated? maybe there is a python libabry for this?
  4. fan27


    There is no library that can specifically do need to write custom code. What you described could easily be done with a multi-symbol strategy in AlgoTerminal...of course other solutions could accomplish this as well.
    squarepants46 likes this.
  5. MGB


    QuantConnect has Scheduled Events. At each hour ("scheduled event")...
    1) Close a position that has a 50 point loss.
    2) Close a position that was held for 20 hours.
    3) Open up to 5 new positions ("An analytical model generates 5 trade ideas each hour.").

    QuantConnect maintains an array of positions that are opened. Cycle through each one to determine if a position needs to be closed (e.g. 50 point loss, 20 hours, etc.).
  6. ionone


    do it in MT5. you can backtest multipairs also

    and free data