我在python中调用这样的函数。
order_id = kite.order_place(self, exchange, tradingsymbol,
transaction_type, quantity, price, product, order_type, validity,
disclosed_quantity=None, trigger_price=None, squareoff_value,
stoploss_value, trailing_stoploss, variety, tag='')
这是函数文档中的代码。。
def order_place(self, exchange, tradingsymbol, transaction_type,
quantity, price=None, product=None, order_type=None, validity=None,
disclosed_quantity=None, trigger_price=None, squareoff_value=None,
stoploss_value=None, trailing_stoploss=None, variety='regular', tag='')
它给出了这样一个错误。。
如何解决这个错误? 谢谢!
grammar of the language指定位置参数出现在调用中的关键字或星号参数之前:
具体来说,关键字参数如下:
tag='insider trading!'
而位置参数看起来是这样的:..., exchange, ...
。问题在于,您似乎复制/粘贴了参数列表,并保留了一些默认值,这使它们看起来像关键字参数,而不是位置参数。这很好,但您可以返回到使用位置参数,这是一个语法错误。另外,当一个参数有一个默认值时,比如
price=None
,这意味着您不必提供它。如果您不提供它,它将使用默认值。若要解决此错误,请将后面的位置参数转换为关键字参数,或者,如果它们具有默认值,并且您不需要使用它们,则完全不必指定它们:
相关问题 更多 >
编程相关推荐