pandas too slow for event driven backtesting

Discussion in 'App Development' started by Marshall, Feb 10, 2022.

  1. d08

    d08

    Development speed and massive choice in modules. There's a module for everything I can think of. Pandas and numpy only use python as a frontend, backend is C/C++.
     
    #11     Feb 11, 2022
    guest_trader_1 likes this.
  2. 2rosy

    2rosy

    if you're using pandas or numpy remove the word for from your code.
     
    #12     Feb 11, 2022
    d08 likes this.
  3. Development speed applies if you are a Python dev and know the language, because you are used to those modules and know where they are. If you have to learn the language from scratch that development speed does not apply.
    I agree that is an useful language for many things, specially for data science. But for trading it is just a blocker, I've seen some many posts from people trying to improve their code performance, and so many replies are of the form of: "you can't do that with Python" "for that use c++". Why don't they use c++ in the first place? There are plenty of libraries available for anything they want to do. Back in the day it was a pain to setup anything in c++, and I think this is the reason why people think the language is difficult, but nowadays with modern IDES it is all done for you. It is way easier to develop and debug code.
     
    #13     Feb 11, 2022
  4. d08

    d08

    You don't need to build a huge pandas df for this. Use what you're operating on. Likely a GUI is preferable in the long-run. Build the df out of instruments you need, it doesn't need to be multiindex either for this.
     
    #14     Feb 11, 2022
  5. d08

    d08

    For most trading Python is plenty fast. Does C++ really have such an universe of modules? From what I know Python has the widest selection. Anything I can imagine, there's already a module that does it better - massive time savings.
    For example the basics, having market calendars for most stock / futures markets? Does it exist in C++?
     
    #15     Feb 11, 2022
  6. I would be surprised if there isn't someone that has implemented a library already for that. That's not really part of the language, what you are describing is a module that someone has implemented as a helper. If you were used to the c++ community you would find that module as easy as you do with Python.
    For dates availability I normally use the endpoints provided by brokers. I just need to get the market details and I will know when it is available. I don't see a big deal here.
     
    #16     Feb 11, 2022
  7. 2rosy

    2rosy

    apples and oranges. The OP is about back testing not trading
     
    #17     Feb 11, 2022
  8. ph1l

    ph1l

    Yes.
    https://rkapl123.github.io/QLAnnotatedSource/da/d3e/class_quant_lib_1_1_calendar.html
    However, speaking as a long-time C++ programmer, python is probably a better choice for most people because it's very easy to mess things up with poorly-written C++ code.
     
    #18     Feb 11, 2022
    d08 likes this.
  9. Backtesting is part of trading. Everyone knows that.
     
    #19     Feb 11, 2022
  10. 2rosy

    2rosy

    Disagree. One is research. The other implementation.
     
    #20     Feb 12, 2022