-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #874 from ricequant/develop
Develop
- Loading branch information
Showing
8 changed files
with
104 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-04-12 15:23+0800\n" | ||
"POT-Creation-Date: 2024-04-24 13:56+0800\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -471,8 +471,8 @@ msgstr "" | |
|
||
#: rqalpha/mod/rqalpha_mod_sys_analyser/mod.py:175 | ||
msgid "" | ||
"benchmark {} available data start date {} > backtest start date {} or end" | ||
" date {} <= backtest end date {}" | ||
"benchmark {} available data start date {} >= backtest start date {} or " | ||
"end date {} <= backtest end date {}" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_analyser/mod.py:243 | ||
|
@@ -721,72 +721,79 @@ msgid "" | |
"trade: [{}...]" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:118 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:335 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:119 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:348 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/signal_broker.py:69 | ||
msgid "" | ||
"Order Cancelled: current security [{order_book_id}] can not be traded in " | ||
"listed date [{listed_date}]" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:125 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:165 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:126 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:166 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/signal_broker.py:86 | ||
msgid "Order Cancelled: {order_book_id} bar no volume" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:150 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:151 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/signal_broker.py:95 | ||
msgid "Order Cancelled: current bar [{order_book_id}] reach the limit_up price." | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:156 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:157 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/signal_broker.py:104 | ||
msgid "Order Cancelled: current bar [{order_book_id}] reach the limit_down price." | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:178 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:417 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:567 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:179 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:436 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:591 | ||
msgid "" | ||
"Order Cancelled: market order {order_book_id} volume {order_volume} due " | ||
"to volume limit" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:217 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:218 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:474 | ||
msgid "" | ||
"Order Cancelled: not enough money to buy {order_book_id}, needs " | ||
"{cost_money:.2f}, cash {cash:.2f}" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:230 | ||
msgid "" | ||
"Order Cancelled: market order {order_book_id} volume {order_volume} is " | ||
"larger than {volume_percent_limit} percent of current bar volume, fill " | ||
"{filled_volume} actually" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:343 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:356 | ||
msgid "Order Cancelled: current tick [{order_book_id}] miss market data." | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:368 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:387 | ||
msgid "Order Cancelled: current tick [{order_book_id}] reach the limit_up price." | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:374 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:393 | ||
msgid "" | ||
"Order Cancelled: current tick [{order_book_id}] reach the limit_down " | ||
"price." | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:381 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:387 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:400 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:406 | ||
msgid "Order Cancelled: [{order_book_id}] has no liquidity." | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:462 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:486 | ||
msgid "" | ||
"Order Cancelled: market order {order_book_id} volume {order_volume} is " | ||
"larger than {volume_percent_limit} percent of current tick volume, fill " | ||
"{filled_volume} actually" | ||
msgstr "" | ||
|
||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:611 | ||
#: rqalpha/mod/rqalpha_mod_sys_simulation/matcher.py:635 | ||
msgid "" | ||
"Order Cancelled: market order {order_book_id} fill {filled_volume} " | ||
"actually" | ||
|
@@ -888,11 +895,15 @@ msgstr "" | |
msgid "Cash add {}. units {} become to {}" | ||
msgstr "" | ||
|
||
#: rqalpha/portfolio/account.py:352 | ||
#: rqalpha/portfolio/account.py:350 | ||
msgid "Futures account's cash turns negative after settlement" | ||
msgstr "" | ||
|
||
#: rqalpha/portfolio/account.py:356 | ||
msgid "Trigger Forced Liquidation, current total_value is 0" | ||
msgstr "" | ||
|
||
#: rqalpha/portfolio/account.py:502 rqalpha/portfolio/account.py:521 | ||
#: rqalpha/portfolio/account.py:506 rqalpha/portfolio/account.py:525 | ||
msgid "insufficient cash, current {}, target withdrawal {}" | ||
msgstr "" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+59 Bytes
(100%)
rqalpha/mod/rqalpha_mod_sys_analyser/report/templates/summary.xlsx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
# 详细的授权流程,请联系 [email protected] 获取。 | ||
import datetime | ||
from collections import defaultdict | ||
from copy import copy | ||
from rqalpha.const import MATCHING_TYPE, ORDER_TYPE, POSITION_EFFECT, SIDE | ||
from rqalpha.environment import Environment | ||
from rqalpha.core.events import EVENT, Event | ||
|
@@ -131,7 +132,7 @@ def match(self, account, order, open_auction): | |
if reason: | ||
order.mark_rejected(reason) | ||
return | ||
|
||
price_board = self._env.price_board | ||
if order.type == ORDER_TYPE.LIMIT: | ||
if order.side == SIDE.BUY and order.price < deal_price: | ||
|
@@ -208,6 +209,18 @@ def match(self, account, order, open_auction): | |
) | ||
trade._commission = self._env.get_trade_commission(trade) | ||
trade._tax = self._env.get_trade_tax(trade) | ||
|
||
if order.side == SIDE.BUY and self._slippage_decider.decider.rate != 0: | ||
# 标的价格经过滑点处理后,账户资金可能不够买入,需要进行验证 | ||
cost_money = instrument.calc_cash_occupation(price, order.quantity, order.position_direction, order.trading_datetime.date()) | ||
cost_money += trade.transaction_cost | ||
if cost_money > account.cash + order.init_frozen_cash: | ||
reason = _(u"Order Cancelled: not enough money to buy {order_book_id}, needs {cost_money:.2f}, cash {cash:.2f}").format( | ||
order_book_id=order_book_id, cost_money=cost_money, cash = account.cash + order.init_frozen_cash | ||
) | ||
order.mark_rejected(reason) | ||
return | ||
|
||
order.fill(trade) | ||
self._turnover[order.order_book_id] += fill | ||
|
||
|
@@ -344,6 +357,12 @@ def match(self, account, order, open_auction): # type: (Account, Order, bool) - | |
order_book_id=order.order_book_id) | ||
order.mark_rejected(reason) | ||
return | ||
|
||
# 对价格进行滑点处理 | ||
if instrument.during_call_auction(self._env.calendar_dt): | ||
price = deal_price | ||
else: | ||
price = self._slippage_decider.get_trade_price(order, deal_price) | ||
|
||
price_board = self._env.price_board | ||
if order.type == ORDER_TYPE.LIMIT: | ||
|
@@ -434,12 +453,6 @@ def match(self, account, order, open_auction): # type: (Account, Order, bool) - | |
# 平今的数量 | ||
ct_amount = account.calc_close_today_amount(order_book_id, fill, order.position_direction, order.position_effect) | ||
|
||
# 对价格进行滑点处理 | ||
if instrument.during_call_auction(self._env.calendar_dt): | ||
price = deal_price | ||
else: | ||
price = self._slippage_decider.get_trade_price(order, deal_price) | ||
|
||
# 成交记录 | ||
trade = Trade.__from_create__( | ||
order_id=order.order_id, | ||
|
@@ -453,6 +466,17 @@ def match(self, account, order, open_auction): # type: (Account, Order, bool) - | |
) | ||
trade._commission = self._env.get_trade_commission(trade) | ||
trade._tax = self._env.get_trade_tax(trade) | ||
|
||
if order.side == SIDE.BUY and self._slippage_decider.decider.rate != 0: | ||
cost_money = instrument.calc_cash_occupation(price, order.quantity, order.position_direction, order.trading_datetime.date()) | ||
cost_money += trade.transaction_cost | ||
if cost_money > account.cash + order.init_frozen_cash: | ||
reason = _(u"Order Cancelled: not enough money to buy {order_book_id}, needs {cost_money:.2f}, cash {cash:.2f}").format( | ||
order_book_id=order_book_id, cost_money=cost_money, cash=account.cash + order.init_frozen_cash | ||
) | ||
order.mark_rejected(reason) | ||
return | ||
|
||
order.fill(trade) | ||
self._turnover[order.order_book_id] += fill | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+352 Bytes
(100%)
rqalpha/utils/translations/zh_Hans_CN/LC_MESSAGES/messages.mo
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
[metadata] | ||
name = rqalpha | ||
version = 5.3.9 | ||
version = 5.3.10 | ||
|
||
[versioneer] | ||
VCS = git | ||
|