class_docstr: Bar Filler for a Data Source inside the declared session start/end times.
  
  The fill bars are constructed using the declared Data Source ``timeframe``
  and ``compression`` (used to calculate the intervening missing times)
  
  Params:
  
    - fill_price (def: None):
  
      If None is passed, the closing price of the previous bar will be
      used. To end up with a bar which for example takes time but it is not
      displayed in a plot ... use float('Nan')
  
    - fill_vol (def: float('NaN')):
  
      Value to use to fill the missing volume
  
    - fill_oi (def: float('NaN')):
  
      Value to use to fill the missing Open Interest
  
    - skip_first_fill (def: True):
  
      Upon seeing the 1st valid bar do not fill from the sessionstart up to
      that bar
class_docstr_tok: ["Bar","Filler","for","a","Data","Source","inside","the","declared","session","start\/end","times",".","The","fill","bars","are","constructed","using","the","declared","Data","Source","``","timeframe","``","and","``","compression","``","(","used","to","calculate","the","intervening","missing","times",")","Params",":","-","fill_price","(","def",":","None",")",":","If","None","is","passed",",","the","closing","price","of","the","previous","bar","will","be","used",".","To","end","up","with","a","bar","which","for","example","takes","time","but","it","is","not","displayed","in","a","plot","...","use","float","(","'Nan","'",")","-","fill_vol","(","def",":","float","(","'NaN","'",")",")",":","Value","to","use","to","fill","the","missing","volume","-","fill_oi","(","def",":","float","(","'NaN","'",")",")",":","Value","to","use","to","fill","the","missing","Open","Interest","-","skip_first_fill","(","def",":","True",")",":","Upon","seeing","the","1st","valid","bar","do","not","fill","from","the","sessionstart","up","to","that","bar"]
docstr: Params:
    - data: the data source to filter/process
  
  Returns:
    - False (always) because this filter does not remove bars from the
  stream
  
  The logic (starting with a session end control flag of MAXDATE)
  
    - If new bar is over session end (never true for 1st bar)
  
      Fill up to session end. Reset sessionend to MAXDATE & fall through
  
    - If session end is flagged as MAXDATE
  
      Recalculate session limits and check whether the bar is within them
  
      if so, fill up and record the last seen tim
  
    - Else ... the incoming bar is in the session, fill up to it
docstr_tok: ["Params",":","-","data",":","the","data","source","to","filter\/process","Returns",":","-","False","(","always",")","because","this","filter","does","not","remove","bars","from","the","stream","The","logic","(","starting","with","a","session","end","control","flag","of","MAXDATE",")","-","If","new","bar","is","over","session","end","(","never","true","for","1st","bar",")","Fill","up","to","session","end",".","Reset","sessionend","to","MAXDATE","&","fall","through","-","If","session","end","is","flagged","as","MAXDATE","Recalculate","session","limits","and","check","whether","the","bar","is","within","them","if","so",",","fill","up","and","record","the","last","seen","tim","-","Else","...","the","incoming","bar","is","in","the","session",",","fill","up","to","it"]
code: def __call__(self, data):
      """
      Params:
        - data: the data source to filter/process
  
      Returns:
        - False (always) because this filter does not remove bars from the
      stream
  
      The logic (starting with a session end control flag of MAXDATE)
  
        - If new bar is over session end (never true for 1st bar)
  
          Fill up to session end. Reset sessionend to MAXDATE & fall through
  
        - If session end is flagged as MAXDATE
  
          Recalculate session limits and check whether the bar is within them
  
          if so, fill up and record the last seen tim
  
        - Else ... the incoming bar is in the session, fill up to it
      """
      # Get time of current (from data source) bar
      ret = False
  
      dtime_cur = data.datetime.datetime()
  
      if dtime_cur > self.sessend:
          # bar over session end - fill up and invalidate
          # Do not put current bar in stack to let it be evaluated below
          # Fill up to endsession + smallest unit of timeframe
          ret = self._fillbars(
              data,
              self.dtime_prev,
              self.sessend + self._tdframe,
              tostack=False,
          )
          self.sessend = self.MAXDATE
  
      # Fall through from previous check ... the bar which is over the
      # session could already be in a new session and within the limits
      if self.sessend == self.MAXDATE:
          # No bar seen yet or one went over previous session limit
          ddate = dtime_cur.date()
          sessstart = datetime.combine(ddate, data.p.sessionstart)
          self.sessend = sessend = datetime.combine(
              ddate, data.p.sessionend
          )
  
          if sessstart <= dtime_cur <= sessend:
              # 1st bar from session in the session - fill from session start
              if self.seenbar or not self.p.skip_first_fill:
                  ret = self._fillbars(
                      data, sessstart - self._tdunit, dtime_cur
                  )
  
          self.seenbar = True
          self.dtime_prev = dtime_cur
  
      else:
          # Seen a previous bar and this is in the session - fill up to it
          ret = self._fillbars(data, self.dtime_prev, dtime_cur)
          self.dtime_prev = dtime_cur
  
      return ret
  
file_path: backtrader/backtrader/filters/session.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from datetime import datetime, timedelta
  from backtrader import TimeFrame
  from backtrader.utils.py3 import with_metaclass
  from ..None import metabase
label_desc: Use image node_id 2 for calling the SessionFiller obj's underlying member method code with example usage: obj.__call__(data) and returns: ret