This is an akshare-based stock backtesting framework.
Project description
This is an akshare-based stock backtesting framework
包括10个主要函数func:
1.trade_get():获取交易日数据
2.get_stock(code,fq):获取股票数据,code股票代码,fq:复权类型
3.Stock_range(stock_df,Context,enable_hist_df,td,count):获取一定时间范围内的数据。依次输入,股票数据,用户信息,交易日数据,当天日期,数量
4.get_today_data(Context,code):获取今天价格.依次输入,用户信息,股票代码
5.order_root(Context,today_price,code,amount,o_or_c):最底层的下单函数。依次输入,用户信息,今天价格,股票代码,交易数量,open_or_close
6.order(Context,code,amount,o_or_c):下单函数之一。依次输入,用户信息,股票代码,交易数量,open_or_close
7.order_target(Context,code,amount,o_or_c):下单函数之一。依次输入,用户信息,股票代码,交易后的持仓数量,open_or_close
8.order_value(Context,code,value,o_or_c):下单函数之一。依次输入,用户信息,股票代码,交易后的持有现金,open_or_close
9.order_target_value(Context,code,value,o_or_c):下单函数之一。依次输入,用户信息,股票代码,交易后的持有现金,open_or_close
10.order_target_value(Context,code,value,o_or_c):
11.run(Context):用户信息,主要回测函数,按天回测
12.class Context:存了用户需要的信息
13.class G():非常重要,这是一个全局类,用于方便用户在初始化函数和策略函数里随心所欲地定义变量,这些变量都会被存在g的属性里
14.使用时需要导入aks.py,获取交易日信息,并新建Init函数记录取票代码等信息。新建handle函数,进行策略部署,然后调用run函数即可。在aks.py最后有一示例代码文件。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aks-0.1.0.tar.gz
.
File metadata
- Download URL: aks-0.1.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f13f8b55445e2342270ead496c9dfa900e7e353c228b3b048a1426ac569dec92 |
|
MD5 | d789a181ac38d9debfcf0df9e618beca |
|
BLAKE2b-256 | b51f61738c7e5f8b12f3c223e0e2ad0d06ac5abb9f59fbb9d26c4c5f45ebbfbe |
File details
Details for the file aks-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: aks-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e9c04e04bfebb9f8dba204e9c1ad0346d65ad2dde4b6cda9f7463719432a9f6 |
|
MD5 | fab45acd9ba95fd877bca1eebc6cf39e |
|
BLAKE2b-256 | 2c4b63794f9262b8f8f11238ed2421c0ad970a011b9b410446ae0424afe11077 |