def daily_close(self): Portfolio.daily_close(self) r = [ [self.result.date, self.profit_o, self.price_o, self.price_c, self.price_p, self.hold_c, self.hold_p] ] df = pd.DataFrame(r, columns=['datetime', 'profit_o','price_o', 'price_c', 'price_p', 'hold_c', 'hold_p']) fn = get_dss() + 'fut/engine/follow/portfolio_' + self.name_second + '_save.csv' if os.path.exists(fn): df.to_csv(fn, index=False, mode='a', header=False) else: df.to_csv(fn, index=False)
def daily_close(self): Portfolio.daily_close(self) fn = get_dss() + 'fut/engine/sdiffer/portfolio_sdiffer_param.csv' df = pd.read_csv(fn) for i, row in df.iterrows(): if row.date == self.result.date[: 10] and row.source == 'sdiffer' and row.hold_m0 == 0: df.at[i, 'state'] = 'stop' df = df[(df.state == 'run') | (df.date == self.result.date[:10])] df.to_csv(fn, index=False)
def daily_close(self): Portfolio.daily_close(self) fn = get_dss() + 'fut/engine/ratio/portfolio_ratio_param.csv' df = pd.read_csv(fn) for i, row in df.iterrows(): if row.date == self.result.date[: 10] and row.hold_b == 0 and row.hold_s == 0: df.at[i, 'state'] = 'stop' df = df[(df.state == 'run') | (df.date >= get_trade_preday(self.result.date[:10]))] df.to_csv(fn, index=False)
def daily_close(self): Portfolio.daily_close(self) r = [ [self.result.date, self.symbol_c, self.symbol_p, self.strike_high, self.strike_low, \ self.profit_o, self.price_o, self.price_c, self.price_p, self.hold_c, self.hold_p] ] df = pd.DataFrame(r, columns=[ 'datetime', 'symbol_c', 'symbol_p', 'strike_high', 'strike_low', 'profit_o', 'price_o', 'price_c', 'price_p', 'hold_c', 'hold_p' ]) fn = get_dss() + 'fut/engine/follow/portfolio_follow_param.csv' if os.path.exists(fn): df.to_csv(fn, index=False, mode='a', header=False) else: df.to_csv(fn, index=False)
def daily_close(self): Portfolio.daily_close(self)