class_docstr: Base Class for the Commission Schemes.
  
  Params:
  
    - ``commission`` (def: ``0.0``): base commission value in percentage or
      monetary units
  
    - ``mult`` (def ``1.0``): multiplier applied to the asset for
      value/profit
  
    - ``margin`` (def: ``None``): amount of monetary units needed to
      open/hold an operation. It only applies if the final ``_stocklike``
      attribute in the class is set to ``False``
  
    - ``automargin`` (def: ``False``): Used by the method ``get_margin``
      to automatically calculate the margin/guarantees needed with the
      following policy
  
        - Use param ``margin`` if param ``automargin`` evaluates to ``False``
  
        - Use param ``mult`` * ``price`` if ``automargin < 0``
  
        - Use param ``automargin`` * ``price`` if ``automargin > 0``
  
    - ``commtype`` (def: ``None``): Supported values are
      ``CommInfoBase.COMM_PERC`` (commission to be understood as %) and
      ``CommInfoBase.COMM_FIXED`` (commission to be understood as monetary
      units)
  
      The default value of ``None`` is a supported value to retain
      compatibility with the legacy ``CommissionInfo`` object. If
      ``commtype`` is set to None, then the following applies:
  
        - ``margin`` is ``None``: Internal ``_commtype`` is set to
          ``COMM_PERC`` and ``_stocklike`` is set to ``True`` (Operating
          %-wise with Stocks)
  
        - ``margin`` is not ``None``: ``_commtype`` set to ``COMM_FIXED`` and
          ``_stocklike`` set to ``False`` (Operating with fixed rount-trip
          commission with Futures)
  
      If this param is set to something else than ``None``, then it will be
      passed to the internal ``_commtype`` attribute and the same will be
      done with the param ``stocklike`` and the internal attribute
      ``_stocklike``
  
    - ``stocklike`` (def: ``False``): Indicates if the instrument is
      Stock-like or Futures-like (see the ``commtype`` discussion above)
  
    - ``percabs`` (def: ``False``): when ``commtype`` is set to COMM_PERC,
      whether the parameter ``commission`` has to be understood as XX% or
      0.XX
  
      If this param is ``True``: 0.XX
      If this param is ``False``: XX%
  
    - ``interest`` (def: ``0.0``)
  
      If this is non-zero, this is the yearly interest charged for holding a
      short selling position. This is mostly meant for stock short-selling
  
      The formula: ``days * price * abs(size) * (interest / 365)``
  
      It must be specified in absolute terms: 0.05 -> 5%
  
      .. note:: the behavior can be changed by overriding the method:
               ``_get_credit_interest``
  
    - ``interest_long`` (def: ``False``)
  
      Some products like ETFs get charged on interest for short and long
      positions. If ths is ``True`` and ``interest`` is non-zero the interest
      will be charged on both directions
  
    - ``leverage`` (def: ``1.0``)
  
      Amount of leverage for the asset with regards to the needed cash
  
  Attributes:
  
    - ``_stocklike``: Final value to use for Stock-like/Futures-like behavior
    - ``_commtype``: Final value to use for PERC vs FIXED commissions
  
    This two are used internally instead of the declared params to enable the
    compatibility check described above for the legacy ``CommissionInfo``
    object
class_docstr_tok: ["Base","Class","for","the","Commission","Schemes",".","Params",":","-","``","commission","``","(","def",":","``","0.0","``",")",":","base","commission","value","in","percentage","or","monetary","units","-","``","mult","``","(","def","``","1.0","``",")",":","multiplier","applied","to","the","asset","for","value\/profit","-","``","margin","``","(","def",":","``","None","``",")",":","amount","of","monetary","units","needed","to","open\/hold","an","operation",".","It","only","applies","if","the","final","``","_stocklike","``","attribute","in","the","class","is","set","to","``","False","``","-","``","automargin","``","(","def",":","``","False","``",")",":","Used","by","the","method","``","get_margin","``","to","automatically","calculate","the","margin\/guarantees","needed","with","the","following","policy","-","Use","param","``","margin","``","if","param","``","automargin","``","evaluates","to","``","False","``","-","Use","param","``","mult","``","*","``","price","``","if","``","automargin","<","0","``","-","Use","param","``","automargin","``","*","``","price","``","if","``","automargin",">","0","``","-","``","commtype","``","(","def",":","``","None","``",")",":","Supported","values","are","``","CommInfoBase.COMM_PERC","``","(","commission","to","be","understood","as","%",")","and","``","CommInfoBase.COMM_FIXED","``","(","commission","to","be","understood","as","monetary","units",")","The","default","value","of","``","None","``","is","a","supported","value","to","retain","compatibility","with","the","legacy","``","CommissionInfo","``","object",".","If","``","commtype","``","is","set","to","None",",","then","the","following","applies",":","-","``","margin","``","is","``","None","``",":","Internal","``","_commtype","``","is","set","to","``","COMM_PERC","``","and","``","_stocklike","``","is","set","to","``","True","``","(","Operating","%","-wise","with","Stocks",")","-","``","margin","``","is","not","``","None","``",":","``","_commtype","``","set","to","``","COMM_FIXED","``","and","``","_stocklike","``","set","to","``","False","``","(","Operating","with","fixed","rount-trip","commission","with","Futures",")","If","this","param","is","set","to","something","else","than","``","None","``",",","then","it","will","be","passed","to","the","internal","``","_commtype","``","attribute","and","the","same","will","be","done","with","the","param","``","stocklike","``","and","the","internal","attribute","``","_stocklike","``","-","``","stocklike","``","(","def",":","``","False","``",")",":","Indicates","if","the","instrument","is","Stock-like","or","Futures-like","(","see","the","``","commtype","``","discussion","above",")","-","``","percabs","``","(","def",":","``","False","``",")",":","when","``","commtype","``","is","set","to","COMM_PERC",",","whether","the","parameter","``","commission","``","has","to","be","understood","as","XX","%","or","0.XX","If","this","param","is","``","True","``",":","0.XX","If","this","param","is","``","False","``",":","XX","%","-","``","interest","``","(","def",":","``","0.0","``",")","If","this","is","non-zero",",","this","is","the","yearly","interest","charged","for","holding","a","short","selling","position",".","This","is","mostly","meant","for","stock","short-selling","The","formula",":","``","days","*","price","*","abs","(","size",")","*","(","interest","\/","365",")","``","It","must","be","specified","in","absolute","terms",":","0.05","-",">","5","%","..","note",":",":","the","behavior","can","be","changed","by","overriding","the","method",":","``","_get_credit_interest","``","-","``","interest_long","``","(","def",":","``","False","``",")","Some","products","like","ETFs","get","charged","on","interest","for","short","and","long","positions",".","If","ths","is","``","True","``","and","``","interest","``","is","non-zero","the","interest","will","be","charged","on","both","directions","-","``","leverage","``","(","def",":","``","1.0","``",")","Amount","of","leverage","for","the","asset","with","regards","to","the","needed","cash","Attributes",":","-","``","_stocklike","``",":","Final","value","to","use","for","Stock-like\/Futures-like","behavior","-","``","_commtype","``",":","Final","value","to","use","for","PERC","vs","FIXED","commissions","This","two","are","used","internally","instead","of","the","declared","params","to","enable","the","compatibility","check","described","above","for","the","legacy","``","CommissionInfo","``","object"]
docstr: Calculates the credit due for short selling or product specific
docstr_tok: ["Calculates","the","credit","due","for","short","selling","or","product","specific"]
code: def get_credit_interest(self, data, pos, dt):
      """Calculates the credit due for short selling or product specific"""
      size, price = pos.size, pos.price
  
      if size > 0 and not self.p.interest_long:
          return 0.0  # long positions not charged
  
      dt0 = dt.date()
      dt1 = pos.datetime.date()
  
      if dt0 <= dt1:
          return 0.0
  
      return self._get_credit_interest(
          data, size, price, (dt0 - dt1).days, dt0, dt1
      )
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import datetime
  from .utils.py3 import with_metaclass
  from .metabase import MetaParams
label_desc: Use image node_id 15 for calling the CommInfoBase obj's underlying member method code with example usage: obj.get_credit_interest(data, pos, dt) and returns: self, int, int