Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    question about futures margin

    General Discussion
    2
    2
    528
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jlz last edited by jlz

      say i am trading soybean meal, some numbers:

      10 tons one lot

      3000$ one ton

      margin required 5%

      so one lot requires margin 3000 * 10 * 5% = 1500$

      but if i set commission as follows:

          cerebro.broker.setcommission(
              commission = 1.125,                     # 豆粕开仓1.5,平今0.75,单边平均1.125
              commtype = bt.CommInfoBase.COMM_FIXED,  # 固定手续费
              #percabs = True,                        # 这里用不到这个参数,当commtype是COMM_PERC时表示commission按照0.xx还是0.xx%计算
              automargin = 0.05,                      # 保证金10%
              mult = 10,                              # 豆粕一手10吨
              #stocklike = False,                      # 不是stock,而是futures
          )
      

      when executing self.buy(), log is:

      2019-03-19T13:00:02.403001 BUY EXECUTED, Price: 2608.00, Cost: 130.40, Comm 1.12
      

      should not it cost 2608 * 10 * 0.05=1304.0 but not 130.40 ?

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        The multiplier affects your winnings and losses and not the needed margin.

        See Docs - Commission Schemes

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors