当前位置:首页>python>量化投资置入置出策略:Python量化实战指南

量化投资置入置出策略:Python量化实战指南

  • 2026-06-29 20:01:58
量化投资置入置出策略:Python量化实战指南

置入置出策略:Python量化实战指南

一、什么是置入置出策略

置入置出策略是一种系统性的资产配置方法,通过设定明确的买入(置入)和卖出(置出)条件来实现投资组合的动态调整。这种策略的核心思想是"低买高卖",但与传统的主观判断不同,它基于量化的规则和指标来做出决策。

在量化投资领域,置入置出策略属于规则型策略的范畴,它不试图预测市场走势,而是根据预设的规则严格执行交易纪律。这种方法的优势在于能够克服人性弱点,避免情绪化交易,同时具备可回溯测试的特性。

典型的置入置出策略包含三个核心要素:

  1. 1. 置入条件:明确在什么情况下买入资产
  2. 2. 置出条件:确定在什么情况下卖出资产
  3. 3. 资金管理规则:规定每次交易的头寸大小

二、策略核心原理与理论基础

2.1 均值回归理论

许多置入置出策略基于均值回归原理,认为价格围绕其内在价值波动,最终会回归到均值水平。当价格偏离均值过大时,就产生了交易机会。

布林带指标就是基于这个原理设计的,它由三条线组成:中轨(移动平均线)、上轨(移动平均线加上两倍标准差)和下轨(移动平均线减去两倍标准差)。当价格触及下轨时,可能意味着资产被低估,是置入的信号;当价格触及上轨时,可能意味着资产被高估,是置出的信号。

2.2 动量效应理论

与均值回归相反,动量效应认为过去表现好的资产未来会继续表现好,过去表现差的资产未来会继续表现差。基于动量效应的置入置出策略会在资产显示上涨趋势时置入,在趋势反转时置出。

移动平均线交叉策略是动量策略的典型代表。当短期移动平均线从下向上穿过长期移动平均线时(金叉),产生置入信号;当短期移动平均线从上向下穿过长期移动平均线时(死叉),产生置出信号。

2.3 风险平价理论

现代投资组合理论强调通过分散投资来降低风险。置入置出策略中的资金管理部分常常应用风险平价原理,即根据资产的风险水平来分配资金,使每个资产对组合的整体风险贡献相等。

三、Python环境准备与数据获取

3.1 环境配置

在开始编写策略前,我们需要配置Python环境并安装必要的库:

# 基础数据处理库
import numpy as np
import pandas as pd

# 可视化库
import matplotlib.pyplot as plt
import seaborn as sns

# 量化分析库
import talib  # 技术指标计算
import yfinance as yf  # 金融数据获取

# 回测框架
from backtesting import Backtest, Strategy

# 设置可视化样式
plt.style.use('seaborn-v0_8')
sns.set_palette("husl")
%matplotlib inline

3.2 数据获取与处理

获取高质量的历史数据是回测成功的关键。我们可以使用yfinance库从Yahoo Finance获取数据:

deffetch_data(ticker, start_date, end_date):
"""
    获取股票历史数据
    """

    data = yf.download(ticker, start=start_date, end=end_date)
return data

# 获取苹果公司股票数据
aapl_data = fetch_data('AAPL''2010-01-01''2023-12-31')

数据预处理是确保回测准确性的重要步骤:

defpreprocess_data(data):
"""
    数据预处理函数
    """

# 检查缺失值
if data.isnull().values.any():
        data = data.fillna(method='ffill')
        data = data.fillna(method='bfill')

# 计算收益率
    data['returns'] = data['Close'].pct_change()

# 计算波动率
    data['volatility'] = data['returns'].rolling(window=20).std()

return data

# 预处理数据
aapl_data = preprocess_data(aapl_data)

四、基础置入置出策略实现

4.1 移动平均线交叉策略

移动平均线交叉策略是最经典的趋势跟踪策略之一:

classMovingAverageCrossover(Strategy):
"""
    移动平均线交叉策略
    """

# 策略参数
    n1 = 50# 短期移动平均线周期
    n2 = 200# 长期移动平均线周期

definit(self):
# 计算移动平均线
self.sma1 = self.I(talib.SMA, self.data.Close, self.n1)
self.sma2 = self.I(talib.SMA, self.data.Close, self.n2)

defnext(self):
# 金叉:短期均线上穿长期均线,买入
if crossover(self.sma1, self.sma2):
ifnotself.position:
self.buy()

# 死叉:短期均线下穿长期均线,卖出
elif crossover(self.sma2, self.sma1):
ifself.position:
self.sell()

# 回测策略
bt = Backtest(aapl_data, MovingAverageCrossover, cash=10000, commission=.002)
result = bt.run()

4.2 布林带策略实现

布林带策略基于均值回归原理:

classBollingerBandsStrategy(Strategy):
"""
    布林带策略
    """

# 策略参数
    n = 20# 移动平均周期
    dev = 2# 标准差倍数

definit(self):
# 计算布林带
self.mid_band = self.I(talib.SMA, self.data.Close, self.n)
self.std = self.I(talib.STDDEV, self.data.Close, self.n)
self.upper_band = self.mid_band + self.dev * self.std
self.lower_band = self.mid_band - self.dev * self.std

defnext(self):
# 价格触及下轨,买入
ifself.data.Close[-1] <= self.lower_band[-1]:
ifnotself.position:
self.buy()

# 价格触及上轨,卖出
elifself.data.Close[-1] >= self.upper_band[-1]:
ifself.position:
self.sell()

# 回测布林带策略
bt_bb = Backtest(aapl_data, BollingerBandsStrategy, cash=10000, commission=.002)
result_bb = bt_bb.run()

五、高级策略优化技巧

5.1 动态仓位管理

固定的仓位大小可能不是最优选择,我们可以根据市场波动性动态调整仓位:

classDynamicPositionSizing(Strategy):
"""
    动态仓位管理策略
    """

    n = 50
    risk_per_trade = 0.02# 每笔交易风险敞口

definit(self):
self.sma = self.I(talib.SMA, self.data.Close, self.n)
self.atr = self.I(talib.ATR, self.data.High, self.data.Low, self.data.Close, 14)

defnext(self):
        current_price = self.data.Close[-1]
        atr_value = self.atr[-1]

# 计算基于波动性的仓位大小
if atr_value > 0:
            position_size = (self.risk_per_trade * self.equity) / atr_value
            position_size = int(position_size / current_price) if current_price > 0else0
else:
            position_size = 0

# 趋势判断
if current_price > self.sma[-1]:
ifnotself.position:
self.buy(size=position_size)
else:
ifself.position:
self.sell()

5.2 多时间框架策略

结合多个时间框架的分析可以提高策略的稳健性:

classMultiTimeframeStrategy(Strategy):
"""
    多时间框架策略
    """

definit(self):
# 日线级别的移动平均线
self.daily_sma = self.I(talib.SMA, self.data.Close, 50)

# 周线级别的移动平均线(约等于5*50=250个交易日)
self.weekly_sma = self.I(talib.SMA, self.data.Close, 250)

defnext(self):
        price = self.data.Close[-1]
        daily_trend = price > self.daily_sma[-1]
        weekly_trend = price > self.weekly_sma[-1]

# 双重确认:日线和周线都显示上涨趋势
if daily_trend and weekly_trend:
ifnotself.position:
self.buy()
# 任一趋势转跌则卖出
elifnot daily_trend ornot weekly_trend:
ifself.position:
self.sell()

5.3 机器学习增强策略

我们可以使用简单的机器学习模型来增强传统策略:

from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import StandardScaler

classMLEnhancedStrategy(Strategy):
"""
    机器学习增强策略
    """

    lookback = 30
    training_period = 252# 一年交易日的训练数据

definit(self):
# 准备特征数据
self.features = pd.DataFrame()
self.features['returns'] = self.data.Close.pct_change()
self.features['volatility'] = self.features['returns'].rolling(20).std()
self.features['sma_ratio'] = self.data.Close / talib.SMA(self.data.Close, 50)
self.features['rsi'] = talib.RSI(self.data.Close)

self.scaler = StandardScaler()
self.model = RandomForestClassifier(n_estimators=100, random_state=42)

self.is_trained = False

defnext(self):
# 确保有足够的数据进行训练和预测
iflen(self.data) < self.training_period + self.lookback:
return

# 首次达到训练数据量时训练模型
ifnotself.is_trained andlen(self.data) == self.training_period + self.lookback:
self.train_model()
self.is_trained = True

ifself.is_trained:
# 获取当前特征
            current_features = self.get_current_features()

# 预测未来收益率方向
            prediction = self.model.predict(current_features.reshape(1, -1))[0]

# 根据预测结果执行交易
if prediction == 1andnotself.position:
self.buy()
elif prediction == 0andself.position:
self.sell()

deftrain_model(self):
# 准备训练数据
        features = []
        labels = []

for i inrange(self.lookback, self.training_period):
# 获取特征
            feature_vector = self.get_feature_vector(i)
            features.append(feature_vector)

# 创建标签:未来5天收益率为正则为1,否则为0
            future_return = self.data.Close[i+5] / self.data.Close[i] - 1
            labels.append(1if future_return > 0else0)

# 特征标准化
        features_scaled = self.scaler.fit_transform(features)

# 训练模型
self.model.fit(features_scaled, labels)

defget_feature_vector(self, index):
# 获取指定位置的特征向量
        returns = self.features['returns'].iloc[index-self.lookback:index].values
        volatility = self.features['volatility'].iloc[index-self.lookback:index].values
        sma_ratio = self.features['sma_ratio'].iloc[index-self.lookback:index].values
        rsi = self.features['rsi'].iloc[index-self.lookback:index].values

# 合并特征
        feature_vector = np.concatenate([returns, volatility, sma_ratio, rsi])
return feature_vector

defget_current_features(self):
# 获取当前的特征向量
returnself.get_feature_vector(-1)

六、策略回测与性能评估

6.1 回测框架搭建

一个完整的回测系统需要包含以下组件:

classBacktestEngine:
"""
    回测引擎
    """

def__init__(self, data, strategy_class, initial_capital=10000, commission=0.001):
self.data = data
self.strategy_class = strategy_class
self.initial_capital = initial_capital
self.commission = commission
self.results = None

defrun_backtest(self, **strategy_params):
"""
        运行回测
        """

# 创建策略实例
        strategy = self.strategy_class(**strategy_params)

# 运行回测
        bt = Backtest(self.data, strategy, 
                     cash=self.initial_capital, 
                     commission=self.commission)

self.results = bt.run()
returnself.results

defoptimize_strategy(self, param_grid):
"""
        策略参数优化
        """

        bt = Backtest(self.data, self.strategy_class, 
                     cash=self.initial_capital, 
                     commission=self.commission)

        optimization_results = bt.optimize(**param_grid)
return optimization_results

defgenerate_report(self):
"""
        生成回测报告
        """

ifself.results isNone:
raise ValueError("请先运行回测")

# 绘制权益曲线
        plt.figure(figsize=(128))

        plt.subplot(221)
self.results['Equity'].plot(title='权益曲线')
        plt.xlabel('日期')
        plt.ylabel('资金')

# 绘制回撤曲线
        plt.subplot(222)
self.results['Drawdown'].plot(title='回撤曲线')
        plt.xlabel('日期')
        plt.ylabel('回撤比例')

# 月度收益热力图
        plt.subplot(223)
        monthly_returns = self.results['Returns'].resample('M').apply(lambda x: (1+x).prod()-1)
        monthly_returns = monthly_returns.unstack()
        sns.heatmap(monthly_returns, annot=True, fmt=".2%", cmap="RdYlGn")
        plt.title('月度收益热力图')

        plt.tight_layout()
        plt.show()

# 打印关键指标
print("回测结果摘要:")
print(f"最终资金: {self.results['Equity'][-1]:.2f}")
print(f"总收益率: {self.results['Return']:.2%}")
print(f"年化收益率: {self.results['CAGR']:.2%}")
print(f"最大回撤: {self.results['Max Drawdown']:.2%}")
print(f"夏普比率: {self.results['Sharpe Ratio']:.2f}")
print(f"索提诺比率: {self.results['Sortino Ratio']:.2f}")

6.2 关键性能指标

评估策略性能时需要关注以下关键指标:

defcalculate_performance_metrics(returns, risk_free_rate=0.02):
"""
    计算策略性能指标
    """

# 年化收益率
    annual_return = (1 + returns).prod() ** (252/len(returns)) - 1

# 年化波动率
    annual_volatility = returns.std() * np.sqrt(252)

# 夏普比率
    sharpe_ratio = (annual_return - risk_free_rate) / annual_volatility

# 最大回撤
    cumulative = (1 + returns).cumprod()
    peak = cumulative.expanding().max()
    drawdown = (cumulative - peak) / peak
    max_drawdown = drawdown.min()

# 索提诺比率(只考虑下行风险)
    downside_returns = returns.copy()
    downside_returns[downside_returns > 0] = 0
    downside_volatility = downside_returns.std() * np.sqrt(252)
    sortino_ratio = (annual_return - risk_free_rate) / downside_volatility

# Calmar比率(年化收益/最大回撤)
    calmar_ratio = annual_return / abs(max_drawdown)

return {
'年化收益率': annual_return,
'年化波动率': annual_volatility,
'夏普比率': sharpe_ratio,
'最大回撤': max_drawdown,
'索提诺比率': sortino_ratio,
'Calmar比率': calmar_ratio
    }

七、实战案例:构建完整的交易系统

7.1 案例背景

假设我们要为沪深300指数构建一个置入置出策略,目标是在控制风险的前提下获得超越基准的收益。

7.2 策略设计

我们设计一个结合趋势跟踪和均值回归的混合策略:

classHybridStrategy(Strategy):
"""
    混合策略:结合趋势跟踪和均值回归
    """

# 趋势跟踪参数
    trend_period = 100

# 均值回归参数  
    mean_reversion_period = 20
    z_score_threshold = 2.0

definit(self):
# 趋势指标
self.trend_sma = self.I(talib.SMA, self.data.Close, self.trend_period)

# 均值回归指标
self.mean_sma = self.I(talib.SMA, self.data.Close, self.mean_reversion_period)
self.std = self.I(talib.STDDEV, self.data.Close, self.mean_reversion_period)

# 动量指标
self.momentum = self.I(talib.MOM, self.data.Close, 10)

defnext(self):
        current_price = self.data.Close[-1]

# 计算Z-score(均值回归指标)
ifself.std[-1] > 0:
            z_score = (current_price - self.mean_sma[-1]) / self.std[-1]
else:
            z_score = 0

# 趋势判断
        trend_bullish = current_price > self.trend_sma[-1]
        trend_bearish = current_price < self.trend_sma[-1]

# 动量判断
        momentum_bullish = self.momentum[-1] > 0
        momentum_bearish = self.momentum[-1] < 0

# 交易逻辑
# 在上升趋势中,利用短期超卖机会买入
if trend_bullish and z_score < -self.z_score_threshold and momentum_bullish:
ifnotself.position:
self.buy()

# 在下降趋势中,利用短期超买机会卖出
elif trend_bearish and z_score > self.z_score_threshold and momentum_bearish:
ifself.position:
self.sell()

# 趋势反转时清仓
if (trend_bullish andself.position and
            (z_score > self.z_score_threshold ornot momentum_bullish)):
self.sell()

if (trend_bearish andnotself.position and
            (z_score < -self.z_score_threshold ornot momentum_bearish)):
self.buy()

7.3 回测结果分析

运行策略并分析结果:

# 获取沪深300数据
csi300_data = fetch_data('000300.SS''2015-01-01''2023-12-31')
csi300_data = preprocess_data(csi300_data)

# 创建回测引擎
backtest_engine = BacktestEngine(csi300_data, HybridStrategy, 
                                initial_capital=100000
                                commission=0.001)

# 运行回测
results = backtest_engine.run_backtest()

# 生成报告
backtest_engine.generate_report()

# 与基准对比
benchmark_returns = csi300_data['Close'].pct_change().dropna()
strategy_returns = results['Returns']

comparison = pd.DataFrame({
'策略': strategy_returns,
'基准': benchmark_returns
}).dropna()

# 计算累计收益
cumulative_returns = (1 + comparison).cumprod()

# 绘制对比图
plt.figure(figsize=(126))
cumulative_returns.plot()
plt.title('策略 vs 基准累计收益')
plt.xlabel('日期')
plt.ylabel('累计收益')
plt.legend(['策略''基准'])
plt.show()

7.4 风险控制与资金管理

在实际交易中,风险控制至关重要:

classRiskManagedStrategy(HybridStrategy):
"""
    带风险控制的混合策略
    """

    max_position_size = 0.1# 单笔最大仓位
    max_drawdown_limit = -0.2# 最大回撤限制
    volatility_limit = 0.3# 波动率限制

definit(self):
super().init()
self.portfolio_value = []

defnext(self):
# 检查风险限制
ifself.check_risk_limits():
# 如果触达风险限制,清仓并暂停交易
ifself.position:
self.sell()
return

# 正常执行交易逻辑
super().next()

# 记录组合价值
self.portfolio_value.append(self.equity)

defcheck_risk_limits(self):
"""
        检查各种风险限制
        """

# 计算当前回撤
iflen(self.portfolio_value) > 0:
            current_value = self.equity
            peak = max(self.portfolio_value)
            drawdown = (current_value - peak) / peak

if drawdown < self.max_drawdown_limit:
returnTrue

# 检查波动率限制
iflen(self.portfolio_value) > 20:
            returns = pd.Series(self.portfolio_value).pct_change().dropna()
            volatility = returns.std() * np.sqrt(252)

if volatility > self.volatility_limit:
returnTrue

returnFalse

八、策略部署与实盘注意事项

8.1 实盘交易系统架构

一个完整的实盘交易系统包含以下组件:

classLiveTradingSystem:
"""
    实盘交易系统
    """

def__init__(self, strategy, data_source, broker_api):
self.strategy = strategy
self.data_source = data_source
self.broker_api = broker_api
self.positions = {}
self.performance = {}

defrun(self):
"""
        运行实盘交易系统
        """

whileTrue:
try:
# 获取实时数据
                data = self.data_source.get_latest_data()

# 生成交易信号
                signal = self.strategy.generate_signal(data)

# 执行交易
if signal:
self.execute_trade(signal)

# 监控风险
self.monitor_risk()

# 记录性能
self.record_performance()

# 等待下一次迭代
                time.sleep(60)  # 每分钟检查一次

except Exception as e:
self.handle_error(e)

defexecute_trade(self, signal):
"""
        执行交易
        """

# 根据信号类型执行买卖操作
if signal['action'] == 'buy':
# 计算仓位大小
            position_size = self.calculate_position_size(signal)

# 下单
            order = self.broker_api.place_order(
                symbol=signal['symbol'],
                quantity=position_size,
                side='buy'
            )

# 更新持仓
self.positions[signal['symbol']] = {
'size': position_size,
'entry_price': order['price'],
'entry_time': datetime.now()
            }

elif signal['action'] == 'sell':
if signal['symbol'inself.positions:
# 平仓
                position = self.positions[signal['symbol']]
                order = self.broker_api.place_order(
                    symbol=signal['symbol'],
                    quantity=position['size'],
                    side='sell'
                )

# 计算盈亏
                pnl = (order['price'] - position['entry_price']) * position['size']

# 记录交易结果
self.record_trade(signal, order, pnl)

# 移除持仓
delself.positions[signal['symbol']]

defcalculate_position_size(self, signal):
"""
        根据风险模型计算仓位大小
        """

# 获取账户信息
        account_info = self.broker_api.get_account_info()
        equity = account_info['equity']

# 获取波动性数据
        volatility = self.data_source.get_volatility(signal['symbol'])

# 计算基于风险的仓位大小
        risk_per_trade = equity * 0.01# 每笔交易风险为资产的1%

if volatility > 0:
            position_size = risk_per_trade / volatility
else:
            position_size = risk_per_trade / (signal['price'] * 0.01)  # 默认1%的波动

# 确保不超过最大仓位限制
        max_position = equity * 0.1# 单笔最大仓位为10%
        position_size = min(position_size, max_position / signal['price'])

returnint(position_size)

defmonitor_risk(self):
"""
        实时监控风险
        """

# 检查单资产风险
for symbol, position inself.positions.items():
            current_price = self.data_source.get_current_price(symbol)
            unrealized_pnl = (current_price - position['entry_price']) * position['size']

# 如果亏损超过阈值,强制平仓
if unrealized_pnl < -position['entry_price'] * position['size'] * 0.05:  # 亏损超过5%
self.force_liquidate(symbol)

# 检查组合风险
        total_equity = self.broker_api.get_account_info()['equity']
if total_equity < self.initial_capital * 0.8:  # 总资金回撤超过20%
self.force_liquidate_all()

defforce_liquidate(self, symbol):
"""
        强制平仓单个资产
        """

if symbol inself.positions:
            position = self.positions[symbol]
self.broker_api.place_order(
                symbol=symbol,
                quantity=position['size'],
                side='sell'
            )
delself.positions[symbol]

defforce_liquidate_all(self):
"""
        强制平仓所有资产
        """

for symbol inlist(self.positions.keys()):
self.force_liquidate(symbol)

8.2 实盘交易注意事项

  1. 1. 交易成本考虑:实盘交易需要充分考虑佣金、滑点和税费的影响
  2. 2. 数据延迟处理:实时数据可能存在延迟,需要有相应的处理机制
  3. 3. 系统稳定性:确保交易系统7×24小时稳定运行
  4. 4. 异常处理:完善的异常处理机制,避免因单次错误导致系统崩溃
  5. 5. 监控与报警:设置监控和报警系统,及时发现和处理问题

九、总结与展望

置入置出策略是量化投资中的重要组成部分,通过系统性的方法实现资产的买入和卖出决策。本文从基础理论到实战应用,详细介绍了各种置入置出策略的实现方法。

9.1 关键要点总结

  1. 1. 策略多样性:从简单的移动平均线交叉到复杂的机器学习增强策略,各有适用场景
  2. 2. 风险控制:合理的风险控制是策略成功的关键
  3. 3. 系统化执行:避免情绪化决策,坚持系统化交易
  4. 4. 持续优化:市场环境不断变化,策略需要持续优化和调整

9.2 未来发展方向

  1. 1. 人工智能应用:深度学习等先进AI技术在策略开发中的应用
  2. 2. 另类数据:社交媒体情绪、卫星图像等另类数据在策略中的应用
  3. 3. 跨市场策略:全球多个市场的资产配置策略
  4. 4. 实时学习:能够实时适应市场变化的自适应策略

置入置出策略的世界充满了机遇与挑战。希望通过本文的介绍,能够帮助读者建立起系统化的交易思维,并在实践中不断优化和完善自己的交易策略。记住,没有永远有效的策略,只有不断学习和适应的交易者。

免费读1000本书

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-04 09:33:50 HTTP/2.0 GET : https://f.mffb.com.cn/a/488267.html
  2. 运行时间 : 0.138598s [ 吞吐率:7.22req/s ] 内存消耗:4,776.53kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=2ed1b8cffdc60c6f3fbbd91b3f7cae2e
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000906s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000834s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000344s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000279s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000481s ]
  6. SELECT * FROM `set` [ RunTime:0.000245s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000560s ]
  8. SELECT * FROM `article` WHERE `id` = 488267 LIMIT 1 [ RunTime:0.000888s ]
  9. UPDATE `article` SET `lasttime` = 1783128830 WHERE `id` = 488267 [ RunTime:0.016016s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000419s ]
  11. SELECT * FROM `article` WHERE `id` < 488267 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000560s ]
  12. SELECT * FROM `article` WHERE `id` > 488267 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001214s ]
  13. SELECT * FROM `article` WHERE `id` < 488267 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.002172s ]
  14. SELECT * FROM `article` WHERE `id` < 488267 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001293s ]
  15. SELECT * FROM `article` WHERE `id` < 488267 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001228s ]
0.140185s