For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

How to disable all the writer objects except datas?



  • Hi everyone,

    Thanks again for this great library! I have (hopefully) a simple question.

    I'm trying to write the data feed to a csv but I can't figure out how turn off the other writer objects.

    The docs say indicators, observers, strategies, and datas have csv parameter that I can set to false but the only actual usage of the csv param I can find is in
    the writer itself:

    cerebro.addwriter(bt.WriterFile, csv=True, out='out.csv')
    

    When I do this, I do get the datas in a csv but I also get stuff about cerebro and the portfolio. (see below). How do I turn off the writer for all the other objects so that only the data feed is written to csv?

    Thanks!

    The extra stuff I don't want...

    ===============================================================================
    Cerebro:
      -----------------------------------------------------------------------------
      - Datas:
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        - Data0:
          - Name: EUR.USD-CASH-IDEALPRO
          - Timeframe: Days
          - Compression: 1
      -----------------------------------------------------------------------------
      - Strategies:
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        - TestStrategy:
          *************************************************************************
          - Params:
          *************************************************************************
          - Indicators:
          *************************************************************************
          - Observers:
            .......................................................................
            - Broker:
              - Lines: cash, value
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              - Params:
                - fund: None
            .......................................................................
            - BuySell:
              - Lines: buy, sell
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              - Params:
                - barplot: True
                - bardist: 0.015
            .......................................................................
            - Trades:
              - Lines: pnlplus, pnlminus
              - Params: None
          *************************************************************************
          - Analyzers:
            .......................................................................
            - Value:
              - Begin: 10000.0
              - End: 10000.0
    

  • administrators

    You need a custom writer which only considers the data you want. There is disabling of anything in the default Writer