Skip to content

Commit

Permalink
Merge pull request #1534 from yutiansut/master
Browse files Browse the repository at this point in the history
update to 1.9.20
  • Loading branch information
yutiansut authored May 16, 2020
2 parents 2809b73 + 144809f commit 0cf5fb3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
23 changes: 20 additions & 3 deletions QUANTAXIS/QAARP/QARisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ def calc_annualize_return(self, assets, days):
2)

def calc_profitpctchange(self, assets):
return assets[::-1].pct_change()[::-1]
#return assets[::-1].pct_change()[::-1]
return assets.diff().pct_change()

def calc_beta(self, assest_profit, benchmark_profit):

Expand Down Expand Up @@ -1358,6 +1359,14 @@ def netprofio_maxloss_ratio(self, pnl):
return 0

def continue_profit_amount(self, pnl):
"""最大连续利润单数
Arguments:
pnl {[type]} -- [description]
Returns:
[type] -- [description]
"""
w = []
w1 = 0
for _, item in pnl.pnl_money.iteritems():
Expand All @@ -1372,14 +1381,22 @@ def continue_profit_amount(self, pnl):
return max(w)

def continue_loss_amount(self, pnl):
"""最大连续亏损单数
Arguments:
pnl {[type]} -- [description]
Returns:
[type] -- [description]
"""
l = []
l1 = 0
for _, item in pnl.pnl_money.iteritems():
if item > 0:
l1 += 1
elif item < 0:
l.append(l1)
l1 = 0
elif item < 0:
l1 += 1
if len(l) == 0:
return 0
else:
Expand Down
13 changes: 12 additions & 1 deletion QUANTAXIS/QAARP/market_preset.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,18 @@ def get_code(self, code):
code = code[0:-2]
else:
code = code[0:2]
return self.table.get(str(code).upper(), {})
return self.table.get(str(code).upper(), {
'name': 'default',
'unit_table': 1.0,
'price_tick': 1.0,
'buy_frozen_coeff': 1,
'sell_frozen_coeff': 1,
'exchange': 'stock_cn',
'commission_coeff_peramount': 0.001,
'commission_coeff_pervol': 0,
'commission_coeff_today_peramount': 0.001,
'commission_coeff_today_pervol': 0
})

# 合约所属交易所代码

Expand Down
2 changes: 1 addition & 1 deletion QUANTAXIS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
2017/4/8
"""

__version__ = '1.9.18'
__version__ = '1.9.20'
__author__ = 'yutiansut'

import argparse
Expand Down

0 comments on commit 0cf5fb3

Please sign in to comment.