Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update order_target_portfolio #893

Merged
merged 4 commits into from
Jul 30, 2024
Merged

update order_target_portfolio #893

merged 4 commits into from
Jul 30, 2024

Conversation

Lin-Dongzhao
Copy link
Collaborator

No description provided.

@coveralls
Copy link

coveralls commented Jul 30, 2024

Coverage Status

coverage: 64.936% (+0.04%) from 64.898%
when pulling f88b5f6 on RQSDK-746
into f1183dd on develop.

@@ -70,14 +72,26 @@ def _get_account_position_ins(id_or_ins):
return account, position, ins


def _round_order_quantity(ins, quantity) -> int:
def _round_order_quantity(ins, quantity, method: str = "round_down") -> int:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里直直接把 round 函数作为参数传进来吧

@@ -373,16 +387,8 @@ def order_target_portfolio(
))

account_value = account.total_value
if total_percent == 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个我感觉还是得留着,要不然后边的买单会稳定少于目标

order.set_frozen_price(last_price)
order_list.append(order)
open_orders.append(order)
estimate_cash -= order.quantity * order.frozen_price + env.get_order_transaction_cost(order)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果 delta_quantity 不变的话订单花费的金额没必要重复计算。

@Cuizi7 Cuizi7 merged commit 762bc15 into develop Jul 30, 2024
22 checks passed
@Lin-Dongzhao Lin-Dongzhao deleted the RQSDK-746 branch August 14, 2024 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants