hello_world.py 659 B

12345678910111213141516171819202122232425
  1. from __future__ import annotations
  2. from src.trader_mcp.strategy_sdk import Strategy
  3. class Strategy(Strategy):
  4. TICK_MINUTES = 0.2
  5. CONFIG_SCHEMA = {
  6. "label": {"type": "string", "default": "hello world"},
  7. }
  8. def init(self):
  9. return {"counter": 0}
  10. def on_tick(self, tick):
  11. self.state["counter"] += 1
  12. return self.state["counter"]
  13. def render(self):
  14. return {
  15. "widgets": [
  16. {"type": "text", "label": "message", "value": self.config.get("label", "hello world")},
  17. {"type": "metric", "label": "ticks", "value": self.state["counter"]},
  18. ]
  19. }