MCPcopy Create free account
hub / github.com/DVampire/FinAgent / get_recent_history

Method get_recent_history

finagent/memory/interface.py:141–161  ·  view source on GitHub ↗
(
        self,
        type: str,
        symbol: str,
        k: int = 1,
    )

Source from the content-addressed store, hash-verified

139 print(f"Add recent history for {type} {symbol}.")
140
141 def get_recent_history(
142 self,
143 type: str,
144 symbol: str,
145 k: int = 1,
146 ) -> List[Any]:
147
148 assert k <= self.max_recent_steps, f"k = {k} should be less than max_recent_steps = {self.max_recent_steps}."
149
150 recent_history = []
151 recent_history_ = self._get_recent_history(type, symbol)
152 for item in recent_history_:
153 recent_history.append(item)
154
155 if len(recent_history) < k:
156 res = recent_history
157 else:
158 res = recent_history[-k:]
159
160 print(f"Get recent history for {type} {symbol}.")
161 return res
162
163 def load_local(
164 self,

Callers

nothing calls this directly

Calls 1

_get_recent_historyMethod · 0.95

Tested by

no test coverage detected