public class JanuaryEffectStrategy extends Object implements Strategy
Using this example. Demonstrates timer-driven trading across a year boundary. initialize subscribes to the product and schedules a timer; each timer schedules the next day, buys one unit after buyTime and closes that unit after sellTime. A calendar timer is not itself a tradable market observation, and sendOrder does not guarantee a fill.
Model and publication. No single original research publication is claimed for this library/example policy.
Implementation in this tutorial. This is a calendar-rule illustration: schedule daily callbacks, open one unit near year-end and flatten after the configured new-year date. The code does not estimate a seasonal premium or implement a causal explanation of the January effect. It is not presented as a replication of a specific empirical publication.
Strategy.Param| Constructor and Description |
|---|
JanuaryEffectStrategy(Product product,
MonthDay buyTime,
MonthDay sellTime)
Constructs a new instance of the strategy.
|
| Modifier and Type | Method and Description |
|---|---|
void |
initialize(TraderContext ctx) |
void |
onEvent(TraderContext ctx,
Event evt) |
public JanuaryEffectStrategy(Product product, MonthDay buyTime, MonthDay sellTime)
product - the product to tradebuyTime - the date after which we buy at the end of the yearsellTime - the date after which we sell at the beginning of the yearpublic void initialize(TraderContext ctx)
initialize in interface Strategypublic void onEvent(TraderContext ctx, Event evt)
Copyright © 2026. All rights reserved.