Navigation

    Backtrader Community

    • Register
    • 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/

    error when buying stocks with ib

    General Code/Help
    2
    4
    432
    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.
    • T
      Trade Prophet last edited by

      Hello,
      I use ib as the live broker and everything seems to be ok until I get to the code that actually buys a stock
      self.buy(data=self.getdatabyname(ticker), size=100)
      I get the error "error() takes 2 positional arguments but 4 were given"
      can anyone help?

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

        The stack traces are usually a bit more verbose, indicating where the error happened. Can you post it?

        1 Reply Last reply Reply Quote 0
        • T
          Trade Prophet last edited by

          Found the problem, the size parameter cant be float value, even if it is 170.0 it must be converted to an int

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

            The IB API is always full of surprises.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
            $(document).ready(function () { app.coldLoad(); }); }