Martingale42/nautilus-dev / skills/nt-trading
nt-trading
VerifiedUse when working with strategy logic, order execution, risk management, position/portfolio tracking, or exec algorithms in NautilusTrader.
templates/actor.py
View on GitHub# -------------------------------------------------------------------------------------------------
# NautilusTrader Actor Template
#
# Subclass Actor for non-trading components: data processing, signal publishing,
# monitoring, or any component that does NOT submit orders.
# For components that trade, use Strategy instead.
# -------------------------------------------------------------------------------------------------
from nautilus_trader.common.actor import Actor
from nautilus_trader.common.config import ActorConfig
from nautilus_trader.core.data import Data
from nautilus_trader.model.data import Bar
from nautilus_trader.model.data import BarType
class MyActorConfig(ActorConfig, frozen=True):
"""Configuration for MyActor."""
bar_type: str = None
# TODO: Add actor-specific config parameters
class MyActor(Actor):
"""
TODO: Describe actor purpose (data processing, signal generation, monitoring, etc.)
"""
def __init__(self, config: MyActorConfig):
super().__init__(config)
self.bar_type = BarType.from_str(config.bar_type)
# TODO: Initialize state
def on_start(self):
"""Called once when the actor starts."""
self.subscribe_bars(self.bar_type)
# TODO: Subscribe to data sources
def on_bar(self, bar: Bar):
"""Called on each bar update."""
# TODO: Process data, compute signals
#
# Publish signals to other actors/strategies via msgbus:
# self.publish_signal(name="my_signal", value=computed_value)
pass
def on_data(self, data: Data):
"""Called on generic data updates (CustomData, etc.)."""
pass
def on_signal(self, signal: Data):
"""Called when receiving signals from other actors."""
pass
def on_stop(self):
"""Called when the actor stops."""
pass
def on_reset(self):
"""Called when the actor is reset."""
pass
def on_save(self) -> dict[str, bytes]:
"""Return state to persist."""
return {}
def on_load(self, state: dict[str, bytes]) -> None:
"""Restore persisted state."""
pass
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |