code: def _getsizing(self, comminfo, cash, data, isbuy):
      if isbuy:
          return self.p.stake
  
      # Sell situation
      position = self.broker.getposition(data)
      if not position.size:
          return 0  # do not sell if nothing is open
  
      return self.p.stake
  
file_path: backtrader/samples/sizertest/sizertest.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import random
  import backtrader
label_desc: Use image node_id 1 for calling the LongOnly obj's underlying member method code with example usage: obj._getsizing(comminfo, cash, data, isbuy) and returns: self, self, int