Interactive input strategy



  • Hello there,
    I have just started to learn bt which is awesome.
    I was just reading the documentation and examples, however I cannot find anything relating to using input to control a strategy.
    What I usually do when I deploy a trading bot is to monitor it and if something is going to be wrong make a few adjustments via keyboard commands in real time.
    Is this possible with bt?

    Cheers.


  • administrators

    No such thing is implemented. That's a huge use case. For starters some quick questions:

    • Which commands?
    • You are resampling live data to 15 seconds and you spend 31 seconds in the interactive mode, should the strategy skip the 2 15-seconds bars from the resampler? See them later and what happens if any of them generates a signal for trading?

    A possible approach:

    • Create a thread during the initialization of your strategy and use a method of the strategy as the target
    • This method, now running in parallel (as much as allowed by the GIL) can implement keyboard processing

Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.