Giter VIP home page Giter VIP logo

easyquant's Issues

股票代码不全

你好,
20190430,刚才发现使用quotation = easyquotation.use('sina')后,股票代码仍然没有 :
000876新希望,使用tencent时候有。
不同数据来源,有没有其他主要区别,能不能介绍一下。

谢谢

2017/9/7日,广发登录后报错

Traceback (most recent call last):
File "test.py", line 100, in
m = easyquant.MainEngine(broker_data, account_data, quotation_engines=[quotation_engine], log_handler=log_data)
File "D:\easyquant\easyquant\main_engine.py", line 44, in init
self.user.prepare(need_data)
File "C:\Python36\lib\site-packages\easytrader\webtrader.py", line 73, in prepare
self.autologin()
File "C:\Python36\lib\site-packages\easytrader\webtrader.py", line 84, in autologin
if self.login():
File "C:\Python36\lib\site-packages\easytrader\gftrader.py", line 78, in login
login_status, result = self.post_login_data(verify_code)
File "C:\Python36\lib\site-packages\easytrader\gftrader.py", line 96, in post_login_data
self.__set_trade_need_info()
File "C:\Python36\lib\site-packages\easytrader\gftrader.py", line 155, in __set_trade_need_info
jsholder = eval(jsholder[0])
IndexError: list index out of range

main_engine.py的66行编译不过。

self.quotation_engines.append(quotation_engine(self.event_engine, self.clock_engine))

这里的quotation_engine是一个str的类型。运行到这里直接错误退出。
错误类型:
TypeError: 'str' object is not callable

原以为这里的 quotation_engine(....)应该是在quotation_engine.py里面定义的quotation_engine类。

但是没有找到。就在quotation_engine.py里面重新继承了一个quotation_engine才通过。

不知道哪里出了问题。

Fatal Python error: GC object already tracked

from easyquant import StrategyTemplate
import tushare as ts
import datetime

ts.set_token('*******************************')

class Strategy(StrategyTemplate):
    def strategy(self, event):
        #------------------------时间---------------------------------------
        today = datetime.date.today().strftime("%Y%m%d")
        mt = ts.Master()
        yesterday = mt.TradeCal(exchangeCD='XSHG', beginDate=today, endDate=today, field='prevTradeDate')
        yesterday = yesterday['prevTradeDate'].values
        yesterday = yesterday[0][0:4] + yesterday[0][5:7] + yesterday[0][8:10]
        #---------------------股票池获取-------------------------------------
        eq = ts.Equity()
        stockList = eq.Equ(equTypeCD='A', listStatusCD='L', field='ticker')
        print(stockList[0:2])

        return

当在strategy中调用tushare的接口时,出现bug,貌似与多线程有关。

clock_engine中moment事件无法触发

Jun 15, 2016 commit的clock_engine中moment事件无法触发,May 22, 2016的clock_engine版本正常。
目前看来Jun 15, 2016的clock_engine存在下面问题:

if self.is_trading_date and not etime.is_trade_date(self.clock_engine.now_dt):中,etime.is_trade_date前多了个not,导致交易日is_active变为False。应该去掉这个not。

easydealutils\time.py 有bug

File "D:\programs\python\easyquant-master\easyquant\easydealutils\time.py", li
ne 51, in calc_next_trade_time_delta_seconds
next_trade_start = now_time.replace(day=now_time.day + 1, hour=9, minute=15,
second=0)
ValueError: day is out of range for month

day=now_time.day + 1 不能用数字计算,应该改成日期运算

shutdown 机制

  • 我认为需要个 shutdown 机制,在进程终止前进行逻辑,如将 log 句柄 flush 到硬盘。
  • 机制需要捕获以下进程终止信号:
  1. signal.SIGQUIT, # quit 信号
  2. signal.SIGINT, # 键盘信号
  3. signal.SIGHUP, # nohup 命令
  4. signal.SIGTERM, # kill 命令

account.session存储出错

with open(ACCOUNT_OBJECT_FILE, 'wb') as f:
dill.dump(self.user, f)
佣金宝和雪球账号执行到上一行时出现错误:
TypeError: Cannot serialize socket object

shutdown 机制 #21

现在 CTRL C 不能终止程序了?
为什么触发不了_shutdown(self, sig, frame)

环境 :Windows10 python3.6.12

运行过程中抛异常

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000000009364080>

RUN模式无法持续运行,DEBUG下可以

环境 python 3.5
IDE PYCHARM
log如下:
[2016-02-24 11:05:59.442630] DEBUG: helpers.py: java detect result: java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
[2016-02-24 11:05:59.910963] DEBUG: helpers.py: recognize output: file=E:\Trader\easyquant\vcode
code=C4bj
[2016-02-24 11:06:03.348539] INFO: main_engine.py: 加载策略: 策略1
[2016-02-24 11:06:03.350540] INFO: main_engine.py: 加载策略完毕
启动主引擎

Process finished with exit code 0

时间控制系统

增加对交易系统的时间控制,可以在指定交易时间启动

怎么安装?

用pip install或进入其文件夹内用python setup.py都不能安装!

redhat7.3 python3.5下线程一直在增加

线程一直在增加,最后内存耗尽。
Threads: 168 total, 0 running, 168 sleeping, 0 stopped, 0 zombie
%Cpu(s): 8.3 us, 0.3 sy, 0.0 ni, 91.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 1016244 total, 297844 free, 201716 used, 516684 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 625336 avail Mem

安装easyquant时报错

作者您好,我在ubuntu上安装了easyquant,库都已经安装好了,我是使用雪球登录的,但是在运行test.py的时候,报错了markup未定义,不知道您在调试的时候是否也有这个问题?或者您可以指点一下方向?感谢您。
————————————————————————————————————————————
brian@ubuntu:~/py/easyquant$ python3 test.py
easyquant 测试 DEMO
请输入你使用的券商:
1: 华泰 2: 佣金宝 3: 银河 4: 雪球模拟组合 5: 广发
:4
请输入你的帐号配置文件路径(直接回车使用 xq.json)
:
请输入使用行情引擎 1: sina 2: leverfun 十档 行情(目前只选择了 162411, 000002)
:1
请输入行情推送间隔(s)
:10
请输入 log 记录方式: 1: 显示在屏幕 2: 记录到指定文件
: 1
[2016-06-27 21:32:21.421482] DEBUG: xqtrader.py: login status: SUCCESS
[2016-06-27 21:32:21.467099] INFO: 测试: 启动主引擎
[2016-06-27 21:32:21.474106] INFO: 测试: 加载策略: 策略2_Demo
Traceback (most recent call last):
File "test.py", line 57, in
m.load_strategy()
File "/home/brian/py/easyquant/easyquant/main_engine.py", line 86, in load_strategy
self.strategy_list.append(strategy_class(log_handler=self.log, main_engine=self))
File "/home/brian/py/easyquant/easyquant/strategy/strategyTemplate.py", line 19, in init
self.init()
File "/home/brian/py/easyquant/strategies/策略1_Demo.py", line 16, in init
self.clock_engine.register_moment(clock_type, moment)
File "/home/brian/py/easyquant/easyquant/push_engine/clock_engine.py", line 233, in register_moment
return self._register_moment(clock_type, moment, makeup=markup)
NameError: name 'markup' is not defined

brian@ubuntu:~/py/easyquant$ python3 -m pip install markup
Requirement already satisfied (use --upgrade to upgrade): markup in /usr/local/lib/python3.5/dist-packages

重构 clock_engine

  • 需求
    1. 统一的 now 时间戳接口。
    2. 自定义系统时间,以便统一测试时的时间戳。
    3. 给策略提供时间事件注册的接口。
  • 问题
    1. clock_engine 是否唯一?
    2. 策略中如何获得 clock_engine 实例?

登录账号报错

环境:win7

import easytrader
user = easytrader.use('yh_client')
user.prepare(user='123456',password='678900')

报错:

Traceback (most recent call last):
File "", line 1, in
AttributeError: 'NoneType' object has no attribute 'prepare'

ClockMomentHandler 创建时设置next_time的问题

easyquant的engine在非交易日关闭后重新启动时,会出现ClockMomentHandler在下一个交易日的00:00:00执行买卖的问题。
是因为ClockMomentHandler的init函数在第一次设置下次运行时间next_time的时候,对于is_trading_date为True和False都用当天的日期来设置next_time,但是对于is_trading_date为True,是需要交易日才执行定时任务。
修改方式:在创建ClockMomentHandler时,在init函数中设置next_time的时候,如果engine重启当天是非交易日,取下一交易日的日期来设置next_time。
#70

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.