class_docstr: A BarFeed that builds bars from a Historic Trade Data CSV file as described in http://www.bitcoincharts.com/about/markets-api/.
  Files can be downloaded from http://api.bitcoincharts.com/v1/csv/.
  
  :param timezone: An optional default timezone to use to localize bars. By default bars are loaded in UTC.
  :type timezone: A pytz timezone.
  :param maxLen: The maximum number of values that the :class:`pyalgotrade.dataseries.bards.BarDataSeries` will hold.
      If not None, it must be greater than 0.
      Once a bounded length is full, when new items are added, a corresponding number of items are discarded from the
      opposite end. If None then dataseries.DEFAULT_MAX_LEN is used.
  :type maxLen: int.
  
  .. note::
      * A :class:`pyalgotrade.bar.Bar` instance will be created for every trade, so open, high, low and close values will all be the same.
      * Files must be sorted with the **unixtime** column in ascending order.
docstr: Loads bars from a trades CSV formatted file.
  
  :param path: The path to the file.
  :type path: string.
  :param instrument: The instrument identifier.
  :type instrument: string.
  :param timezone: An optional timezone to use to localize bars. By default bars are loaded in UTC.
  :type timezone: A pytz timezone.
  :param fromDateTime: An optional datetime to use to filter bars to load.
      If supplied only those bars whose datetime is greater than or equal to fromDateTime are loaded.
  :type fromDateTime: datetime.datetime.
  :param toDateTime: An optional datetime to use to filter bars to load.
      If supplied only those bars whose datetime is lower than or equal to toDateTime are loaded.
  :type toDateTime: datetime.datetime.
  
  .. note::
      * Every file that you load bars from must have trades in the same currency.
      * If fromDateTime or toDateTime are naive, they are treated as UTC.
docstr_tok: ["Loads","bars","from","a","trades","CSV","formatted","file",".",":","param","path",":","The","path","to","the","file",".",":","type","path",":","string",".",":","param","instrument",":","The","instrument","identifier",".",":","type","instrument",":","string",".",":","param","timezone",":","An","optional","timezone","to","use","to","localize","bars",".","By","default","bars","are","loaded","in","UTC",".",":","type","timezone",":","A","pytz","timezone",".",":","param","fromDateTime",":","An","optional","datetime","to","use","to","filter","bars","to","load",".","If","supplied","only","those","bars","whose","datetime","is","greater","than","or","equal","to","fromDateTime","are","loaded",".",":","type","fromDateTime",":","datetime.datetime",".",":","param","toDateTime",":","An","optional","datetime","to","use","to","filter","bars","to","load",".","If","supplied","only","those","bars","whose","datetime","is","lower","than","or","equal","to","toDateTime","are","loaded",".",":","type","toDateTime",":","datetime.datetime",".","..","note",":",":","*","Every","file","that","you","load","bars","from","must","have","trades","in","the","same","currency",".","*","If","fromDateTime","or","toDateTime","are","naive",",","they","are","treated","as","UTC","."]
code: def addBarsFromCSV(
      self,
      path,
      instrument="BTC",
      timezone=None,
      fromDateTime=None,
      toDateTime=None,
  ):
      """Loads bars from a trades CSV formatted file.
  
      :param path: The path to the file.
      :type path: string.
      :param instrument: The instrument identifier.
      :type instrument: string.
      :param timezone: An optional timezone to use to localize bars. By default bars are loaded in UTC.
      :type timezone: A pytz timezone.
      :param fromDateTime: An optional datetime to use to filter bars to load.
          If supplied only those bars whose datetime is greater than or equal to fromDateTime are loaded.
      :type fromDateTime: datetime.datetime.
      :param toDateTime: An optional datetime to use to filter bars to load.
          If supplied only those bars whose datetime is lower than or equal to toDateTime are loaded.
      :type toDateTime: datetime.datetime.
  
      .. note::
          * Every file that you load bars from must have trades in the same currency.
          * If fromDateTime or toDateTime are naive, they are treated as UTC.
      """
  
      if timezone is None:
          timezone = self.__timezone
      rowParser = RowParser(self.__unixTimeFix, timezone)
  
      # Save the barfilter to restore it later.
      prevBarFilter = self.getBarFilter()
      try:
          if fromDateTime or toDateTime:
              self.setBarFilter(
                  csvfeed.DateRangeFilter(
                      to_utc_if_naive(fromDateTime),
                      to_utc_if_naive(toDateTime),
                  )
              )
          super(CSVTradeFeed, self).addBarsFromCSV(
              instrument, path, rowParser
          )
      finally:
          self.setBarFilter(prevBarFilter)
  
imports: from pyalgotrade import barfeed
  from pyalgotrade import bar
  from pyalgotrade.barfeed import csvfeed
  from pyalgotrade.utils import dt
  import datetime
label_desc: Use image node_id 3 for calling the CSVTradeFeed obj's underlying member method code with example usage: obj.addBarsFromCSV(path, instrument, timezone, fromDateTime, toDateTime) without return types