请 [注册] 或 [登录]  | 返回主站

量化交易吧 /  量化平台 帖子:3353548 新帖:25

float infinity to integer

我是小编发表于:8 月 2 日 10:38回复(1)

//测试代码如下:
from jqdata import *
import random

def initialize(context):
set_subportfolios([SubPortfolioConfig(cash=context.portfolio.starting_cash, type='futures')])
run_daily(run_time, time='09:00')

def run_time(context):
orderinfo = order('CJ1912.XZCE', amount=6, side='short')

//设置
2019-07-22 到 2019-07-31, ¥1000000, 每天

//报错
2019-07-22 09:00:00 - INFO - 订单已提交:FuturesOrder(entrust_id=1564712581 security=CJ1912.XZCE mode=OrderAmount: _amount=6 style=MarketOrderStyle: _limit_price=0.0 side=short action=open margin=False entrust_time=2019-07-22 09:00:00 error=)

2019-07-22 09:00:00 - WARNING - /tmp/jqcore/jqboson/jqboson/account/base.py:1817: RuntimeWarning: divide by zero encountered in double_scalars
(trade_price multiplier margin_rate))

2019-07-22 09:00:00 - ERROR - Traceback (most recent call last):
File "/tmp/jqcore/jqboson/jqboson/core/entry.py", line 368, in _run
engine.start()
File "/tmp/jqcore/jqboson/jqboson/core/engine.py", line 232, in start
self._dispatcher.start()
File "/tmp/jqcore/jqboson/jqboson/core/dispatcher.py", line 273, in start
self._run_loop()
File "/tmp/jqcore/jqboson/jqboson/core/dispatcher.py", line 240, in _run_loop
self._loop.run()
File "/tmp/jqcore/jqboson/jqboson/core/loop/loop.py", line 84, in run
self._handle_queue()
File "/tmp/jqcore/jqboson/jqboson/core/loop/loop.py", line 124, in _handle_queue
message.callback(message.callback_data)
File "/tmp/jqcore/jqboson/jqboson/core/dispatcher.py", line 110, in callback
self._event_bus.emit(evt)
File "/tmp/jqcore/jqboson/jqboson/core/bus.py", line 47, in emit
ret.append(call(event))
File "/tmp/jqcore/jqboson/jqboson/core/strategy.py", line 376, in _wrapper
return cb(self._context.strategy_environment.strategy_context,
cb_kwargs)
File "/tmp/strategy/user_code.py", line 10, in run_time
orderinfo = order('CJ1912.XZCE', amount=6, side='short')
File "/tmp/jqcore/jqboson/jqboson/api/account.py", line 121, in order
account, security, mode, style, side, entrust_time=entrust_time, close_today=close_today)
File "/tmp/jqcore/jqboson/jqboson/account/account_manager.py", line 627, in request_order
**kwargs)
File "/tmp/jqcore/jqboson/jqboson/account/broker.py", line 289, in submit_order
return account.submit_order(order)
File "/tmp/jqcore/jqboson/jqboson/account/base.py", line 1969, in submit_order
if not self.entrust_order(order):
File "/tmp/jqcore/jqboson/jqboson/account/base.py", line 2004, in entrust_order
ret = self.check_entrust_order(order)
File "/tmp/jqcore/jqboson/jqboson/account/base.py", line 1940, in check_entrust_order
new_amount = self.check_order(order, real_amount)
File "/tmp/jqcore/jqboson/jqboson/account/futures.py", line 222, in check_order
amount = super(FuturesAccount, self).check_order(order, amount)
File "/tmp/jqcore/jqboson/jqboson/account/base.py", line 1819, in check_order
aval_amount = int(aval_amount)
OverflowError: cannot convert float infinity to integer

全部回复

0/140

达人推荐

量化课程

    移动端课程