diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c0190115..2f855cb9 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -17,15 +17,35 @@ jobs: os: [ubuntu-latest] steps: + - uses: actions/checkout@v4 + + - name: Cache packages + id: cache-xmake-ubuntu + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ~/.xmake + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - uses: xmake-io/github-action-setup-xmake@v1 - - name: checkout - run: | - git clone https://github.com/fasiondog/hikyuu.git --recursive --depth 1 - + with: + xmake-version: branch@master + actions-cache-folder: '.xmake-cache' + + - name: config + run: | + xmake f --feedback=n -y + - name: build run: | - sudo apt-get install -y libsqlite3-dev - cd ./hikyuu - xmake f -y xmake -b small-test + + - name: test + run: | xmake r small-test + \ No newline at end of file diff --git a/.github/workflows/ubuntu_aarch64.yml b/.github/workflows/ubuntu_aarch64.yml index e24268bb..dca64882 100644 --- a/.github/workflows/ubuntu_aarch64.yml +++ b/.github/workflows/ubuntu_aarch64.yml @@ -22,14 +22,37 @@ jobs: cancel-in-progress: true steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 + + - name: Cache xmake aarch64 packages + id: cache-xmake-ubuntu-aarch64 + uses: actions/cache@v3 + env: + cache-name: cache-ubuntu-aarch64-modules + with: + path: | + ~/.xmake + ./${{ matrix.cross }}-cross.linux + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: branch@master + actions-cache-folder: '.xmake-cache' + - name: Installation musl run: | wget https://github.com/xmake-mirror/musl.cc/releases/download/20210202/${{ matrix.cross }}-cross.linux.tgz tar -xvf ${{ matrix.cross }}-cross.linux.tgz - - name: build + - name: configure run: | xmake f -p cross -a aarch64 --sdk=`pwd`/${{ matrix.cross }}-cross -y + + - name: build + run: | xmake -b hikyuu \ No newline at end of file diff --git a/.github/workflows/ubuntu_python.yml b/.github/workflows/ubuntu_python.yml index e40c669a..2eb4e869 100644 --- a/.github/workflows/ubuntu_python.yml +++ b/.github/workflows/ubuntu_python.yml @@ -17,14 +17,30 @@ jobs: os: [ubuntu-latest] steps: + - uses: actions/checkout@v4 + + - name: Cache packages + id: cache-xmake-ubuntu + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ~/.xmake + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - uses: xmake-io/github-action-setup-xmake@v1 - - name: checkout - run: | - git clone https://github.com/fasiondog/hikyuu.git --recursive --depth 1 - + with: + xmake-version: branch@master + actions-cache-folder: '.xmake-cache' + + - name: configure + run: | + xmake f -y + - name: build run: | - sudo apt-get install -y libsqlite3-dev - cd ./hikyuu - xmake f -y xmake -b core diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 549ad08e..ad4b3220 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -22,15 +22,37 @@ jobs: cancel-in-progress: true steps: + - uses: actions/checkout@v4 + + - name: Cache windows packages + id: cache-xmake-windows + uses: actions/cache@v3 + env: + cache-name: cache-windows-modules + with: + path: /Users/%USERNAME/.xmake + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - uses: xmake-io/github-action-setup-xmake@v1 - - name: checkout - run: | - git clone https://github.com/fasiondog/hikyuu.git --recursive --depth 1 - + with: + xmake-version: branch@master + actions-cache-folder: '.xmake-cache' + + - name: configure + shell: cmd + run: | + xmake f --feedback=n -y + - name: build shell: cmd run: | - cd hikyuu - xmake f -y xmake -b small-test + + - name: test + shell: cmd + run: | xmake r small-test diff --git a/.github/workflows/windows_python.yml b/.github/workflows/windows_python.yml index 83293e04..035f3aea 100644 --- a/.github/workflows/windows_python.yml +++ b/.github/workflows/windows_python.yml @@ -22,14 +22,32 @@ jobs: cancel-in-progress: true steps: + - uses: actions/checkout@v4 + + - name: Cache windows packages + id: cache-xmake-windows + uses: actions/cache@v3 + env: + cache-name: cache-windows-modules + with: + path: /Users/%USERNAME/.xmake + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - uses: xmake-io/github-action-setup-xmake@v1 - - name: checkout - run: | - git clone https://github.com/fasiondog/hikyuu.git --recursive --depth 1 + with: + xmake-version: branch@master + actions-cache-folder: '.xmake-cache' + - name: configure + shell: cmd + run: | + xmake f -y --pyver=3.11 + - name: build shell: cmd run: | - cd hikyuu - xmake f -y --pyver=3.11 - xmake -b core + xmake -b core \ No newline at end of file diff --git a/docs/source/.readthedocs.yaml b/docs/source/.readthedocs.yaml new file mode 100644 index 00000000..8bbcb97a --- /dev/null +++ b/docs/source/.readthedocs.yaml @@ -0,0 +1,22 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/source/conf.py + +# We recommend specifying your dependencies to enable reproducible builds: +# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +# python: +# install: +# - requirements: docs/requirements.txt \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 47442093..51b0b489 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -108,7 +108,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = 'sphinxdoc' #可选:alabaster, sphinx_rtd_theme, classic, sphinxdoc, scrolls, agogo, traditional, nature, haiku, pyramid, bizstyle #http://www.sphinx-doc.org/en/stable/theming.html#using-a-theme diff --git a/docs/source/developer.rst b/docs/source/developer.rst index d6a499b4..32ea162b 100644 --- a/docs/source/developer.rst +++ b/docs/source/developer.rst @@ -25,20 +25,9 @@ C++测试工程参考:``_ 2、安装构建工具 xmake ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -xmake >= 2.2.2,网址:``_ +xmake >= 2.8.2,网址:``_ -Windows下,从 xmake github 页面中的“release”进入,直接下载相应的 exe 安装包安装即可: - -.. figure:: _static/dev-001.jpg - - -Linux、macOSX 执行以下指令安装: - -.. code-block:: shell - - git clone --branch=dev https://github.com/tboox/xmake.git tboox/xmake --depth 1 - cd ./tboox/xmake - ./scripts/get.sh __local__ +参见:https://xmake.io/#/zh-cn/guide/installation `` 3、克隆 Hikyuu 源码 @@ -48,7 +37,7 @@ Linux、macOSX 执行以下指令安装: .. code-block:: shell - git clone https://github.com/fasiondog/hikyuu.git --recursive --depth 1 + git clone https://github.com/fasiondog/hikyuu.git --recursive 4、Linux下安装依赖软件包 diff --git a/hikyuu_pywrap/trade_manage/_TradeManager.cpp b/hikyuu_pywrap/trade_manage/_TradeManager.cpp index 07fe5993..97aadb1d 100644 --- a/hikyuu_pywrap/trade_manage/_TradeManager.cpp +++ b/hikyuu_pywrap/trade_manage/_TradeManager.cpp @@ -112,7 +112,7 @@ void export_TradeManager() { :rtype: int)") - //.def("getShortStockNumber", &TradeManager::getShortStockNumber) + .def("get_short_stock_num", &TradeManagerBase::getShortStockNumber) .def("get_hold_num", &TradeManagerBase::getHoldNumber, R"(get_hold_num(self, datetime, stock) @@ -122,7 +122,7 @@ void export_TradeManager() { :param Stock stock: 指定的证券 :rtype: int)") - //.def("getShortHoldNumber", &TradeManager::getShortHoldNumber) + .def("get_short_hold_num", &TradeManagerBase::getShortHoldNumber) .def("get_trade_list", _getTradeList_1) .def("get_trade_list", _getTradeList_2, R"(get_trade_list(self[, start, end]) @@ -175,10 +175,10 @@ void export_TradeManager() { :param float num: 卖出数量 :rtype: CostRecord)") - //.def("getBorrowCashCost", &TradeManager::getBorrowCashCost) - //.def("getReturnCashCost", &TradeManager::getReturnCashCost) - //.def("getBorrowStockCost", &TradeManager::getBorrowStockCost) - //.def("getReturnStockCost", &TradeManager::getReturnStockCost) + .def("get_borrow_cash_cost", &TradeManagerBase::getBorrowCashCost) + .def("get_return_cash_cost", &TradeManagerBase::getReturnCashCost) + .def("get_borrow_stock_cost", &TradeManagerBase::getBorrowStockCost) + .def("get_return_stock_cost", &TradeManagerBase::getReturnStockCost) .def("cash", &TradeManagerBase::cash, (arg("datetime"), arg("ktype") = KQuery::DAY), R"(cash(self, datetime[, ktype=Query.KType.DAY]) @@ -237,12 +237,12 @@ void export_TradeManager() { :param float cash: 取出的资金量 :rtype: TradeRecord)") - //.def("checkinStock", &TradeManager::checkinStock) - //.def("checkoutStock", &TradeManager::checkoutStock) - //.def("borrowCash", &TradeManager::borrowCash) - //.def("returnCash", &TradeManager::returnCash) - //.def("borrowStock", &TradeManager::borrowStock) - //.def("returnStock", &TradeManager::returnStock) + .def("checkin_stock", &TradeManagerBase::checkinStock) + .def("checkout_stock", &TradeManagerBase::checkoutStock) + .def("borrow_cash", &TradeManagerBase::borrowCash) + .def("return_cash", &TradeManagerBase::returnCash) + .def("borrow_stock", &TradeManagerBase::borrowStock) + .def("return_stock", &TradeManagerBase::returnStock) .def( "buy", &TradeManagerBase::buy, @@ -262,9 +262,6 @@ void export_TradeManager() { :param SystemPart part: 交易指示来源 :rtype: TradeRecord)") - // buy_overload(args("datetime", "stock", "realPrice", - //"num", "stoploss", "goalPrice", "planPrice","part"))) - .def( "sell", &TradeManagerBase::sell, (arg("datetime"), arg("stock"), arg("real_price"), arg("num") = MAX_DOUBLE, @@ -283,10 +280,9 @@ void export_TradeManager() { :param float plan_price: 原计划卖出价格 :param SystemPart part: 交易指示来源 :rtype: TradeRecord)") - // sell_overload(args("datetime", "stock", "realPrice", "num", "stoploss", "goalPrice", - // "planPrice", "part"))) - //.def("buyShort", &TradeManager::buyShort, buyShort_overload()) - //.def("sellShort", &TradeManager::sellShort, sellShort_overload()) + + .def("buy_short", &TradeManagerBase::buyShort) + .def("sell_short", &TradeManagerBase::sellShort) .def("add_trade_record", &TradeManagerBase::addTradeRecord, R"(add_trade_record(self, tr)