fb2fcf7eed15c6b3dca45cb1e7b392836cdd50e4,QUANTAXIS/QAARP/QAAccount.py,QA_Account,hold_table,#QA_Account#Any#,236

Before Change



    def hold_table(self, datetime):
        "到某一个时刻的持仓 如果给的是日期,则返回当日收盘是的持仓"
        if len(datetime) == 10:
            datetime = "{} 15:00:00".format(datetime)
        return self.history_table.set_index("datetime").loc[:datetime].groupby("code").amount.sum().sort_index()

    def reset_assets(self, init_assets=None):
        "reset_history/cash/"

After Change



    def hold_table(self, datetime):
        "到某一个时刻的持仓 如果给的是日期,则返回当日开盘前的持仓"
        if datetime is None:
            return self.history_table.set_index("datetime").sort_index().groupby("code").amount.sum().sort_index()
        else:
            return self.history_table.set_index("datetime").sort_index().loc[:datetime].groupby("code").amount.sum().sort_index()

    def hold_price(self, datetime=None):
        "计算持仓成本  如果给的是日期,则返回当日开盘前的持仓"
        def weights(x): return np.average(x["price"], weights=x["amount"])
        if datetime is None:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: fb2fcf7eed15c6b3dca45cb1e7b392836cdd50e4
Time: 2018-05-20
Author: yutiansut@qq.com
File Name: QUANTAXIS/QAARP/QAAccount.py
Class Name: QA_Account
Method Name: hold_table


Project Name: QUANTAXIS/QUANTAXIS
Commit Name: f083111608442549981060baf35e521be8d61af9
Time: 2017-06-15
Author: yutiansut@qq.com
File Name: QUANTAXIS/QAFetch/QATushare.py
Class Name:
Method Name: QA_fetch_get_stock_day


Project Name: commonsense/conceptnet5
Commit Name: e843bf1f958bc62866bbb434f785e1470f7f1683
Time: 2019-07-01
Author: rspeer@luminoso.com
File Name: conceptnet5/vectors/retrofit.py
Class Name:
Method Name: join_shards