ciso8601 性能对比 datetime 默认库

python李魔佛 发表了文章 • 0 个评论 • 1053 次浏览 • 2022-07-22 12:04 • 来自相关话题

In [1]: import datetime, aniso8601, iso8601, isodate, dateutil.parser, arrow, ciso8601

In [2]: ds = u'2014-01-09T21:48:00.921000'

In [3]: %timeit ciso8601.parse_datetime(ds)
1000000 loops, best of 3: 204 ns per loop

In [4]: %timeit datetime.datetime.strptime(ds, "%Y-%m-%dT%H:%M:%S.%f")
100000 loops, best of 3: 15 µs per loop

In [5]: %timeit dateutil.parser.parse(ds)
10000 loops, best of 3: 122 µs per loop

In [6]: %timeit aniso8601.parse_datetime(ds)
10000 loops, best of 3: 28.9 µs per loop

In [7]: %timeit iso8601.parse_date(ds)
10000 loops, best of 3: 42 µs per loop

In [8]: %timeit isodate.parse_datetime(ds)
10000 loops, best of 3: 69.4 µs per loop

In [9]: %timeit arrow.get(ds).datetime
10000 loops, best of 3: 87 µs per loopIn [1]: import datetime, aniso8601, iso8601, isodate, dateutil.parser, arrow, ciso8601

In [2]: ds = u'2014-01-09T21:48:00.921000+05:30'

In [3]: %timeit ciso8601.parse_datetime(ds)
1000000 loops, best of 3: 525 ns per loop

In [4]: %timeit dateutil.parser.parse(ds)
10000 loops, best of 3: 162 µs per loop

In [5]: %timeit aniso8601.parse_datetime(ds)
10000 loops, best of 3: 36.8 µs per loop

In [6]: %timeit iso8601.parse_date(ds)
10000 loops, best of 3: 53.5 µs per loop

In [7]: %timeit isodate.parse_datetime(ds)
10000 loops, best of 3: 82.6 µs per loop

In [8]: %timeit arrow.get(ds).datetime
10000 loops, best of 3: 104 µs per loop
 

Even with time zone information, ciso8601 is 70x as fast as aniso8601.

Tested on Python 2.7.10 on macOS 10.12.6 using the following modules:

 
 
 ciso8601 是纳秒级别的,如果要对上千万的数据操作,建议使用ciso这个C库。
  查看全部
In [1]: import datetime, aniso8601, iso8601, isodate, dateutil.parser, arrow, ciso8601

In [2]: ds = u'2014-01-09T21:48:00.921000'

In [3]: %timeit ciso8601.parse_datetime(ds)
1000000 loops, best of 3: 204 ns per loop

In [4]: %timeit datetime.datetime.strptime(ds, "%Y-%m-%dT%H:%M:%S.%f")
100000 loops, best of 3: 15 µs per loop

In [5]: %timeit dateutil.parser.parse(ds)
10000 loops, best of 3: 122 µs per loop

In [6]: %timeit aniso8601.parse_datetime(ds)
10000 loops, best of 3: 28.9 µs per loop

In [7]: %timeit iso8601.parse_date(ds)
10000 loops, best of 3: 42 µs per loop

In [8]: %timeit isodate.parse_datetime(ds)
10000 loops, best of 3: 69.4 µs per loop

In [9]: %timeit arrow.get(ds).datetime
10000 loops, best of 3: 87 µs per loop
In [1]: import datetime, aniso8601, iso8601, isodate, dateutil.parser, arrow, ciso8601

In [2]: ds = u'2014-01-09T21:48:00.921000+05:30'

In [3]: %timeit ciso8601.parse_datetime(ds)
1000000 loops, best of 3: 525 ns per loop

In [4]: %timeit dateutil.parser.parse(ds)
10000 loops, best of 3: 162 µs per loop

In [5]: %timeit aniso8601.parse_datetime(ds)
10000 loops, best of 3: 36.8 µs per loop

In [6]: %timeit iso8601.parse_date(ds)
10000 loops, best of 3: 53.5 µs per loop

In [7]: %timeit isodate.parse_datetime(ds)
10000 loops, best of 3: 82.6 µs per loop

In [8]: %timeit arrow.get(ds).datetime
10000 loops, best of 3: 104 µs per loop

 


Even with time zone information, ciso8601 is 70x as fast as aniso8601.

Tested on Python 2.7.10 on macOS 10.12.6 using the following modules:


 
 
 ciso8601 是纳秒级别的,如果要对上千万的数据操作,建议使用ciso这个C库。
 

ubuntu 安装ciso8601库 失败, 已解决

Linux李魔佛 发表了文章 • 0 个评论 • 2295 次浏览 • 2022-07-22 12:01 • 来自相关话题

ubuntu20; ciso8601库是一个高性能的时间解析库,基于C底层写的。pip install ciso8601 报错 :  Collecting setuptools>=40.8.0
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/a4/53/bfc6409447ca024558b8b19d055de94c813c3e32c0296c48a0873a161cf5/setuptools-63.2.0-py3-none-any.whl
Downloading setuptools-63.2.0-py3-none-any.whl (1.2 MB)
━━━━╸ 0.1/1.2 MB 102.5 kB/s eta 0:00:11
ERROR: Exception:
Traceback (most recent call last):
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 435, in _error_catcher
yield
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 516, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/cachecontrol/filewrapper.py", line 90, in read
data = self.__fp.read(amt)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/http/client.py", line 462, in read
n = self.readinto(b)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/http/client.py", line 506, in readinto
n = self.fp.readinto(b)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/cli/req_command.py", line 205, in wrapper
return func(self, options, args)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/commands/install.py", line 341, in run
requirement_set = resolver.resolve(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
return bool(self._sequence)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
return any(self)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
candidate = func()
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/factory.py", line 215, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 291, in __init__
super().__init__(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 161, in __init__
self.dist = self._prepare()
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 230, in _prepare
dist = self._prepare_distribution()
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 302, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 428, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 473, in _prepare_linked_requirement
local_file = unpack_url(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 155, in unpack_url
file = get_http_url(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 96, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/network/download.py", line 146, in __call__
for chunk in chunks:
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/cli/progress_bars.py", line 53, in _rich_progress_bar
for chunk in iterable:
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/network/utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 573, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 538, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 440, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
 
 
看样子,是setuptool的问题。 为了避免动这个默认库,可以安装降级版本的ciso。
pip install ciso8601==1.0.7
 





  查看全部
ubuntu20; ciso8601库是一个高性能的时间解析库,基于C底层写的。pip install ciso8601 报错 : 
      Collecting setuptools>=40.8.0
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/a4/53/bfc6409447ca024558b8b19d055de94c813c3e32c0296c48a0873a161cf5/setuptools-63.2.0-py3-none-any.whl
Downloading setuptools-63.2.0-py3-none-any.whl (1.2 MB)
━━━━╸ 0.1/1.2 MB 102.5 kB/s eta 0:00:11
ERROR: Exception:
Traceback (most recent call last):
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 435, in _error_catcher
yield
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 516, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/cachecontrol/filewrapper.py", line 90, in read
data = self.__fp.read(amt)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/http/client.py", line 462, in read
n = self.readinto(b)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/http/client.py", line 506, in readinto
n = self.fp.readinto(b)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
status = run_func(*args)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/cli/req_command.py", line 205, in wrapper
return func(self, options, args)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/commands/install.py", line 341, in run
requirement_set = resolver.resolve(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 348, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
return bool(self._sequence)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
return any(self)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
candidate = func()
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/factory.py", line 215, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 291, in __init__
super().__init__(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 161, in __init__
self.dist = self._prepare()
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 230, in _prepare
dist = self._prepare_distribution()
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 302, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 428, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 473, in _prepare_linked_requirement
local_file = unpack_url(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 155, in unpack_url
file = get_http_url(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/operations/prepare.py", line 96, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/network/download.py", line 146, in __call__
for chunk in chunks:
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/cli/progress_bars.py", line 53, in _rich_progress_bar
for chunk in iterable:
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_internal/network/utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 573, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 538, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/tmp/pip-standalone-pip-oas0cddc/__env_pip__.zip/pip/_vendor/urllib3/response.py", line 440, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
 
 
看样子,是setuptool的问题。 为了避免动这个默认库,可以安装降级版本的ciso。
pip install ciso8601==1.0.7
 

20220722001.png

 

systemctl start influxdb 服务启动出错

数据库李魔佛 发表了文章 • 0 个评论 • 2245 次浏览 • 2022-07-21 19:12 • 来自相关话题

又是一次典型的csdn踩坑记。。。。。
csdn的原文内容:
https://blog.csdn.net/xiangjai/article/details/123718413







安装上面的配置走,ubuntu的influxdb一直无法启动。
 
只好一个一个选项的排除:
最后发现那个bind-address的问题:
 把端口哪行注释了,先用着。。。bolt-path = "/var/lib/influxdb/influxd.bolt"
engine-path = "/var/lib/influxdb/engine"
enable = true
#bind-address = ":8086" 查看全部
又是一次典型的csdn踩坑记。。。。。
csdn的原文内容:
https://blog.csdn.net/xiangjai/article/details/123718413


20220721002.png


安装上面的配置走,ubuntu的influxdb一直无法启动。
 
只好一个一个选项的排除:
最后发现那个bind-address的问题:
 把端口哪行注释了,先用着。。。
bolt-path = "/var/lib/influxdb/influxd.bolt"
engine-path = "/var/lib/influxdb/engine"
enable = true
#bind-address = ":8086"

influxdb 2.x和1.x 把api差也太多了吧。 基本不往上兼容

数据库李魔佛 发表了文章 • 0 个评论 • 2272 次浏览 • 2022-07-21 12:43 • 来自相关话题

最讨厌这一类api的。
 
网上信息凌乱。
 
导致很多人写技术内容的时候不会提前说明当前的influxdb的版本。
 
只能不断地试错。
 $ influx -precision rfc3339
Error: unknown shorthand flag: 'p' in -precision
See 'influx -h' for help没有一个命令对得上的。。
 
后续自己写个influxdb 2.x的教程吧,当做自己的学习笔记也好。
 
### 更新
刚在写,结果就发现 v2.3 以上的接口又有分叉。。。 真的是日狗了的






  查看全部
最讨厌这一类api的。
 
网上信息凌乱。
 
导致很多人写技术内容的时候不会提前说明当前的influxdb的版本。
 
只能不断地试错。
 
$ influx -precision rfc3339
Error: unknown shorthand flag: 'p' in -precision
See 'influx -h' for help
没有一个命令对得上的。。
 
后续自己写个influxdb 2.x的教程吧,当做自己的学习笔记也好。
 
### 更新
刚在写,结果就发现 v2.3 以上的接口又有分叉。。。 真的是日狗了的

20220721125727934.png


 

QMT模拟盘和实盘切换

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 2213 次浏览 • 2022-07-20 19:30 • 来自相关话题

模拟信号是指在模型交易里以模拟形式运行策略后,产生的委托为模拟信号,此时委托不会产生任务,
也不会发送至柜台,即python产生的委托会在客户端节点被截断。python发出的所有交易信号(下单、
撤单等)由此规则约束。
 
 
 



点击图片放大

使用QMT的客户端登录,在模型交易页面:
这个切换也比较简单,只要点击一下实盘,就可以马上切换。


欢迎关注公众号 查看全部
模拟信号是指在模型交易里以模拟形式运行策略后,产生的委托为模拟信号,此时委托不会产生任务,
也不会发送至柜台,即python产生的委托会在客户端节点被截断。python发出的所有交易信号(下单、
撤单等)由此规则约束。
 
 
 
20220720192827583.png

点击图片放大

使用QMT的客户端登录,在模型交易页面:
这个切换也比较简单,只要点击一下实盘,就可以马上切换。


欢迎关注公众号

qmt获取可转债历史tick行情数据

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 2721 次浏览 • 2022-07-20 19:18 • 来自相关话题

需要在mini qmt中获取历史tick,如果在qmt里面,只能获取到订阅行情的数据。
 
当然拿到数据后,它的tick数据是参差不齐的,虽然是L1的数据,当时有些时间间隔大于3s,而有些却可以小于3s。
 
所以可以对这些数据进行时间的重采样处理。 比如全部变为1s,或者变为3s,变为1分钟就没必要了。 因为获取行情本身就自带1m的数据参数。
 
result = df.resample('3S',).first().ffill()
dataframe重采样采用3秒的代码入行,而且要向前补全,因为某些时刻没有交易的话,它的价格还是上一档的价格。
 





 
最后处理的数据如上图所示。
  查看全部

20220720132706153.png

需要在mini qmt中获取历史tick,如果在qmt里面,只能获取到订阅行情的数据。
 
当然拿到数据后,它的tick数据是参差不齐的,虽然是L1的数据,当时有些时间间隔大于3s,而有些却可以小于3s。
 
所以可以对这些数据进行时间的重采样处理。 比如全部变为1s,或者变为3s,变为1分钟就没必要了。 因为获取行情本身就自带1m的数据参数。
 
result = df.resample('3S',).first().ffill()

dataframe重采样采用3秒的代码入行,而且要向前补全,因为某些时刻没有交易的话,它的价格还是上一档的价格。
 

20220720191743648.png

 
最后处理的数据如上图所示。
 

目前还有哪些券商可以万一免五 无门槛的?

券商万一免五绫波丽 发表了文章 • 0 个评论 • 1905 次浏览 • 2022-07-20 18:39 • 来自相关话题

年初监管放松了,多了几家万一免五的券商,到了年中,监管又严了起来,免五的又少了不少。
 
现在基本免五的都有入金门槛。 目前基本也没有不用入金的万一免五的券商了。
 
最低的万一免五的券商,入金2w,免五,最低0.1元。 可转债(新规后) 沪市十万分之五,深市十万分之五,最低0.1元。
基金万0.5,也是最低0.1元,算是非常厚道的了。
 
需要开通的可以微信联系,备注:开户;
 
 当然这里也有一些大券商可以免五,只不过入金门槛动不动就要20万,50万。 只需要入金2万的券商,不香吗?
 

 
  查看全部
年初监管放松了,多了几家万一免五的券商,到了年中,监管又严了起来,免五的又少了不少。
 
现在基本免五的都有入金门槛。 目前基本也没有不用入金的万一免五的券商了。
 
最低的万一免五的券商,入金2w,免五,最低0.1元。 可转债(新规后) 沪市十万分之五,深市十万分之五,最低0.1元。
基金万0.5,也是最低0.1元,算是非常厚道的了。
 
需要开通的可以微信联系,备注:开户;
 
 当然这里也有一些大券商可以免五,只不过入金门槛动不动就要20万,50万。 只需要入金2万的券商,不香吗?
 

 
 

查询自己平时用的最多的linux命令

Linux李魔佛 发表了文章 • 0 个评论 • 1074 次浏览 • 2022-07-18 23:55 • 来自相关话题

你平时使用最多的linux命令是什么呢?
 
可以用一行shell来统计
 
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
得到如下结果:





 
神奇吧。
 
上述语句主要对你的history 返回数据进行统计。 查看全部
你平时使用最多的linux命令是什么呢?
 
可以用一行shell来统计
 
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10

得到如下结果:

20220718002.png

 
神奇吧。
 
上述语句主要对你的history 返回数据进行统计。

docker安装的podman报错

Linux李魔佛 发表了文章 • 0 个评论 • 1649 次浏览 • 2022-07-17 18:29 • 来自相关话题

podman 报错
ERRO[0000] 'overlay' is not supported over overlayfs
Error: error creating libpod runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver
本来计划在docker里面安装一个docker,启动docker报错,
于是安装了一个podman,结果ps -a的时候报错。
 
唯一的办法,可能就是启动第一个docker的时候使用特权模式, privillage=True
  查看全部
podman 报错
ERRO[0000] 'overlay' is not supported over overlayfs    
Error: error creating libpod runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver

本来计划在docker里面安装一个docker,启动docker报错,
于是安装了一个podman,结果ps -a的时候报错。
 
唯一的办法,可能就是启动第一个docker的时候使用特权模式, privillage=True
 

映射端口 methodot 云主机 外部访问

Linux李魔佛 发表了文章 • 0 个评论 • 1470 次浏览 • 2022-07-17 02:36 • 来自相关话题

默认情况下,methodot提供的免费云主机  固定了几个端口给外部访问:





 
如果我们做了web,要怎么映射出来呢?
 
很简单,只要把web端口改为8001 - 8005 之中的一个。
然后用上面表格中对应的端口映射来访问就可以了
 
比如下面的flask代码:
 
from flask import Flask, jsonify

# 最基本的测试

app =Flask(__name__)


@app.route('/about')
def about():
return 'this is about page'

@app.route('/404')
def error_handle():
return '404 error'

@app.route('/')
def error_handle():
return jsonify({'code':100})



if __name__=='__main__':
app.run(host='0.0.0.0',port=8001,debug=True)


 因为8001映射出去的端口是 33442,
 
所以你可以在浏览器访问你的主机:
curl http://xxxxxxxxxxxxx.methodot.com:33442/
 
话说,之前以为这个主机随时提桶跑路的,不过用到现在还好。
每一个应用都是一个docker镜像。 所以你的linux系统是无法使用 systemctl 控制服务启动的。
会包权限不够。 查看全部
默认情况下,methodot提供的免费云主机  固定了几个端口给外部访问:

20220717001.png

 
如果我们做了web,要怎么映射出来呢?
 
很简单,只要把web端口改为8001 - 8005 之中的一个。
然后用上面表格中对应的端口映射来访问就可以了
 
比如下面的flask代码:
 
from flask import Flask, jsonify

# 最基本的测试

app =Flask(__name__)


@app.route('/about')
def about():
return 'this is about page'

@app.route('/404')
def error_handle():
return '404 error'

@app.route('/')
def error_handle():
return jsonify({'code':100})



if __name__=='__main__':
app.run(host='0.0.0.0',port=8001,debug=True)


 因为8001映射出去的端口是 33442,
 
所以你可以在浏览器访问你的主机:
curl http://xxxxxxxxxxxxx.methodot.com:33442/
 
话说,之前以为这个主机随时提桶跑路的,不过用到现在还好。
每一个应用都是一个docker镜像。 所以你的linux系统是无法使用 systemctl 控制服务启动的。
会包权限不够。

国金QMT开户

券商万一免五海螺复盘 发表了文章 • 0 个评论 • 4323 次浏览 • 2022-07-15 16:42 • 来自相关话题

目前个人可知的QMT开户门槛最低,1W即可。 QMT支持股票,可转债,基金ETF,逆回购品种。
 

 
 
QMT本地运行python,支持本地pip安装第三库。
可以访问本地或者远程数据库。
 
国金的QMT支持云服务器部署。相比其他券商是一大优势。
且佣金低。
 
需要咨询了解的朋友可以加微信了解与开通: 记得备注 (低门槛QMT),否则没有低门槛开量化
  查看全部
目前个人可知的QMT开户门槛最低,1W即可。 QMT支持股票,可转债,基金ETF,逆回购品种。
 

 
 
QMT本地运行python,支持本地pip安装第三库。
可以访问本地或者远程数据库。
 
国金的QMT支持云服务器部署。相比其他券商是一大优势。
且佣金低。
 
需要咨询了解的朋友可以加微信了解与开通: 记得备注 (低门槛QMT),否则没有低门槛开量化
 

vmware player Unable to install all modules. See log for details

Linux李魔佛 发表了文章 • 0 个评论 • 1861 次浏览 • 2022-07-15 13:55 • 来自相关话题

Vmware player

Unable to install all modules. See log for details

ubuntu下的vmware play经常会让更新模块。一起点击确认就可以正常编译更新。

而且一定要编译后才能打开虚拟机系统

但是奇怪的是,最近一次点击 更新,报错:

显示的英文错误信息:

Unable to install all modules. See log for details

看了日志:

     26 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
25 2022-07-15T02:15:09.595Z In(05) host-7426 372 | _Static_assert(e, #e); \
24 2022-07-15T02:15:09.595Z In(05) host-7426 | ^
23 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/./include/vm_asm_x86.h:215:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
22 2022-07-15T02:15:09.595Z In(05) host-7426 215 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
21 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/./include/vm_asm_x86.h:227:22: note: in expansion of macro ‘SET_SEGREG’
19 2022-07-15T02:15:09.595Z In(05) host-7426 227 | #define SET_GS(expr) SET_SEGREG(gs, expr)
18 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~~~~~~~
17 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/common/task.c:2726:10: note: in expansion of macro ‘SET_GS’
16 2022-07-15T02:15:09.595Z In(05) host-7426 2726 | SET_GS(gs);
15 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~~~
14 2022-07-15T02:15:09.595Z In(05) host-7426 make[2]: *** [scripts/Makefile.build:285: /tmp/modconfig-PB4afO/vmmon-only/common/task.o] Error 1
13 2022-07-15T02:15:09.595Z In(05) host-7426 make[2]: *** Waiting for unfinished jobs....
12 2022-07-15T02:15:09.595Z In(05) host-7426 make[1]: *** [Makefile:1875: /tmp/modconfig-PB4afO/vmmon-only] Error 2
11 2022-07-15T02:15:09.595Z In(05) host-7426 make: *** [Makefile:117: vmmon.ko] Error 2
10 2022-07-15T02:15:09.595Z In(05) host-7426 Using kernel build system.
9 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmnet-only/driver.c: In function ‘VNetFileOpUnlockedIoctl’:
8 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmnet-only/driver.c:966:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
7 2022-07-15T02:15:09.595Z In(05) host-7426 966 | {
6 2022-07-15T02:15:09.595Z In(05) host-7426 | ^
5 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmnet-only/driver.c:976:4: note: here
4 2022-07-15T02:15:09.595Z In(05) host-7426 976 | case SIOCGETAPIVERSION:
3 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~
2 2022-07-15T02:15:09.595Z In(05) host-7426 Skipping BTF generation for /tmp/modconfig-PB4afO/vmnet-only/vmnet.ko due to unavailability of vmlinux
1 2022-07-15T02:15:09.595Z In(05) host-7426 Unable to install all modules. See log for details.


报错信息在这里:

  host-7426 Skipping BTF generation for /tmp/modconfig-PB4afO/vmnet-only/vmnet.ko due to unavailability of vmlinux

host-7426 Unable to install all modules. See log for details
    
遇到问题后就google一番。

果然还是老外大神多。

翻了一个解决方案后,终于找到一个可行的。【所以必须的英语水平还是要的】

可行的方案:

去github下载最新的host-modules

https://github.com/mkubecek/vmware-host-modules


下载一个最新的。

然后解压:unzip w16.2.3-k5.17.zip

得到以下文件 INSTALL
LICENSE
Makefile
README
vmmon-only
vmnet-only
然后我们打包两个文件夹 vmmon-only
vmnet-only tar -cf vmmon.tar vmmon-only
tar -cf vmnet.tar vmnet-only

这时,文件夹下多了2个tar的文件,vmmon.tar和vmnet.tar

然后拷贝到 目录:

/usr/lib/vmware.modules.source
 sudo cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/

之后可以直接编译:
sudo vmware-modconfig --console --install-all

安装完成之后,再次打开vmware player就可以看到:


这样就是成功了。 查看全部
Vmware player

Unable to install all modules. See log for details

ubuntu下的vmware play经常会让更新模块。一起点击确认就可以正常编译更新。

而且一定要编译后才能打开虚拟机系统

但是奇怪的是,最近一次点击 更新,报错:

显示的英文错误信息:

Unable to install all modules. See log for details

看了日志:

    
 26 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/./include/vm_assert.h:372:22: note: in definition of macro ‘ASSERT_ON_COMPILE’
25 2022-07-15T02:15:09.595Z In(05) host-7426 372 | _Static_assert(e, #e); \
24 2022-07-15T02:15:09.595Z In(05) host-7426 | ^
23 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/./include/vm_asm_x86.h:215:7: note: in expansion of macro ‘ASSERT_ON_COMPILE_SELECTOR_SIZE’
22 2022-07-15T02:15:09.595Z In(05) host-7426 215 | ASSERT_ON_COMPILE_SELECTOR_SIZE(expr); \
21 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/./include/vm_asm_x86.h:227:22: note: in expansion of macro ‘SET_SEGREG’
19 2022-07-15T02:15:09.595Z In(05) host-7426 227 | #define SET_GS(expr) SET_SEGREG(gs, expr)
18 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~~~~~~~
17 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmmon-only/common/task.c:2726:10: note: in expansion of macro ‘SET_GS’
16 2022-07-15T02:15:09.595Z In(05) host-7426 2726 | SET_GS(gs);
15 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~~~
14 2022-07-15T02:15:09.595Z In(05) host-7426 make[2]: *** [scripts/Makefile.build:285: /tmp/modconfig-PB4afO/vmmon-only/common/task.o] Error 1
13 2022-07-15T02:15:09.595Z In(05) host-7426 make[2]: *** Waiting for unfinished jobs....
12 2022-07-15T02:15:09.595Z In(05) host-7426 make[1]: *** [Makefile:1875: /tmp/modconfig-PB4afO/vmmon-only] Error 2
11 2022-07-15T02:15:09.595Z In(05) host-7426 make: *** [Makefile:117: vmmon.ko] Error 2
10 2022-07-15T02:15:09.595Z In(05) host-7426 Using kernel build system.
9 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmnet-only/driver.c: In function ‘VNetFileOpUnlockedIoctl’:
8 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmnet-only/driver.c:966:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
7 2022-07-15T02:15:09.595Z In(05) host-7426 966 | {
6 2022-07-15T02:15:09.595Z In(05) host-7426 | ^
5 2022-07-15T02:15:09.595Z In(05) host-7426 /tmp/modconfig-PB4afO/vmnet-only/driver.c:976:4: note: here
4 2022-07-15T02:15:09.595Z In(05) host-7426 976 | case SIOCGETAPIVERSION:
3 2022-07-15T02:15:09.595Z In(05) host-7426 | ^~~~
2 2022-07-15T02:15:09.595Z In(05) host-7426 Skipping BTF generation for /tmp/modconfig-PB4afO/vmnet-only/vmnet.ko due to unavailability of vmlinux
1 2022-07-15T02:15:09.595Z In(05) host-7426 Unable to install all modules. See log for details.



报错信息在这里:

 
   host-7426 Skipping BTF generation for /tmp/modconfig-PB4afO/vmnet-only/vmnet.ko due to unavailability of vmlinux

host-7426 Unable to install all modules. See log for details

    
遇到问题后就google一番。

果然还是老外大神多。

翻了一个解决方案后,终于找到一个可行的。【所以必须的英语水平还是要的】

可行的方案

去github下载最新的host-modules

https://github.com/mkubecek/vmware-host-modules


下载一个最新的。

然后解压:
unzip w16.2.3-k5.17.zip


得到以下文件
    INSTALL  
LICENSE
Makefile
README
vmmon-only
vmnet-only

然后我们打包两个文件夹 
vmmon-only    
vmnet-only
    tar -cf vmmon.tar vmmon-only
tar -cf vmnet.tar vmnet-only


这时,文件夹下多了2个tar的文件,vmmon.tar和vmnet.tar

然后拷贝到 目录:

/usr/lib/vmware.modules.source
 
sudo cp -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/


之后可以直接编译:
sudo vmware-modconfig --console --install-all


安装完成之后,再次打开vmware player就可以看到:


这样就是成功了。

linux监控shell进程是否运行,不运行的时候自动启动

Linux李魔佛 发表了文章 • 0 个评论 • 1264 次浏览 • 2022-07-13 00:17 • 来自相关话题

脚本很简单。
 保存为monitor.sh
#!/bin/bash
line=$(ps -aux | grep -c /usr/sbin/ssh | grep -v "grep")
# 匹配的行数
if [ $line -eq 1 ];
then
sudo /etc/init.d/ssh restart
# 重启ssh服务
else
echo ssh is running....
# 向日志发送邮件,显示ssh运行中。。。
fi
给个执行权限
chmod +x monitor.sh
 
然后设置定时任务,
比如隔5分钟运行一次上面的脚本
 
*/5 * * * * monitor.sh
 
  查看全部
脚本很简单。
 保存为monitor.sh
#!/bin/bash
line=$(ps -aux | grep -c /usr/sbin/ssh | grep -v "grep")
# 匹配的行数
if [ $line -eq 1 ];
then
sudo /etc/init.d/ssh restart
# 重启ssh服务
else
echo ssh is running....
# 向日志发送邮件,显示ssh运行中。。。
fi

给个执行权限
chmod +x monitor.sh
 
然后设置定时任务,
比如隔5分钟运行一次上面的脚本
 
*/5 * * * * monitor.sh
 
 

国信证券 可转债费率 支持iquant (QMT) 开通 支持Level2数据

券商万一免五海螺复盘 发表了文章 • 0 个评论 • 4977 次浏览 • 2022-07-11 19:02 • 来自相关话题

国信证券可转债费率






 国信证券支持iquant量化软件, 累计交易额达15w可开通,股票可以万一免五(免五有资金门槛)。
例:场内基金ETF 每次交易4万,累计4次交易即可开通 iQuant

可转债费率最为 深十万分之五,沪 十万分之五;


国信证券可以开通iquant(根据qmt做了一定的改动)。
 
 
iquant支持Level2的数据
 





 










 
 


















国信证券的开通门槛比国盛,国金要低,不过费率要高一些,但它数据支持level2,是一个很大的优势 。
 入金2w 即可开通国信 量化

需要的朋友可以咨询:备注 开户
 


 
 
  查看全部
国信证券可转债费率

7b95ffda7cfa6c54e89c7919d57564ec.jpeg


 国信证券支持iquant量化软件, 累计交易额达15w可开通,股票可以万一免五(免五有资金门槛)。
例:场内基金ETF 每次交易4万,累计4次交易即可开通 iQuant

可转债费率最为 深十万分之五,沪 十万分之五;


国信证券可以开通iquant(根据qmt做了一定的改动)。
 
 
iquant支持Level2的数据
 

mmexport1657537046201.jpg

 

mmexport1657537051844.jpg


mmexport1657537040857.jpg

 
 
mmexport1657537534426.png



mmexport1657537527875.png



mmexport1657537522780.png



国信证券的开通门槛比国盛,国金要低,不过费率要高一些,但它数据支持level2,是一个很大的优势 。
 入金2w 即可开通国信 量化

需要的朋友可以咨询:备注 开户
 


 
 
 

批量修改wordpress文章中的所有的链接

网络马化云 发表了文章 • 0 个评论 • 1437 次浏览 • 2022-07-11 17:50 • 来自相关话题

有时候你的文章中,某个地方的引用的链接失效了。需要你去替换一个新的链接。
 
假如只有2,3篇文章需要修改,那么就很简单,进入wordpress的后台进行修改。
 
但如果动辄几十篇,甚至上百上千篇文章,手动修改就工作量太大了,且容易出错。
 
那么可以选择后台数据库直接修改。
 
1. 先备份一下数据库,以防操作失误导致数据丢失。
 
2.  打开数据库软件,比如navicat
 
找到wp_post 这个表
 
运行下面的命令:
UPDATE wp_posts set post_content = REPLACE(post_content,"crop.png","hxxy-resize.png") where post_content like '%crop.png%';

上面的sql命令就是把crop.png 的图片改为 resize.png 的图片的mysql命令。
 
修改万后,刷新一下缓存就可以了。 查看全部
有时候你的文章中,某个地方的引用的链接失效了。需要你去替换一个新的链接。
 
假如只有2,3篇文章需要修改,那么就很简单,进入wordpress的后台进行修改。
 
但如果动辄几十篇,甚至上百上千篇文章,手动修改就工作量太大了,且容易出错。
 
那么可以选择后台数据库直接修改。
 
1. 先备份一下数据库,以防操作失误导致数据丢失。
 
2.  打开数据库软件,比如navicat
 
找到wp_post 这个表
 
运行下面的命令:
UPDATE wp_posts set post_content = REPLACE(post_content,"crop.png","hxxy-resize.png") where post_content like '%crop.png%';

上面的sql命令就是把crop.png 的图片改为 resize.png 的图片的mysql命令。
 
修改万后,刷新一下缓存就可以了。

ptrade的run_interval定时执行或者handle_data周期运行

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 1461 次浏览 • 2022-07-11 11:04 • 来自相关话题

在这几个函数里面打上标识,输出线程名字。





 
可以知道,他们是通过多线程触发的。 每一次运行的线程名字都不一样。
所以在里面操作一些共享变量的时候,最好加锁操作。
 
比如:
def query_offset(self,start,count):
sqlite_str = 'select code,open,current from {} limit {},{}'.format(self.table_name,start,count)
cursor = self.db.cursor()
with lock:
try:
cursor.execute(sqlite_str)
except Exception as e:
log.info(e)
self.db.rollback()
else:
return cursor.fetchall() 查看全部
在这几个函数里面打上标识,输出线程名字。

20220711001.png

 
可以知道,他们是通过多线程触发的。 每一次运行的线程名字都不一样。
所以在里面操作一些共享变量的时候,最好加锁操作。
 
比如:
    def query_offset(self,start,count):
sqlite_str = 'select code,open,current from {} limit {},{}'.format(self.table_name,start,count)
cursor = self.db.cursor()
with lock:
try:
cursor.execute(sqlite_str)
except Exception as e:
log.info(e)
self.db.rollback()
else:
return cursor.fetchall()

aria2c 不能下载https的文件

Linux李魔佛 发表了文章 • 0 个评论 • 3748 次浏览 • 2022-07-10 11:07 • 来自相关话题

下载命令:
aria2c https:// openresty.org/download/openresty-1.21.4.1-win64.zip$ aria2c
https: //openresty.org/download/openresty-1.21.4.1-win64.zip


07/10 10:58:58 [NOTICE] Downloading 1 item(s)

07/10 10:58:58 [ERROR] CUID#7 - Download aborted. URI=https: //openresty.org/download/openresty-1.21.4.1-win64.zip
Exception: [AbstractCommand.cc:351] errorCode=1 URI=https: //openresty.org/download/openresty-1.21.4.1-win64.zip
-> [InitiateConnectionCommandFactory.cc:87] errorCode=1 https is not supported yet.

07/10 10:58:58 [NOTICE] Download GID#b9bc95619990e7e4 not complete:

Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
b9bc95|ERR | n/a|
https: //openresty.org/download/openresty-1.21.4.1-win64.zip


http: //openresty.org/download/openresty-1.21.4.1-win64.zip

Status Legend:
(ERR):error occurred.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.





只要把https改为http就可以了。(前提是完整没有把http跳转到https)
aria2 http: //openresty.org/download/openresty-1.21.4.1-win64.zip
 
不过这个办法不是长久之计,要解决这个问题,需要你重新编译ariac2, 编译的时候添加 ssl参数就可以啦
 
进入ariac2的源码目录:./configure --with-openssl接着:make && sudo make install然后就可以啦
  查看全部
下载命令:
aria2c https:// openresty.org/download/openresty-1.21.4.1-win64.zip
$ aria2c 
https: //openresty.org/download/openresty-1.21.4.1-win64.zip


07/10 10:58:58 [NOTICE] Downloading 1 item(s)

07/10 10:58:58 [ERROR] CUID#7 - Download aborted. URI=https: //openresty.org/download/openresty-1.21.4.1-win64.zip
Exception: [AbstractCommand.cc:351] errorCode=1 URI=https: //openresty.org/download/openresty-1.21.4.1-win64.zip
-> [InitiateConnectionCommandFactory.cc:87] errorCode=1 https is not supported yet.

07/10 10:58:58 [NOTICE] Download GID#b9bc95619990e7e4 not complete:

Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
b9bc95|ERR | n/a|
https: //openresty.org/download/openresty-1.21.4.1-win64.zip


http: //openresty.org/download/openresty-1.21.4.1-win64.zip

Status Legend:
(ERR):error occurred.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.





只要把https改为http就可以了。(前提是完整没有把http跳转到https)
aria2 http: //openresty.org/download/openresty-1.21.4.1-win64.zip
 
不过这个办法不是长久之计,要解决这个问题,需要你重新编译ariac2, 编译的时候添加 ssl参数就可以啦
 
进入ariac2的源码目录:
./configure --with-openssl
接着:
make && sudo make install
然后就可以啦
 

python sqlite3 多线程 批量写入 【代码】

python李魔佛 发表了文章 • 0 个评论 • 2794 次浏览 • 2022-07-09 18:55 • 来自相关话题

1. 随机生成一个数组数据
2. 在多线程里面批量插入数据
 
几个关注点:
sqlite3.connect(_type, check_same_thread=False) 要设置为False
 
批量写的时候,记得要加锁
 
 import datetime
import random
import sqlite3
import threading
import logging as log
import time

lock = threading.Lock()
class SQLiteDBCls:

def __init__(self, cache=True):
_type = ":memory:"

self.db = sqlite3.connect(_type, check_same_thread=False)

self.table_name = 'tick_data'

def create_index(self):

cmd = 'CREATE INDEX code_ix ON {} (current)'.format(self.table_name)
with lock:
try:

cursor = self.db.cursor()
cursor.execute(cmd)
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def create_table(self):
# cursor = self.db.cursor()
cmd = 'create table if not exists {} (id INTEGER PRIMARY KEY AUTOINCREMENT,code text,open double,current time)'.format(
self.table_name)
with lock:
try:
cursor = self.db.cursor()
cursor.execute(cmd)
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def add(self, code, price, t):
cmd = 'insert into {} (code,open,current) values (?,?,?);'.format(self.table_name)
with lock:
try:
cursor = self.db.cursor()
cursor.execute(cmd, (code, price, t))
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def batch_add(self, data):

# 批量加入
print('===========',threading.current_thread().getName())
# log.info(threading.current_thread().getName())
cmd = 'insert into {} (code,open,current) values (?,?,?)'.format(self.table_name)
with lock:
try:
cursor = self.db.cursor()
cursor.executemany(cmd, data)
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def result(self):
cmd = 'select count(*) from `{}`'.format(self.table_name)

with lock:

try:
cursor = self.db.cursor()
cursor.execute(cmd)
except Exception as e:
log.info(e)
self.db.rollback()
else:
return cursor.fetchone()


def data_gen():
minute = 6000
code = ['123011.SS','110010.SS','112111.SS']
for i in range(minute):
current = (datetime.datetime.now()+datetime.timedelta(minutes=i)).strftime('%H:%M:%D')
data_list =
for c in code:
price = 5+random.random()+120
data = (c,price,current)
data_list.append(data)
yield data_list
# time.sleep(0.5)

app = SQLiteDBCls(cache=True)
app.create_table()
app.create_index()

def data_validation():
print(app.result())
app.sync_up()

def multithread_mode():
total_count = 0
thread_list =
for d in data_gen():
print(d)
total_count+=len(d)
# app.batch_add(d)
t=threading.Thread(target=app.batch_add,args=(d,))
thread_list.append(t)
for t in thread_list:
t.start()

for t in thread_list:
t.join()

print(total_count)


if __name__=='__main__':
multithread_mode()
data_validation()



 假如不加锁会出错:
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/home/xda/github/stock_strategy/sqlite_issue_debug.py", line 77, in batch_add
self.db.commit()
Exception in thread Thread-3824:
Exception in thread Thread-3826:
Traceback (most recent call last):
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/threading.py", line 973, in _bootstrap_inner
sqlite3.OperationalError: cannot commit - no transaction is activeTraceback (most recent call last):
File "/home/xda/github/stock_strategy/sqlite_issue_debug.py", line 72, in batch_add

cursor.executemany(cmd, data)
sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.
  查看全部
1. 随机生成一个数组数据
2. 在多线程里面批量插入数据
 
几个关注点:
sqlite3.connect(_type, check_same_thread=False) 要设置为False
 
批量写的时候,记得要加锁
 
 
import datetime
import random
import sqlite3
import threading
import logging as log
import time

lock = threading.Lock()
class SQLiteDBCls:

def __init__(self, cache=True):
_type = ":memory:"

self.db = sqlite3.connect(_type, check_same_thread=False)

self.table_name = 'tick_data'

def create_index(self):

cmd = 'CREATE INDEX code_ix ON {} (current)'.format(self.table_name)
with lock:
try:

cursor = self.db.cursor()
cursor.execute(cmd)
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def create_table(self):
# cursor = self.db.cursor()
cmd = 'create table if not exists {} (id INTEGER PRIMARY KEY AUTOINCREMENT,code text,open double,current time)'.format(
self.table_name)
with lock:
try:
cursor = self.db.cursor()
cursor.execute(cmd)
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def add(self, code, price, t):
cmd = 'insert into {} (code,open,current) values (?,?,?);'.format(self.table_name)
with lock:
try:
cursor = self.db.cursor()
cursor.execute(cmd, (code, price, t))
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def batch_add(self, data):

# 批量加入
print('===========',threading.current_thread().getName())
# log.info(threading.current_thread().getName())
cmd = 'insert into {} (code,open,current) values (?,?,?)'.format(self.table_name)
with lock:
try:
cursor = self.db.cursor()
cursor.executemany(cmd, data)
except Exception as e:
log.info(e)
self.db.rollback()
else:
self.db.commit()

def result(self):
cmd = 'select count(*) from `{}`'.format(self.table_name)

with lock:

try:
cursor = self.db.cursor()
cursor.execute(cmd)
except Exception as e:
log.info(e)
self.db.rollback()
else:
return cursor.fetchone()


def data_gen():
minute = 6000
code = ['123011.SS','110010.SS','112111.SS']
for i in range(minute):
current = (datetime.datetime.now()+datetime.timedelta(minutes=i)).strftime('%H:%M:%D')
data_list =
for c in code:
price = 5+random.random()+120
data = (c,price,current)
data_list.append(data)
yield data_list
# time.sleep(0.5)

app = SQLiteDBCls(cache=True)
app.create_table()
app.create_index()

def data_validation():
print(app.result())
app.sync_up()

def multithread_mode():
total_count = 0
thread_list =
for d in data_gen():
print(d)
total_count+=len(d)
# app.batch_add(d)
t=threading.Thread(target=app.batch_add,args=(d,))
thread_list.append(t)
for t in thread_list:
t.start()

for t in thread_list:
t.join()

print(total_count)


if __name__=='__main__':
multithread_mode()
data_validation()



 假如不加锁会出错:
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/home/xda/github/stock_strategy/sqlite_issue_debug.py", line 77, in batch_add
self.db.commit()
Exception in thread Thread-3824:
Exception in thread Thread-3826:
Traceback (most recent call last):
File "/home/xda/miniconda3/envs/cpy/lib/python3.9/threading.py", line 973, in _bootstrap_inner
sqlite3.OperationalError: cannot commit - no transaction is activeTraceback (most recent call last):
File "/home/xda/github/stock_strategy/sqlite_issue_debug.py", line 72, in batch_add

cursor.executemany(cmd, data)
sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

 

低门槛开通量化交易接口Ptrade QMT (入金1万即可,AA级大券商)

券商万一免五海螺复盘 发表了文章 • 0 个评论 • 5633 次浏览 • 2022-07-06 00:24 • 来自相关话题

(如果按证监会对证券公司的分类结果,(98家券商中,AA级只有15家,没有AAA级),算是头部券商,具备一定的实力)
 
该券商为AA级券商,GJ证券,腾讯入股的A股券商
 
该券商营业部最近对量化交易软件推广期,对开通门槛做了大幅降低, 目前只需要入金1W,既可以开通量化交易接口与软件,有Ptrade和QMT两个。 二者支持python语言编写策略,支持tick,分钟线,日线,等级别的实盘交易。
 

点击查看大图
 
Ptrade为云端部署,QMT为本地部署(你的策略只会放着本地,使用本地python运行)
 





 点击查看大图

该QMT支持虚拟机内运行,也就是可以在云主机(腾讯云,阿里云这些服务器上)运行。
 
QMT





点击查看大图

 
目前开通门槛低,时间有限,需要的朋友抓紧时间开通,过了这个时间就没有下次机会了。
 
交易费率: 量化没有流量费。(针对该营业部开户用户)
 
股票万一
可转债(新规) 沪:十万分之四点四,深:十万分之四
基金:万0.5
 没有流量费

需要的朋友可以加微信咨询开通:备注  一万量化开户  (否则不通过或者没有低门槛介绍)
  查看全部
(如果按证监会对证券公司的分类结果,(98家券商中,AA级只有15家,没有AAA级),算是头部券商,具备一定的实力)
 
该券商为AA级券商,GJ证券,腾讯入股的A股券商
 
该券商营业部最近对量化交易软件推广期,对开通门槛做了大幅降低, 目前只需要入金1W,既可以开通量化交易接口与软件,有Ptrade和QMT两个。 二者支持python语言编写策略,支持tick,分钟线,日线,等级别的实盘交易。
 

点击查看大图
 
Ptrade为云端部署,QMT为本地部署(你的策略只会放着本地,使用本地python运行)
 

20220706001.png

 点击查看大图

该QMT支持虚拟机内运行,也就是可以在云主机(腾讯云,阿里云这些服务器上)运行。
 
QMT

20220928003.jpg

点击查看大图

 
目前开通门槛低,时间有限,需要的朋友抓紧时间开通,过了这个时间就没有下次机会了。
 
交易费率: 量化没有流量费。(针对该营业部开户用户)
 
股票万一
可转债(新规) 沪:十万分之四点四,深:十万分之四
基金:万0.5
 没有流量费

需要的朋友可以加微信咨询开通:备注  一万量化开户  (否则不通过或者没有低门槛介绍)
 

重启ptrade策略会重新载入修改的代码吗?

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 1065 次浏览 • 2022-07-05 11:06 • 来自相关话题

会的。





这个是方便你修改了代码,不用重新新建策略,重启一下,原来旧代码就会被覆盖的。
会的。

20220705001.png

这个是方便你修改了代码,不用重新新建策略,重启一下,原来旧代码就会被覆盖的。

雪球上卖号的大V 集合【合适新人拉黑的伪大V】 定期更新

股票绫波丽 发表了文章 • 0 个评论 • 1278 次浏览 • 2022-07-04 11:43 • 来自相关话题

排名不分先后: 【可能部分已经被雪球销号了】
 
小七滚雪球






没啥干货,一堆广告,喜欢拉黑别人。 伪大v的一大特点就是喜欢拉黑别人。
 
--------------------------------
 
释老毛 【已被雪球禁言】





 
 
 
 
 
  查看全部
排名不分先后: 【可能部分已经被雪球销号了】
 
小七滚雪球

20220704114001602.png


没啥干货,一堆广告,喜欢拉黑别人。 伪大v的一大特点就是喜欢拉黑别人。
 
--------------------------------
 
释老毛 【已被雪球禁言】

20220704114302425.png

 
 
 
 
 
 

qmt的升级有点拉胯,居然不能一次到位?

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 1158 次浏览 • 2022-07-04 10:37 • 来自相关话题

最近有点时间没等qmt,登录的时候提示有更新,当前版本是v25(举例说明),
好的,点击确认,显示下载,即将更新到的版本为v26 , 等待几分钟后,更新完毕,需要自己重启。
 
结果重启后,提示系统需要更新,要更新到v27,什么? 居然现在还要这样迭代更新?





 
终于更新了2次之后,登录上系统了。
  查看全部
最近有点时间没等qmt,登录的时候提示有更新,当前版本是v25(举例说明),
好的,点击确认,显示下载,即将更新到的版本为v26 , 等待几分钟后,更新完毕,需要自己重启。
 
结果重启后,提示系统需要更新,要更新到v27,什么? 居然现在还要这样迭代更新?

20220704103350573.png

 
终于更新了2次之后,登录上系统了。
 

可转债ETF T+0操作,0费率

券商万一免五绫波丽 发表了文章 • 0 个评论 • 1959 次浏览 • 2022-07-04 00:19 • 来自相关话题

可转债ETF属于支持参内日内交易的场内ETF基金,且部分券商可以支持0佣金,也就是你可以无限制地的0摩擦做T。





 

当然,这个很看券商,不一定每一个券商都支持0费率。 
 
因为手上有不少券商经理朋友,逐个咨询后也得到了一些清单,哪些券商可以可转债etf0费率,哪些不行。
 
需要手续费的券商:
华宝证券
东方证券
 
 
 
帖子持续更新。。
 
  查看全部
可转债ETF属于支持参内日内交易的场内ETF基金,且部分券商可以支持0佣金,也就是你可以无限制地的0摩擦做T。

20220704001.png

 

当然,这个很看券商,不一定每一个券商都支持0费率。 
 
因为手上有不少券商经理朋友,逐个咨询后也得到了一些清单,哪些券商可以可转债etf0费率,哪些不行。
 
需要手续费的券商:
华宝证券
东方证券
 
 
 
帖子持续更新。。
 
 

ptrade用的python版本?

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 1284 次浏览 • 2022-06-25 17:58 • 来自相关话题

没法导入sys
 
而print的f-string也是无法导入的,导入报错,而f-string是从python3.6引入的。
所以ptrade内置的 python版本是低于3.6的,所以一些关键字async 也是无法使用的,
  查看全部

20220625003.png

没法导入sys
 
而print的f-string也是无法导入的,导入报错,而f-string是从python3.6引入的。
所以ptrade内置的 python版本是低于3.6的,所以一些关键字async 也是无法使用的,
 

获取可转债历史分时tick数据 【python】

可转债李魔佛 发表了文章 • 0 个评论 • 2658 次浏览 • 2022-06-25 12:29 • 来自相关话题

可转债的历史分时tick数据,基本在很多大平台,优矿,聚宽,米宽等平台都没有提供。
 
对于想做日内回测的朋友,是一件很痛苦的事情。
 
那么,接下来,本文结束一种通过第三方平台的数据,来把可转债的分时tick数据获取下来,并保存到本地数据库。
 





 
2022-07-05 更新:

如果直接拿历史数据,可以拿到1分钟级别的数据,如上图所示。
 
如果要拿秒级别的,需要实时采集。
 
笔者使用sqlite做为内存缓存,盘后统一入到mysql中。






如果盘中每隔3秒使用mysql储存,显然会造成不必要的io阻塞(开个线程存数据也是一个方案)。
 
使用sqlite的时候,设置为memeory模式,速度比存文件要快很多倍。
 
 
待续 查看全部
可转债的历史分时tick数据,基本在很多大平台,优矿,聚宽,米宽等平台都没有提供。
 
对于想做日内回测的朋友,是一件很痛苦的事情。
 
那么,接下来,本文结束一种通过第三方平台的数据,来把可转债的分时tick数据获取下来,并保存到本地数据库。
 

20220625001.png

 
2022-07-05 更新:

如果直接拿历史数据,可以拿到1分钟级别的数据,如上图所示。
 
如果要拿秒级别的,需要实时采集。
 
笔者使用sqlite做为内存缓存,盘后统一入到mysql中。

20220705002.png


如果盘中每隔3秒使用mysql储存,显然会造成不必要的io阻塞(开个线程存数据也是一个方案)。
 
使用sqlite的时候,设置为memeory模式,速度比存文件要快很多倍。
 
 
待续

最近几天的有道云笔记保存的笔记全部丢失了

Linux李魔佛 发表了文章 • 0 个评论 • 1399 次浏览 • 2022-06-21 09:46 • 来自相关话题

狗日了。网易越来越拉跨了。
 
最近几天记录了几篇笔记,基本全部都不见了,最新日期的还是6月17日的。中间这几天保存的笔记被狗吃了。
 
搜索功能也越做越垃圾,建议用一个 云文件同步+typora 做笔记就可以。
狗日了。网易越来越拉跨了。
 
最近几天记录了几篇笔记,基本全部都不见了,最新日期的还是6月17日的。中间这几天保存的笔记被狗吃了。
 
搜索功能也越做越垃圾,建议用一个 云文件同步+typora 做笔记就可以。

golang 插入redis 集合,并判断元素是否存在

Golang李魔佛 发表了文章 • 0 个评论 • 1383 次浏览 • 2022-06-20 17:26 • 来自相关话题

代码如下:
1. "server/service" 是当前的报名
2. 用的go-redis这个库
 
判断元素是否在集合中:

conn.SIsMember("User", sign).Result()

完整代码:
package cache

import (
"server/service"
"fmt"
"github.com/go-redis/redis"
)

type Cache struct {
conn *redis.Client
}

func (this *Cache) CacheInit() {
this.connect()

}
func (this *Cache) connect() {
conf := service.ReadRedisConfig()
this.conn = redis.NewClient(&redis.Options{
Addr: conf.Addr,
Password: conf.Password,
DB: conf.DB,
})

}
func (this *Cache) Get(id string) (string, bool) {
result, err := this.conn.Get(id).Result()
if err != nil {
fmt.Println(err)
return "", false
}
return result, true
}

func (this *Cache) Set(id string, content string) bool {
_, err := this.conn.Set(id, content, 0).Result()
if err != nil {
fmt.Println(err)
return false
} else {
return true
}
}

func (this *Cache) CheckUserExist(sign string) bool {
result, err := this.conn.SIsMember("User", sign).Result()
if err != nil {
fmt.Println(err)
return false
}
return result
}

func (this *Cache) AddUser(name string) bool {
_, err := this.conn.SAdd("User", name).Result()
if err != nil {
fmt.Println(err)
return false
} else {
return true
}

}

github地址:
https://github.com/Rockyzsu/BondInfoServer.git
  查看全部
代码如下:
1. "server/service" 是当前的报名
2. 用的go-redis这个库
 
判断元素是否在集合中:

conn.SIsMember("User", sign).Result()

完整代码:
package cache

import (
"server/service"
"fmt"
"github.com/go-redis/redis"
)

type Cache struct {
conn *redis.Client
}

func (this *Cache) CacheInit() {
this.connect()

}
func (this *Cache) connect() {
conf := service.ReadRedisConfig()
this.conn = redis.NewClient(&redis.Options{
Addr: conf.Addr,
Password: conf.Password,
DB: conf.DB,
})

}
func (this *Cache) Get(id string) (string, bool) {
result, err := this.conn.Get(id).Result()
if err != nil {
fmt.Println(err)
return "", false
}
return result, true
}

func (this *Cache) Set(id string, content string) bool {
_, err := this.conn.Set(id, content, 0).Result()
if err != nil {
fmt.Println(err)
return false
} else {
return true
}
}

func (this *Cache) CheckUserExist(sign string) bool {
result, err := this.conn.SIsMember("User", sign).Result()
if err != nil {
fmt.Println(err)
return false
}
return result
}

func (this *Cache) AddUser(name string) bool {
_, err := this.conn.SAdd("User", name).Result()
if err != nil {
fmt.Println(err)
return false
} else {
return true
}

}

github地址:
https://github.com/Rockyzsu/BondInfoServer.git
 

可转债交易新规什么时候实施,利好股市

券商万一免五绫波丽 发表了文章 • 0 个评论 • 1240 次浏览 • 2022-06-18 15:23 • 来自相关话题

上交所发布关于可转换公司债券适当性管理相关事项的通知,个人投资者参与向不特定对象发行的可转债申购、交易,应当同时符合下列条件:申请权限开通前20个交易日证券账户及资金账户内的资产日均不低于人民币10万元(不包括该投资者通过融资融券融入的资金和证券);参与证券交易24个月以上。

 昨天才看到可转债投资新规  今日和券商确认就已落地实施了(6.18日前开户的不受影响)来势汹汹,没有任何时间缓冲

 
但如果已满2年交易年限的老铁们,现在还有如下最低可转债费率(新规),需要的赶紧,
即使可转债降温,那又将利好股票,需要股票万一免五的也赶紧,不然又不知道哪天新规突然杀到,再想要也没有了
 
广发可转债:沪十万分之4.1,深十万分之4.1
银河股票:万一免五 ;可转债:沪十万分之5,深十万分之5
 
 
 
需要开户请扫码联系,备注:开户

  查看全部


上交所发布关于可转换公司债券适当性管理相关事项的通知,个人投资者参与向不特定对象发行的可转债申购、交易,应当同时符合下列条件:申请权限开通前20个交易日证券账户及资金账户内的资产日均不低于人民币10万元(不包括该投资者通过融资融券融入的资金和证券);参与证券交易24个月以上。


 昨天才看到可转债投资新规  今日和券商确认就已落地实施了(6.18日前开户的不受影响)来势汹汹,没有任何时间缓冲

 
但如果已满2年交易年限的老铁们,现在还有如下最低可转债费率(新规),需要的赶紧,
即使可转债降温,那又将利好股票,需要股票万一免五的也赶紧,不然又不知道哪天新规突然杀到,再想要也没有了
 
广发可转债:沪十万分之4.1,深十万分之4.1
银河股票:万一免五 ;可转债:沪十万分之5,深十万分之5
 
 
 
需要开户请扫码联系,备注:开户

 

不同券商的ptrade的异同

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 2409 次浏览 • 2022-06-17 16:36 • 来自相关话题

国盛vs湘财
 
1. 湘财无法访问外网,国盛的可以

2. 




get_cb_list 获取可转债列表 的 国盛没有

get_history 获取历史数据函数
 get_history(5, frequency='1d', field='close', security_list=['123084.SZ'], fq=None, include=False, fill='nan')国盛是没有fill参数的。
 
 
 
持续更新。。。待续
 
Ptrade开户联系:

  查看全部
国盛vs湘财
 
1. 湘财无法访问外网,国盛的可以

2. 
20220617001.png

get_cb_list 获取可转债列表 的 国盛没有

get_history 获取历史数据函数
 
get_history(5, frequency='1d', field='close', security_list=['123084.SZ'], fq=None, include=False, fill='nan')
国盛是没有fill参数的。
 
 
 
持续更新。。。待续
 
Ptrade开户联系:

 

Ptrade内置的第三方库查看

量化交易-Ptrade-QMT李魔佛 发表了文章 • 0 个评论 • 1833 次浏览 • 2022-06-17 10:19 • 来自相关话题

通过import pip查看到的Ptrade第三方库列表:
 APScheduler (3.3.1)
arch (3.2)
bcolz (1.2.1)
beautifulsoup4 (4.6.0)
bleach (1.5.0)
boto (2.43.0)
Bottleneck (1.0.0)
bz2file (0.98)
cachetools (3.1.0)
click (4.0)
contextlib2 (0.4.0)
crypto (1.4.1)
cvxopt (1.1.8)
cx-Oracle (8.0.1)
cycler (0.10.0)
cyordereddict (0.2.2)
Cython (0.22.1)
decorator (4.0.10)
entrypoints (0.2.2)
fastcache (1.0.2)
gensim (0.13.3)
h5py (2.6.0)
hmmlearn (0.2.0)
hs-udata (0.3.6)
html5lib (0.9999999)
ipykernel (4.5.0)
ipython (5.1.0)
ipython-genutils (0.1.0)
ipywidgets (5.2.2)
jieba (0.38)
Jinja2 (2.8)
jsonpickle (1.0)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.4.0)
jupyter-console (5.0.0)
jupyter-core (4.2.0)
jupyter-kernel-gateway (1.1.1)
Keras (2.3.1)
Keras-Applications (1.0.8)
Keras-Preprocessing (1.1.0)
line-profiler (2.1.2)
Logbook (1.4.3)
lxml (4.5.0)
Markdown (2.2.0)
MarkupSafe (0.23)
matplotlib (1.5.3)
mistune (0.7.3)
Naked (0.1.31)
nbconvert (4.2.0)
nbformat (4.1.0)
networkx (1.9.1)
nose (1.3.6)
notebook (4.2.3)
numexpr (2.6.1)
numpy (1.11.2)
pandas (0.23.4)
patsy (0.4.0)
pexpect (4.2.1)
pickleshare (0.7.4)
pip (9.0.1)
pkgconfig (1.0.0)
prompt-toolkit (1.0.8)
protobuf (3.3.0)
ptvsd (2.2.0)
ptyprocess (0.5.1)
PyBrain (0.3)
pycrypto (2.6.1)
Pygments (2.1.3)
PyMySQL (0.9.3)
pyparsing (2.1.10)
python-dateutil (2.7.5)
pytz (2015.4)
PyWavelets (0.4.0)
PyYAML (5.3.1)
pyzmq (16.1.0.dev0)
qtconsole (4.2.1)
requests (2.7.0)
retrying (1.3.3)
scikit-learn (0.18)
scipy (0.18.0)
seaborn (0.7.1)
setuptools (28.7.1)
setuptools-scm (3.1.0)
shellescape (3.4.1)
simplegeneric (0.8.1)
simplejson (3.17.0)
six (1.10.0)
sklearn (0.0)
smart-open (1.3.5)
SQLAlchemy (1.0.8)
statsmodels (0.10.2)
TA-Lib (0.4.10)
tables (3.3.0)
tabulate (0.7.5)
tensorflow (1.3.0rc1)
tensorflow-tensorboard (0.1.2)
terminado (0.6)
Theano (0.8.2)
toolz (0.7.4)
tornado (4.4.2)
traitlets (4.3.1)
tushare (1.2.48)
tzlocal (1.3)
wcwidth (0.1.7)
Werkzeug (0.12.2)
wheel (0.29.0)
widgetsnbextension (1.2.6)
xcsc-tushare (1.0.0)
xgboost (0.6a2)
xlrd (1.1.0)
xlwt (1.3.0)
zipline (0.8.3)
You are using pip version 9.0.1, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
由于内置了pymysql,所以可以直接读取你的数据库内容。这个需要你的ptrade具有连接外网功能才可以。
 
注:据个人经验,券商的开发能力约等于0,所以这一行为是恒生电子开放的,并非券商所为,券商并没有这么强的魔改能力,或者不敢做一些大的改动。
 
 
需要开通Ptrade的投资者可以联系微信:
股票费率万一免五 查看全部
通过import pip查看到的Ptrade第三方库列表:
 
APScheduler (3.3.1)
arch (3.2)
bcolz (1.2.1)
beautifulsoup4 (4.6.0)
bleach (1.5.0)
boto (2.43.0)
Bottleneck (1.0.0)
bz2file (0.98)
cachetools (3.1.0)
click (4.0)
contextlib2 (0.4.0)
crypto (1.4.1)
cvxopt (1.1.8)
cx-Oracle (8.0.1)
cycler (0.10.0)
cyordereddict (0.2.2)
Cython (0.22.1)
decorator (4.0.10)
entrypoints (0.2.2)
fastcache (1.0.2)
gensim (0.13.3)
h5py (2.6.0)
hmmlearn (0.2.0)
hs-udata (0.3.6)
html5lib (0.9999999)
ipykernel (4.5.0)
ipython (5.1.0)
ipython-genutils (0.1.0)
ipywidgets (5.2.2)
jieba (0.38)
Jinja2 (2.8)
jsonpickle (1.0)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.4.0)
jupyter-console (5.0.0)
jupyter-core (4.2.0)
jupyter-kernel-gateway (1.1.1)
Keras (2.3.1)
Keras-Applications (1.0.8)
Keras-Preprocessing (1.1.0)
line-profiler (2.1.2)
Logbook (1.4.3)
lxml (4.5.0)
Markdown (2.2.0)
MarkupSafe (0.23)
matplotlib (1.5.3)
mistune (0.7.3)
Naked (0.1.31)
nbconvert (4.2.0)
nbformat (4.1.0)
networkx (1.9.1)
nose (1.3.6)
notebook (4.2.3)
numexpr (2.6.1)
numpy (1.11.2)
pandas (0.23.4)
patsy (0.4.0)
pexpect (4.2.1)
pickleshare (0.7.4)
pip (9.0.1)
pkgconfig (1.0.0)
prompt-toolkit (1.0.8)
protobuf (3.3.0)
ptvsd (2.2.0)
ptyprocess (0.5.1)
PyBrain (0.3)
pycrypto (2.6.1)
Pygments (2.1.3)
PyMySQL (0.9.3)
pyparsing (2.1.10)
python-dateutil (2.7.5)
pytz (2015.4)
PyWavelets (0.4.0)
PyYAML (5.3.1)
pyzmq (16.1.0.dev0)
qtconsole (4.2.1)
requests (2.7.0)
retrying (1.3.3)
scikit-learn (0.18)
scipy (0.18.0)
seaborn (0.7.1)
setuptools (28.7.1)
setuptools-scm (3.1.0)
shellescape (3.4.1)
simplegeneric (0.8.1)
simplejson (3.17.0)
six (1.10.0)
sklearn (0.0)
smart-open (1.3.5)
SQLAlchemy (1.0.8)
statsmodels (0.10.2)
TA-Lib (0.4.10)
tables (3.3.0)
tabulate (0.7.5)
tensorflow (1.3.0rc1)
tensorflow-tensorboard (0.1.2)
terminado (0.6)
Theano (0.8.2)
toolz (0.7.4)
tornado (4.4.2)
traitlets (4.3.1)
tushare (1.2.48)
tzlocal (1.3)
wcwidth (0.1.7)
Werkzeug (0.12.2)
wheel (0.29.0)
widgetsnbextension (1.2.6)
xcsc-tushare (1.0.0)
xgboost (0.6a2)
xlrd (1.1.0)
xlwt (1.3.0)
zipline (0.8.3)
You are using pip version 9.0.1, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

由于内置了pymysql,所以可以直接读取你的数据库内容。这个需要你的ptrade具有连接外网功能才可以。
 
注:据个人经验,券商的开发能力约等于0,所以这一行为是恒生电子开放的,并非券商所为,券商并没有这么强的魔改能力,或者不敢做一些大的改动。
 
 
需要开通Ptrade的投资者可以联系微信:
股票费率万一免五