当前位置:首页>python>使用Python进行事件驱动型量化回测(续4)

使用Python进行事件驱动型量化回测(续4)

  • 2026-02-05 01:05:35
使用Python进行事件驱动型量化回测(续4)

在上一篇关于事件驱动回测的文章中,我们探讨了如何构建策略类层级结构。此处所定义的策略主要用于生成交易信号,而投资组合对象则依据这些信号决定是否发送订单指令。与先前处理方式一致,我们很自然地会创建一个投资组合抽象基类(Portfolio ABC),供后续所有子类继承。

本文将介绍NaivePortfolio(简易投资组合)对象,主要实现两项功能:实时追踪投资组合持仓状态,并根据交易信号生成固定数量的股票订单。后续文章会深入探讨更复杂的投资组合对象,这些对象将整合更完善的风险管理工具,这将是以后文章的主题。

持仓追踪与订单管理

投资组合订单管理系统或许是事件驱动回测框架中最复杂的组成部分。其主要职责在于持续追踪所有当前市场持仓及其对应的市值,即持仓额。这本质上是对持仓清算价值的一个预估,其计算部分依赖于回测系统的数据处理功能。

除持仓与市值管理外,投资组合系统还需整合风险因子分析与持仓规模控制技术,以便优化发送至券商或其他市场接入渠道的交易指令。

延用事件类层级结构的设计思路,投资组合对象必须具备处理信号事件、生成订单事件以及解析成交事件以更新持仓状态的能力。因此,投资组合对象常成为事件驱动系统中代码量最庞大的模块也就不足为奇。

实现方案

我们将创建新的portfolio.py文件并导入必要库,这与大多数其他抽象基类实现方式类似。需要从math 库中导入floor函数,以便生成整数单位的订单规模。同时还需FillEvent 和OrderEvent 对象,因为投资组合系统将同时处理这两类事件。

# portfolio.pyimport datetimeimport numpy as npimport pandas as pdimport Queuefrom abc import ABCMeta, abstractmethodfrom math import floorfrom event import FillEvent, OrderEvent
与之前一样,我们为Portfolio创建一个抽象基类,其中定义两个纯虚方法:update_signalupdate_fill。前者负责处理从事件队列获取的新交易信号,后者则处理来自执行处理程序对象的成交信息。
# portfolio.pyclass Portfolio(object):    """    The Portfolio class handles the positions and market    value of all instruments at a resolution of a "bar",    i.e. secondly, minutely, 5-min, 30-min, 60 min or EOD.    """    __metaclass__ = ABCMeta    @abstractmethod    def update_signal(self, event):        """        Acts on a SignalEvent to generate new orders         based on the portfolio logic.        """        raise NotImplementedError("Should implement update_signal()")    @abstractmethod    def update_fill(self, event):        """        Updates the portfolio current positions and holdings         from a FillEvent.        """        raise NotImplementedError("Should implement update_fill()")

本文的核心内容是介绍NaivePortfolio(简易投资组合)类。该类设计用于管理持仓规模与当前持仓市值,但会以一种"机械"的方式执行交易指令——无论账户持有资金状况如何,都直接将预设固定数量的订单发送至券商。这些设定虽不符合实际交易场景,但有助于勾勒出投资组合订单管理系统在事件驱动框架中的运作机理。

NaivePortfolio 需要初始化资本值(本文默认设为100,000美元)及起始时间戳两个参数。

该投资组合类包含all_positions(全量持仓记录)与current_positions(当前持仓)。前者按市场数据事件时间戳存储所有历史持仓记录,其中持仓量仅代表资产数量(负值表示该资产已被做空);后者以字典形式存储最近一个市场数据更新周期的当前持仓状态。

除持仓管理成员外,投资组合还设有holdings(持仓市值)模块,用于记录所持持仓的当前市场估值。此处的"当前市场估值"指代当前市场K线的收盘价——这显然是一种近似处理,但现阶段足以满足分析需求。all_holdings存储所有交易品种的历史持仓市值列表,而current_holdings则保存最新时点所有品种持仓市值的字典映射。

# portfolio.pyclass NaivePortfolio(Portfolio):    """    The NaivePortfolio object is designed to send orders to    a brokerage object with a constant quantity size blindly,    i.e. without any risk management or position sizing. It is    used to test simpler strategies such as BuyAndHoldStrategy.    """    def __init__(self, bars, events, start_date, initial_capital=100000.0):        """        Initialises the portfolio with bars and an event queue.         Also includes a starting datetime index and initial capital         (USD unless otherwise stated).        Parameters:        bars - The DataHandler object with current market data.        events - The Event Queue object.        start_date - The start date (bar) of the portfolio.        initial_capital - The starting capital in USD.        """        self.bars = bars        self.events = events        self.symbol_list = self.bars.symbol_list        self.start_date = start_date        self.initial_capital = initial_capital        self.all_positions = self.construct_all_positions()        self.current_positions = dict( (k,v) for k, v in [(s, 0for s in self.symbol_list] )        self.all_holdings = self.construct_all_holdings()        self.current_holdings = self.construct_current_holdings()

接下来用construct_all_positions方法,创建每个交易品种对应的字典,将初始持仓量设为零,并添加时间戳键,最终将其存入列表。该方法采用dictionary comprehension字典推导式实现,其设计理念与列表推导式相似:

# portfolio.py    def construct_all_positions(self):        """        Constructs the positions list using the start_date        to determine when the time index will begin.        """        d = dict( (k,v) for k, v in [(s, 0for s in self.symbol_list] )        d['datetime'] = self.start_date        return [d]

construct_all_holdings 的实现逻辑与上文相似,但额外增加了三个关键字段:cash(现金余额)、commission(累计佣金)和 total(总权益)。这些字段分别代表账户在完成所有交易后的可用现金、累计产生的佣金支出,以及包含现金与所有未平仓持仓在内的账户总权益。其中空头持仓按负值计算。初始现金余额与账户总权益均设置为初始入金金额:

# portfolio.py    def construct_all_holdings(self):        """        Constructs the holdings list using the start_date        to determine when the time index will begin.        """        d = dict( (k,v) for k, v in [(s, 0.0for s in self.symbol_list] )        d['datetime'] = self.start_date        d['cash'] = self.initial_capital        d['commission'] = 0.0        d['total'] = self.initial_capital        return [d]

接下来的 coconstruct_current_holdings 与上述方法几乎完全相同,唯一的区别在于它不会将生成的字典包装在列表中:

# portfolio.py    def construct_current_holdings(self):        """        This constructs the dictionary which will hold the instantaneous        value of the portfolio across all symbols.        """        d = dict( (k,v) for k, v in [(s, 0.0for s in self.symbol_list] )        d['cash'] = self.initial_capital        d['commission'] = 0.0        d['total'] = self.initial_capital        return d

每当"心跳信号"触发时——即每次从DataHandler数据处理对象请求新的市场数据时,投资组合必须更新所有持仓的当前市值。在实盘交易场景中,这些信息可直接从券商处下载解析,但在回测系统中需要手动计算这些数值。

由于买卖价差和流动性因素影响,现实中并不存在所谓"精确的当前市值"。因此需要通过持仓数量乘以"价格"来进行估算。本文采用的方法是使用最近接收到的K线收盘价进行计算。对于日内交易策略而言,这种方法相对符合实际;但对于日线策略则存在较大偏差,因为开盘价可能与前一交易日收盘价存在显著差异。

update_timeindex 会负责处理持仓市值更新。首先它会从市场数据处理器获取最新价格,并通过将"新持仓"设定为"当前持仓"来创建新的交易品种持仓字典,这些持仓值只有在后续接收到成交事件时才会改变,这将在后续的投资组合中处理。接着,它还会将这组当前持仓记录追加至all_positions全量持仓列表。随后,系统将以类似方式更新持仓市值数据,区别在于需要将当前持仓数量乘以最新K线的收盘价(self.current_positions[s] * bars[s][0][5])重新计算。最后,新的持仓市值记录将被追加至all_holdings全量市值列表:
# portfolio.py    def update_timeindex(self, event):        """        Adds a new record to the positions matrix for the current         market data bar. This reflects the PREVIOUS bar, i.e. all        current market data at this stage is known (OLHCVI).        Makes use of a MarketEvent from the events queue.        """        bars = {}        for sym in self.symbol_list:            bars[sym] = self.bars.get_latest_bars(sym, N=1)        # Update positions        dp = dict( (k,v) for k, v in [(s, 0for s in self.symbol_list] )        dp['datetime'] = bars[self.symbol_list[0]][0][1]        for s in self.symbol_list:            dp[s] = self.current_positions[s]        # Append the current positions        self.all_positions.append(dp)        # Update holdings        dh = dict( (k,v) for k, v in [(s, 0for s in self.symbol_list] )        dh['datetime'] = bars[self.symbol_list[0]][0][1]        dh['cash'] = self.current_holdings['cash']        dh['commission'] = self.current_holdings['commission']        dh['total'] = self.current_holdings['cash']        for s in self.symbol_list:            # Approximation to the real value            market_value = self.current_positions[s] * bars[s][0][5]            dh[s] = market_value            dh['total'] += market_value        # Append the current holdings        self.all_holdings.append(dh)
update_positions_from_fill通过判断成交事件属于买入或卖出操作,相应地在 current_positions 字典中增减对应数量的股票份额:
# portfolio.py    def update_positions_from_fill(self, fill):        """        Takes a FilltEvent object and updates the position matrix        to reflect the new position.        Parameters:        fill - The FillEvent object to update the positions with.        """        # Check whether the fill is a buy or sell        fill_dir = 0        if fill.direction == 'BUY':            fill_dir = 1        if fill.direction == 'SELL':            fill_dir = -1        # Update positions list with new quantities        self.current_positions[fill.symbol] += fill_dir*fill.quantity

对应的update_holdings_from_fill方法与上述方法类似,但更新的是持仓额数值。为了模拟成交的成本,该方法不会直接使用FillEvent成交事件中关联的成本数据。为什么这么做呢?简而言之,在回测环境中实际的成交成本是未知的,因此必须进行估算。这里将成交成本设定为"当前市场价格"(即最近一根K线的收盘价)。随后特定品种的持仓价值将按成交成本乘以交易数量进行计算。

确定成交成本后,即可更新当前持仓价值、现金余额及总权益数据。累计佣金支出也将同步更新:

# portfolio.py    def update_holdings_from_fill(self, fill):        """        Takes a FillEvent object and updates the holdings matrix        to reflect the holdings value.        Parameters:        fill - The FillEvent object to update the holdings with.        """        # Check whether the fill is a buy or sell        fill_dir = 0        if fill.direction == 'BUY':            fill_dir = 1        if fill.direction == 'SELL':            fill_dir = -1        # Update holdings list with new quantities        fill_cost = self.bars.get_latest_bars(fill.symbol)[0][5]  # Close price        cost = fill_dir * fill_cost * fill.quantity        self.current_holdings[fill.symbol] += cost        self.current_holdings['commission'] += fill.commission        self.current_holdings['cash'] -= (cost + fill.commission)        self.current_holdings['total'] -= (cost + fill.commission)

这里实现了Portfolio ABC投资组合抽象基类中的纯虚方法update_fill,它只是简单的执行了前文已讨论过的两个前置方法:update_positions_from_fill 与 update_holdings_from_fill

# portfolio.py    def update_fill(self, event):        """        Updates the portfolio current positions and holdings         from a FillEvent.        """        if event.type == 'FILL':            self.update_positions_from_fill(event)            self.update_holdings_from_fill(event)

投资组合对象除了需要处理成交事件外,还必须负责在接收到一个或多个SignalEvent时生成OrderEventsgenerate_naive_order方法仅根据做多或做空资产的信号,直接发送交易100股该资产的订单。此处100这个数值是任意设定的。在实盘中,该数值应由风险管理或持仓规模调整模块决定。但作为NaivePortfolio,它"机械地"将所有信号直接转化为订单,而未经过风险系统过滤。

该方法根据当前持仓数量及特定交易品种,处理建立多头、空头及平仓操作,随后生成对应的订单事件对象:

# portfolio.py    def generate_naive_order(self, signal):        """        Simply transacts an OrderEvent object as a constant quantity        sizing of the signal object, without risk management or        position sizing considerations.        Parameters:        signal - The SignalEvent signal information.        """        order = None        symbol = signal.symbol        direction = signal.signal_type        strength = signal.strength        mkt_quantity = floor(100 * strength)        cur_quantity = self.current_positions[symbol]        order_type = 'MKT'        if direction == 'LONG' and cur_quantity == 0:            order = OrderEvent(symbol, order_type, mkt_quantity, 'BUY')        if direction == 'SHORT' and cur_quantity == 0:            order = OrderEvent(symbol, order_type, mkt_quantity, 'SELL')           if direction == 'EXIT' and cur_quantity > 0:            order = OrderEvent(symbol, order_type, abs(cur_quantity), 'SELL')        if direction == 'EXIT' and cur_quantity < 0:            order = OrderEvent(symbol, order_type, abs(cur_quantity), 'BUY')        return order

我们用update_signal 调用上述方法,并将生成的订单添加到事件队列中:

# portfolio.py    def update_signal(self, event):        """        Acts on a SignalEvent to generate new orders         based on the portfolio logic.        """        if event.type == 'SIGNAL':            order_event = self.generate_naive_order(event)            self.events.put(order_event)
NaivePortfolio 中的最后一个方法是生成资金曲线。这一步骤通过创建收益率序列,并将资金曲线按百分比进行归一化处理,使得账户初始规模等于1.0:
# portfolio.py    def create_equity_curve_dataframe(self):        """        Creates a pandas DataFrame from the all_holdings        list of dictionaries.        """        curve = pd.DataFrame(self.all_holdings)        curve.set_index('datetime', inplace=True)        curve['returns'] = curve['total'].pct_change()        curve['equity_curve'] = (1.0+curve['returns']).cumprod()        self.equity_curve = curve

Portfolio投资组合对象是整个事件驱动回测系统中最复杂的组成部分。虽然当前实现方案在仓位处理上相对基础,但其内部结构已相当复杂。后续的版本将纳入风险管理与持仓规模控制模块,这将使策略绩效评估更贴近真实交易场景。

下一篇文章我们将探讨事件驱动回测系统的最后一个核心组件——ExecutionHandler执行处理器。该组件负责接收OrderEvent订单事件对象,并据此生成对应的FillEvent成交事件对象。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-07 13:35:45 HTTP/2.0 GET : https://f.mffb.com.cn/a/472824.html
  2. 运行时间 : 0.232992s [ 吞吐率:4.29req/s ] 内存消耗:4,749.21kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=3b53a06b54a7f22dd68d33ff779da89d
  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.002072s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001064s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.017281s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.012035s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.002033s ]
  6. SELECT * FROM `set` [ RunTime:0.008993s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001984s ]
  8. SELECT * FROM `article` WHERE `id` = 472824 LIMIT 1 [ RunTime:0.008771s ]
  9. UPDATE `article` SET `lasttime` = 1770442545 WHERE `id` = 472824 [ RunTime:0.006751s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.014784s ]
  11. SELECT * FROM `article` WHERE `id` < 472824 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.010204s ]
  12. SELECT * FROM `article` WHERE `id` > 472824 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.017527s ]
  13. SELECT * FROM `article` WHERE `id` < 472824 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.019872s ]
  14. SELECT * FROM `article` WHERE `id` < 472824 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.014175s ]
  15. SELECT * FROM `article` WHERE `id` < 472824 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.021297s ]
0.234566s