Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Signal

The output of a Strategy is a list of Signal objects. Each signal contains three pieces of information:

There are several ways to create a signal:

ConstructorratingtypeUse
Signal.buy(asset)1.0ENTRY_EXITStrong buy
Signal.sell(asset)-1.0ENTRY_EXITStrong sell
Signal.buy(asset, SignalType.ENTRY)1.0ENTRYOnly open/increase a position
Signal.sell(asset, SignalType.EXIT)-1.0EXITOnly close/reduce a position
Signal(asset, rating, type)customcustomFull control
from roboquant import Stock, Signal, SignalType

apple = Stock("AAPL")

buy = Signal.buy(apple)
print(buy)

sell = Signal.sell(apple, SignalType.EXIT)
print(sell)

custom = Signal(apple, 0.5, SignalType.ENTRY)
print(custom)
Signal(asset=Stock(symbol='AAPL', currency='USD'), rating=1.0, type=ENTRY_EXIT)
Signal(asset=Stock(symbol='AAPL', currency='USD'), rating=-1.0, type=EXIT)
Signal(asset=Stock(symbol='AAPL', currency='USD'), rating=0.5, type=ENTRY)

Some of the convenience properties on a signal: is_buy, is_sell, is_entry, and is_exit.