class_docstr: Oanda Data Feed.
  
  Params:
  
    - ``qcheck`` (default: ``0.5``)
  
      Time in seconds to wake up if no data is received to give a chance to
      resample/replay packets properly and pass notifications up the chain
  
    - ``historical`` (default: ``False``)
  
      If set to ``True`` the data feed will stop after doing the first
      download of data.
  
      The standard data feed parameters ``fromdate`` and ``todate`` will be
      used as reference.
  
      The data feed will make multiple requests if the requested duration is
      larger than the one allowed by IB given the timeframe/compression
      chosen for the data.
  
    - ``backfill_start`` (default: ``True``)
  
      Perform backfilling at the start. The maximum possible historical data
      will be fetched in a single request.
  
    - ``backfill`` (default: ``True``)
  
      Perform backfilling after a disconnection/reconnection cycle. The gap
      duration will be used to download the smallest possible amount of data
  
    - ``backfill_from`` (default: ``None``)
  
      An additional data source can be passed to do an initial layer of
      backfilling. Once the data source is depleted and if requested,
      backfilling from IB will take place. This is ideally meant to backfill
      from already stored sources like a file on disk, but not limited to.
  
    - ``bidask`` (default: ``True``)
  
      If ``True``, then the historical/backfilling requests will request
      bid/ask prices from the server
  
      If ``False``, then *midpoint* will be requested
  
    - ``useask`` (default: ``False``)
  
      If ``True`` the *ask* part of the *bidask* prices will be used instead
      of the default use of *bid*
  
    - ``includeFirst`` (default: ``True``)
  
      Influence the delivery of the 1st bar of a historical/backfilling
      request by setting the parameter directly to the Oanda API calls
  
    - ``reconnect`` (default: ``True``)
  
      Reconnect when network connection is down
  
    - ``reconnections`` (default: ``-1``)
  
      Number of times to attempt reconnections: ``-1`` means forever
  
    - ``reconntimeout`` (default: ``5.0``)
  
      Time in seconds to wait in between reconnection attemps
  
  This data feed supports only this mapping of ``timeframe`` and
  ``compression``, which comply with the definitions in the OANDA API
  Developer's Guid::
  
      (TimeFrame.Seconds, 5): 'S5',
      (TimeFrame.Seconds, 10): 'S10',
      (TimeFrame.Seconds, 15): 'S15',
      (TimeFrame.Seconds, 30): 'S30',
      (TimeFrame.Minutes, 1): 'M1',
      (TimeFrame.Minutes, 2): 'M3',
      (TimeFrame.Minutes, 3): 'M3',
      (TimeFrame.Minutes, 4): 'M4',
      (TimeFrame.Minutes, 5): 'M5',
      (TimeFrame.Minutes, 10): 'M10',
      (TimeFrame.Minutes, 15): 'M15',
      (TimeFrame.Minutes, 30): 'M30',
      (TimeFrame.Minutes, 60): 'H1',
      (TimeFrame.Minutes, 120): 'H2',
      (TimeFrame.Minutes, 180): 'H3',
      (TimeFrame.Minutes, 240): 'H4',
      (TimeFrame.Minutes, 360): 'H6',
      (TimeFrame.Minutes, 480): 'H8',
      (TimeFrame.Days, 1): 'D',
      (TimeFrame.Weeks, 1): 'W',
      (TimeFrame.Months, 1): 'M',
  
  Any other combination will be rejected
code: def _load(self):
      if self._state == self._ST_OVER:
          return False
  
      while True:
          if self._state == self._ST_LIVE:
              try:
                  msg = self._storedmsg.pop(
                      None, None
                  ) or self.qlive.get(timeout=self._qcheck)
              except queue.Empty:
                  return None  # indicate timeout situation
  
              if (
                  msg is None
              ):  # Conn broken during historical/backfilling
                  self.put_notification(self.CONNBROKEN)
                  # Try to reconnect
                  if not self.p.reconnect or self._reconns == 0:
                      # Can no longer reconnect
                      self.put_notification(self.DISCONNECTED)
                      self._state = self._ST_OVER
                      return False  # failed
  
                  self._reconns -= 1
                  self._st_start(
                      instart=False, tmout=self.p.reconntimeout
                  )
                  continue
  
              if "code" in msg:
                  self.put_notification(self.CONNBROKEN)
                  code = msg["code"]
                  if code not in [599, 598, 596]:
                      self.put_notification(self.DISCONNECTED)
                      self._state = self._ST_OVER
                      return False  # failed
  
                  if not self.p.reconnect or self._reconns == 0:
                      # Can no longer reconnect
                      self.put_notification(self.DISCONNECTED)
                      self._state = self._ST_OVER
                      return False  # failed
  
                  # Can reconnect
                  self._reconns -= 1
                  self._st_start(
                      instart=False, tmout=self.p.reconntimeout
                  )
                  continue
  
              self._reconns = self.p.reconnections
  
              # Process the message according to expected return type
              if not self._statelivereconn:
                  if self._laststatus != self.LIVE:
                      if (
                          self.qlive.qsize() <= 1
                      ):  # very short live queue
                          self.put_notification(self.LIVE)
  
                  ret = self._load_tick(msg)
                  if ret:
                      return True
  
                  # could not load bar ... go and get new one
                  continue
  
              # Fall through to processing reconnect - try to backfill
              self._storedmsg[None] = msg  # keep the msg
  
              # else do a backfill
              if self._laststatus != self.DELAYED:
                  self.put_notification(self.DELAYED)
  
              dtend = None
              if len(self) > 1:
                  # len == 1 ... forwarded for the 1st time
                  dtbegin = self.datetime.datetime(-1)
              elif self.fromdate > float("-inf"):
                  dtbegin = num2date(self.fromdate)
              else:  # 1st bar and no begin set
                  # passing None to fetch max possible in 1 request
                  dtbegin = None
  
              dtend = datetime.utcfromtimestamp(
                  int(msg["time"]) / 10**6
              )
  
              self.qhist = self.o.candles(
                  self.p.dataname,
                  dtbegin,
                  dtend,
                  self._timeframe,
                  self._compression,
                  candleFormat=self._candleFormat,
                  includeFirst=self.p.includeFirst,
              )
  
              self._state = self._ST_HISTORBACK
              self._statelivereconn = False  # no longer in live
              continue
  
          elif self._state == self._ST_HISTORBACK:
              msg = self.qhist.get()
              if (
                  msg is None
              ):  # Conn broken during historical/backfilling
                  # Situation not managed. Simply bail out
                  self.put_notification(self.DISCONNECTED)
                  self._state = self._ST_OVER
                  return False  # error management cancelled the queue
  
              elif "code" in msg:  # Error
                  self.put_notification(self.NOTSUBSCRIBED)
                  self.put_notification(self.DISCONNECTED)
                  self._state = self._ST_OVER
                  return False
  
              if msg:
                  if self._load_history(msg):
                      return True  # loading worked
  
                  continue  # not loaded ... date may have been seen
              else:
                  # End of histdata
                  if self.p.historical:  # only historical
                      self.put_notification(self.DISCONNECTED)
                      self._state = self._ST_OVER
                      return False  # end of historical
  
              # Live is also wished - go for it
              self._state = self._ST_LIVE
              continue
  
          elif self._state == self._ST_FROM:
              if not self.p.backfill_from.next():
                  # additional data source is consumed
                  self._state = self._ST_START
                  continue
  
              # copy lines of the same name
              for alias in self.lines.getlinealiases():
                  lsrc = getattr(self.p.backfill_from.lines, alias)
                  ldst = getattr(self.lines, alias)
  
                  ldst[0] = lsrc[0]
  
              return True
  
          elif self._state == self._ST_START:
              if not self._st_start(instart=False):
                  self._state = self._ST_OVER
                  return False
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from datetime import datetime, timedelta
  from backtrader.feed import DataBase
  from backtrader import TimeFrame, date2num, num2date
  from backtrader.utils.py3 import integer_types, queue, string_types, with_metaclass
  from backtrader.metabase import MetaParams
  from backtrader.stores import oandastore
label_desc: Use image node_id 9 for calling the OandaData obj's underlying member method code with example usage: obj._load() and returns: False, None, False, False, False, True, False, True, False, True, False, False