Skip to main content

<p>cn-trader</p>

<a href="https://github.com/codfish-zz/cn-trader/blob/master/LICENSE">

    <img alt="GitHub" src="https://huui1998.pythonanywhere.com/admin/uploads/cn-trader/license.svg?color=blue">

</a>

<p>

    <b>English</b> |

    <a href="https://github.com/codfish-zz/cn-trader/blob/master/README_zh-hans.md">简体中文</a>

Overview

Python back testing system for trading strategies, based on backtrader and AkShare, customized for China market.

Installation

This repository is tested on Python 3.10+, backtrader 1.9+ and AkShare 1.4+.

With pip

pip install cn-trader

With source

$ git clone https://github.com/codfish-zz/cn-trader

$ cd cn-trader

$ pip install -r requirements.txt

Or

$ git clone https://gitee.com/huui/cn-trader.git

$ cd cn-trader

$ pip install -r requirements.txt

Quick tour

Run cn-trader with UI interface.

>>> from cn_trader import ui

>>> ui.main()

Main menu Main menu

Input stock symbol Input stock symbol

Change default parameters Change default parameters

Show picture or not Show picture or not

Show log or not Show log or not

Full picture Full picture

Zoom the picture Zoom the picture

Show log and summary Show log and summary

Menu auto-completing Menu auto-completing

Testing

Run single test case.

$ cd tests

$ python -m unittest tests.test_stock_mainland.StockMainlandTestCase.test_strategy_check_sma_cross

Output Output

Run all test cases.

$ cd tests

$ python -m unittest discover -v

Output Output

Create new strategy

Coming soon...

Metadata

Release files for cn-trader 1.0.2

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

Built distribution (wheel)

Table of built distributions (wheels) for cn-trader 1.0.2
File Interpreter ABI Platform
cn_trader-1.0.2-py3-none-any.whl Python 3 none any Details

Release files / cn_trader-1.0.2-py3-none-any.whl

Download URL cn_trader-1.0.2-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d28cedc4257a555a136c18db9dadae1454d13183b8a22dc73f566bc1a422cae1
BLAKE2b-256 checksum
How to use checksums
dcadbab5a1a0417cf6a88ba174c9ffc373afc2ab8dd2b99806711d1e74de32ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

1 release file

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