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

修复初始化空头仓位数值为负数的问题 #849

Merged
merged 4 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions rqalpha/apis/api_rqdatac.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,3 @@ def _get_data(symbol_list, start_dt):
def query(*entities):
return rqdatac.query(*entities)


export_as_api(rqdatac.financials, name='financials')
export_as_api(rqdatac.financials, name='Financials')
export_as_api(rqdatac.fundamentals, name='fundamentals')
export_as_api(rqdatac.Fundamentals, name='Fundamentals')
2 changes: 1 addition & 1 deletion rqalpha/model/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def get_short_margin_ratio(self, dt):
"""
获取空头保证金率(期货专用)
"""
return self._futures_long_margin_ratio_getter(self, dt)
return self._futures_short_margin_ratio_getter(self, dt)

def calc_cash_occupation(self, price, quantity, direction, dt):
# type: (float, int, POSITION_DIRECTION, datetime.date) -> float
Expand Down
1 change: 1 addition & 0 deletions rqalpha/portfolio/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(

for order_book_id, (init_quantity, init_price) in init_positions.items():
position_direction = POSITION_DIRECTION.LONG if init_quantity > 0 else POSITION_DIRECTION.SHORT
init_quantity = abs(init_quantity) if init_quantity < 0 else init_quantity
self._get_or_create_pos(order_book_id, position_direction, init_quantity, init_price)

def __repr__(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[metadata]
name = rqalpha
version = 5.3.5
version = 5.3.6

[versioneer]
VCS = git
Expand Down
Binary file modified tests/outs/test_s_pit_tax.pkl
Binary file not shown.
Loading