Skip to main content

股票交易策略系统

项目意图

本项目旨在提供一个灵活的股票交易策略框架,允许用户通过多种策略对股票进行分析和交易。该系统支持多种技术指标和策略,用户可以根据自己的需求进行优化和调整。

项目特点

  • 多策略支持:内置多种交易策略,包括布林带、KDJ、MACD、移动平均等,用户可以根据市场情况选择合适的策略。
  • 灵活的参数优化:支持对策略参数进行优化,帮助用户找到最佳的交易参数。
  • 模拟交易账户:提供模拟账户功能,用户可以在不承担风险的情况下测试策略的有效性。
  • 数据可视化:使用mplfinance库进行数据可视化,帮助用户更直观地理解市场动态。
  • 多线程处理:使用线程池来提高数据处理效率,支持并发获取多个股票的数据。

功能概述

  • 股票数据管理:通过StocksManager类管理股票数据,支持从不同的股票市场获取数据。
  • 策略实现:每种策略都继承自BaseStrategy类,用户可以自定义自己的策略。
  • 账户管理:DemoAccount类用于管理模拟交易账户,包括买入、卖出、计算利润等功能。
  • 结果展示:提供结果展示功能,用户可以查看每种策略的表现和相关指标。

安装与使用

安装依赖

在使用本项目之前,请确保安装了以下依赖库:

pip install event_trader

使用步骤

  1. 分析个股的各选股策略的表现
from event_trader.strategies import  MA2Strategy, KDJStrategy, MA1Strategy, BollStrategy, MACDStrategy, PriceDeviationStrategy
from china_stock_data import StockData
from event_trader import friendly_number
stock = StockData('601688')
print(f"{stock['股票简称']}, 市值:{friendly_number(stock['总市值'])}")

for strategy in [MA2Strategy, KDJStrategy, MA1Strategy, BollStrategy, MACDStrategy, PriceDeviationStrategy]:
    st = strategy(stock)
    st.show(transaction = False, days = 30)

或者输出各个策略的交易信息

for strategy in [MA2Strategy, KDJStrategy, MA1Strategy, BollStrategy, MACDStrategy, PriceDeviationStrategy]:
    st = strategy(stock)
    print(st.transactions())
  1. 分析个股
from event_trader import StockInfo
stock = StockInfo('600489')
stock.get_result(t)

贡献

欢迎任何形式的贡献!如果您有建议或发现了问题,请提交issue或pull request。

许可证

本项目采用MIT许可证,详细信息请查看LICENSE文件。

联系

如有任何问题或建议,请通过以下方式联系我:

感谢您的支持,欢迎赞助我喝杯咖啡!

Metadata

Release files for event-trader 0.1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for event-trader 0.1.16
File Size Uploaded Provenance
event_trader-0.1.16.tar.gz 16.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for event-trader 0.1.16
File Interpreter ABI Platform
event_trader-0.1.16-py3-none-any.whl Python 3 none any Details

Total release size: 39.7 kB

Release files / event_trader-0.1.16.tar.gz

Download URL event_trader-0.1.16.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8fec35502f772bfd4888e06720e689dcf7d0ae97c44e5b60bd2dd88eff85b2a5
BLAKE2b-256 checksum
How to use checksums
42b9e804f3d6453787684516efaabb580dd3f7fe51ed33bb256eb7630e888334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.16 Linux/6.8.0-1021-azure

Release files / event_trader-0.1.16-py3-none-any.whl

Download URL event_trader-0.1.16-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cff6a57ae048202351cdf447f8ce53cb8d9a9d27285d290099254a9a4cf78b5d
BLAKE2b-256 checksum
How to use checksums
6944c9a9f39eccc05a55709181981d7215da9cc9454dab62b5b926711b110118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.16 Linux/6.8.0-1021-azure

Security for event-trader 0.1.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page