Skip to content

Commit

Permalink
Merge pull request #3181 from kungfu-trader/alpha/v2/v2.4
Browse files Browse the repository at this point in the history
Release v2.4.77
  • Loading branch information
kungfu-origin authored Mar 19, 2024
2 parents adfb5c2 + c336200 commit aeec860
Show file tree
Hide file tree
Showing 25 changed files with 1,649 additions and 1,460 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Intro 简介

[功夫量化](https://www.kungfu-trader.com) 是专为量化交易者设计的开源交易执行系统。功夫想要解决以下问题:
[功夫核心库](https://libkungfu.cc) 是专为量化交易者设计的开源交易执行系统。功夫想要解决以下问题:
* 低延迟交易 - 量化交易者对系统内响应速度有极高要求,功夫提供微秒级别的系统响应,支持带纳秒级时间戳的交易数据实时存储和盘后分析。
* 开放的策略编写方式 - 功夫支持 Python 3 及 C++ 形式的策略编写,策略师可以不受限的自由使用第三方计算库,放飞创意。
* 友好的使用方式 - 告别 Linux shell 小黑屋,功夫提供图形化操作界面,简化策略运维流程。而进阶用户仍然具备通过底层 API 以无界面形式使用系统的能力。
Expand All @@ -19,11 +19,9 @@
* [Vue.js](https://vuejs.org) - UI开发框架

功夫在系统设计上支持任意柜台的对接(涵盖中国所有股票、期货市场),功夫开源版提供 [XTP](https://xtp.zts.com.cn/) 柜台对接的参考实现。
如果需要接入更多柜台请至 [功夫量化官网](https://www.kungfu-trader.com) 下载专业版或联系我们
如果需要接入更多柜台请至 [功夫量化](https://www.kungfu-trader.com) 下载标准版或联系我们

初次使用请参考 [功夫文档](https://docs.kungfu-trader.com)

更多介绍请关注知乎专栏 [硅商冲击](https://zhuanlan.zhihu.com/silicontrader)
初次使用请参考 [功夫核心库文档](https://docs.libkungfu.cc)

# License

Expand All @@ -32,24 +30,25 @@ Apache License 2.0
# Setup 编译及运行环境

功夫的编译依赖以下工具:

* 支持 C++20 的编译器
* [cmake](https://cmake.org/) (>=3.15)
* [Node.js](https://nodejs.org/) (^14.x)
* [yarn](https://classic.yarnpkg.com/) (^1.x)
* [Python 3](https://www.python.org/) (~3.9)
* [pipenv](https://pipenv.pypa.io/) (^1.x)
* [pipenv](https://pipenv.pypa.io/) (>=2023.9.1)

开始编译前,请先确保安装以上工具,且正确设置 PATH 环境变量。

# Compile 编译

#### 常规操作

获取代码并编译:
获取代码并编译(必须用git方式获取代码,功夫编译需要获取git仓库的版本信息)
```
$ git clone git@github.com:kungfu-trader/kungfu.git
## git clone kungfu repo
$ cd kungfu
$ yarn install
$ yarn install --frozen-lockfile
$ yarn build
$ yarn package
```
Expand Down Expand Up @@ -89,6 +88,6 @@ $HOME/.local/share/virtualenvs # pipenv(unix) 存储的 Python 依赖

# Help 帮助信息

更多信息请访问 [功夫量化](https://www.kungfu-trader.com)
更多信息请访问网站 [功夫核心库](https://libkungfu.cc) [功夫量化](https://www.kungfu-trader.com)

QQ 交流群 312745666,入群问题答案:kungfu.trader
微信公众号:功夫量化
14 changes: 7 additions & 7 deletions artifact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "Kungfu Trader Artifact",
"license": "Apache-2.0",
"private": true,
Expand All @@ -22,12 +22,12 @@
"cli": "yarn kfs craft cli"
},
"dependencies": {
"@kungfu-trader/kfx-broker-sim": "^2.4.76",
"@kungfu-trader/kfx-broker-xtp-demo": "^2.4.76",
"@kungfu-trader/kungfu-app": "^2.4.76",
"@kungfu-trader/kungfu-cli": "^2.4.76",
"@kungfu-trader/kungfu-core": "^2.4.76",
"@kungfu-trader/kungfu-sdk": "^2.4.76"
"@kungfu-trader/kfx-broker-sim": "^2.4.77-alpha.2",
"@kungfu-trader/kfx-broker-xtp-demo": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-app": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-cli": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-core": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-sdk": "^2.4.77-alpha.2"
},
"repository": {
"url": "/~https://github.com/kungfu-trader/kungfu.git"
Expand Down
12 changes: 6 additions & 6 deletions developer/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "SDK for developing Kungfu Applications",
"license": "Apache-2.0",
"main": "src/index.js",
Expand Down Expand Up @@ -34,10 +34,10 @@
"format": "prettier -l -w --config ../../framework/core/.prettierrc.js ."
},
"dependencies": {
"@kungfu-trader/kungfu-app": "^2.4.76",
"@kungfu-trader/kungfu-cli": "^2.4.76",
"@kungfu-trader/kungfu-core": "^2.4.76",
"@kungfu-trader/kungfu-js-api": "^2.4.76",
"@kungfu-trader/kungfu-toolchain": "^2.4.76"
"@kungfu-trader/kungfu-app": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-cli": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-core": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-js-api": "^2.4.77-alpha.2",
"@kungfu-trader/kungfu-toolchain": "^2.4.77-alpha.2"
}
}
2 changes: 1 addition & 1 deletion developer/toolchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "Toolchain for Kungfu Development (babel/cmake-js/node-gyp/webpack/yarn/etc).",
"license": "Apache-2.0",
"main": "package.json",
Expand Down
4 changes: 2 additions & 2 deletions examples/assemble-python/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kungfu-trader/examples-assemble-python",
"author": "kungfu-trader",
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "KungFu Example Assemble Python",
"license": "Apache-2.0",
"private": true,
Expand All @@ -13,6 +13,6 @@
"read_bytes": "kfc -l debug assemble src/json/read_bytes_10026.json"
},
"devDependencies": {
"@kungfu-trader/kungfu-sdk": "^2.4.76"
"@kungfu-trader/kungfu-sdk": "^2.4.77-alpha.2"
}
}
4 changes: 2 additions & 2 deletions examples/strategy-cpp-101/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kungfu-trader/examples-strategy-cpp",
"author": "kungfu-trader",
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "KungFu Strategy 101 - C++ Demo",
"license": "Apache-2.0",
"private": true,
Expand All @@ -15,7 +15,7 @@
"format": "node ../../framework/core/.gyp/run-format-cpp.js src"
},
"devDependencies": {
"@kungfu-trader/kungfu-sdk": "^2.4.76"
"@kungfu-trader/kungfu-sdk": "^2.4.77-alpha.2"
},
"repository": {
"url": "/~https://github.com/kungfu-trader/kungfu.git"
Expand Down
4 changes: 2 additions & 2 deletions examples/strategy-cpp-exe/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kungfu-trader/examples-strategy-cpp-exe",
"author": "kungfu-trader",
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "KungFu Strategy 101 - C++ Demo",
"license": "Apache-2.0",
"private": true,
Expand All @@ -23,7 +23,7 @@
"cached": "kfc -l debug run -c system -g service -n cached"
},
"devDependencies": {
"@kungfu-trader/kungfu-sdk": "^2.4.76"
"@kungfu-trader/kungfu-sdk": "^2.4.77-alpha.2"
},
"repository": {
"url": "/~https://github.com/kungfu-trader/kungfu.git"
Expand Down
4 changes: 2 additions & 2 deletions examples/strategy-python-101/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kungfu-trader/examples-strategy-python",
"author": "kungfu-trader",
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "KungFu Strategy 101 - Python Demo",
"license": "Apache-2.0",
"private": true,
Expand All @@ -15,7 +15,7 @@
"format": "node ../../framework/core/.gyp/run-format-python.js src"
},
"devDependencies": {
"@kungfu-trader/kungfu-sdk": "^2.4.76"
"@kungfu-trader/kungfu-sdk": "^2.4.77-alpha.2"
},
"repository": {
"url": "/~https://github.com/kungfu-trader/kungfu.git"
Expand Down
6 changes: 3 additions & 3 deletions extensions/sim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "Kungfu Extension - SIM",
"license": "Apache-2.0",
"main": "package.json",
Expand All @@ -29,10 +29,10 @@
"package": "kfs project package"
},
"dependencies": {
"@kungfu-trader/kungfu-core": "^2.4.76"
"@kungfu-trader/kungfu-core": "^2.4.77-alpha.2"
},
"devDependencies": {
"@kungfu-trader/kungfu-sdk": "^2.4.76"
"@kungfu-trader/kungfu-sdk": "^2.4.77-alpha.2"
},
"kungfuBuild": {
"python": {
Expand Down
8 changes: 4 additions & 4 deletions extensions/xtp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "Kungfu Extension - XTP Demo",
"license": "Apache-2.0",
"main": "package.json",
Expand All @@ -29,13 +29,13 @@
"package": "kfs project package"
},
"dependencies": {
"@kungfu-trader/kungfu-core": "^2.4.76"
"@kungfu-trader/kungfu-core": "^2.4.77-alpha.2"
},
"devDependencies": {
"@kungfu-trader/kungfu-sdk": "^2.4.76"
"@kungfu-trader/kungfu-sdk": "^2.4.77-alpha.2"
},
"kungfuDependencies": {
"xtp": "v2.2.32.2"
"xtp": "v2.2.37.4"
},
"kungfuBuild": {
"cpp": {
Expand Down
13 changes: 7 additions & 6 deletions extensions/xtp/src/cpp/marketdata_xtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MarketDataXTP::~MarketDataXTP() {
}

void MarketDataXTP::on_start() {
public_wirter_ = get_writer(0);
level2_tick_band_uid_ = request_band("market-data-band");

MDConfiguration config = nlohmann::json::parse(get_config());
Expand Down Expand Up @@ -158,17 +159,17 @@ void MarketDataXTP::OnQueryAllTickers(XTPQSI *ticker_info, XTPRI *error_info, bo
return;
}

Instrument &instrument = get_writer(0)->open_data<Instrument>(0);
Instrument &instrument = public_wirter_->open_data<Instrument>(0);
from_xtp(ticker_info, instrument);
get_writer(0)->close_data();
public_wirter_->close_data();
SPDLOG_TRACE("instrument {}", instrument.to_string());
}

void MarketDataXTP::OnDepthMarketData(XTPMD *market_data, int64_t *bid1_qty, int32_t bid1_count, int32_t max_bid1_count,
int64_t *ask1_qty, int32_t ask1_count, int32_t max_ask1_count) {
Quote &quote = get_writer(0)->open_data<Quote>(0);
Quote &quote = public_wirter_->open_data<Quote>(0);
from_xtp(*market_data, quote);
get_writer(0)->close_data();
public_wirter_->close_data();
}

void MarketDataXTP::OnTickByTick(XTPTBT *tbt_data) {
Expand All @@ -194,7 +195,7 @@ void MarketDataXTP::OnQueryAllTickersFullInfo(XTPQFI *ticker_info, XTPRI *error_
return;
}

Instrument &instrument = get_writer(0)->open_data<Instrument>(0);
Instrument &instrument = public_wirter_->open_data<Instrument>(0);
strcpy(instrument.instrument_id, ticker_info->ticker);
if (ticker_info->exchange_id == 1) {
instrument.exchange_id = EXCHANGE_SSE;
Expand All @@ -204,7 +205,7 @@ void MarketDataXTP::OnQueryAllTickersFullInfo(XTPQFI *ticker_info, XTPRI *error_

memcpy(instrument.product_id, ticker_info->ticker_name, strlen(ticker_info->ticker_name));
instrument.instrument_type = get_instrument_type(instrument.exchange_id, instrument.instrument_id);
get_writer(0)->close_data();
public_wirter_->close_data();
SPDLOG_TRACE("instrument {}", instrument.to_string());
}
} // namespace kungfu::wingchun::xtp
1 change: 1 addition & 0 deletions extensions/xtp/src/cpp/marketdata_xtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class MarketDataXTP : public XTP::API::QuoteSpi, public broker::MarketData {
private:
XTP::API::QuoteApi *api_{};
uint32_t level2_tick_band_uid_;
yijinjing::journal::writer_ptr public_wirter_{};

This comment has been minimized.

Copy link
@GCWK

GCWK Mar 21, 2024

public_wirter_: writer拼写错误


bool subscribe(const std::vector<std::string> &instruments, const std::string &exchange_id);
};
Expand Down
2 changes: 1 addition & 1 deletion extensions/xtp/src/cpp/trader_xtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void TraderXTP::on_recover() {
bool TraderXTP::req_order_trade() {
for (auto &pair : orders_) {
SPDLOG_DEBUG("order: {}", pair.second.data.to_string());
if (not is_final_status(pair.second.data.status)) {
if (not is_final_status(pair.second.data.status) or pair.second.data.status == OrderStatus::Lost) {
uint64_t order_id = pair.first;
uint64_t order_xtp_id = map_kf_to_xtp_order_id_.at(order_id);
int ret = api_->QueryOrderByXTPID(order_xtp_id, session_id_, ++request_id_);
Expand Down
4 changes: 2 additions & 2 deletions framework/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "Kungfu Javascript/Typescript API",
"license": "Apache-2.0",
"repository": {
Expand All @@ -31,7 +31,7 @@
"format": "prettier -l -w --config ../core/.prettierrc.js ."
},
"dependencies": {
"@kungfu-trader/kungfu-core": "^2.4.76",
"@kungfu-trader/kungfu-core": "^2.4.77-alpha.2",
"cfonts": "^2.10.0",
"chalk": "^4.1.0",
"fast-csv": "^4.3.5",
Expand Down
6 changes: 3 additions & 3 deletions framework/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "Kungfu App Framework",
"license": "Apache-2.0",
"repository": {
Expand All @@ -31,7 +31,7 @@
"format": "prettier -l -w --config ../core/.prettierrc.js ."
},
"dependencies": {
"@kungfu-trader/kungfu-js-api": "^2.4.76",
"@kungfu-trader/kungfu-js-api": "^2.4.77-alpha.2",
"ant-design-vue": "^3.2.16",
"core-js": "^3.20.0",
"iconv-lite": "^0.6.3",
Expand All @@ -42,7 +42,7 @@
"vue": "^3.2.34"
},
"devDependencies": {
"@kungfu-trader/kungfu-toolchain": "^2.4.76",
"@kungfu-trader/kungfu-toolchain": "^2.4.77-alpha.2",
"@types/markdown-it": "^12.2.3",
"electron": "19.1.8",
"webpack-bundle-analyzer": "^4.6.1"
Expand Down
6 changes: 3 additions & 3 deletions framework/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Kungfu Trader",
"email": "info@kungfu.link"
},
"version": "2.4.76",
"version": "2.4.77-alpha.2",
"description": "Kungfu App Framework",
"license": "Apache-2.0",
"repository": {
Expand Down Expand Up @@ -33,14 +33,14 @@
"format": "prettier -l -w --config ../core/.prettierrc.js ."
},
"dependencies": {
"@kungfu-trader/kungfu-js-api": "^2.4.76",
"@kungfu-trader/kungfu-js-api": "^2.4.77-alpha.2",
"blessed": "^0.1.81",
"core-js": "^3.20.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/polyfill": "^7.12.1",
"@kungfu-trader/kungfu-toolchain": "^2.4.76",
"@kungfu-trader/kungfu-toolchain": "^2.4.77-alpha.2",
"@types/blessed": "^0.1.19",
"colors": "^1.4.0",
"commander": "^9.0.0",
Expand Down
Loading

0 comments on commit aeec860

Please sign in to comment.