Skip to content

Commit

Permalink
fixed missing doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dekkers committed May 7, 2023
1 parent 76392b6 commit b945656
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion roboquant-ta/src/main/kotlin/org/roboquant/ta/AtrPolicy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class AtrPolicy(
private val data = PriceBarSeries(atrPeriod + 1) // we need 1 observation extra
private val talib = TaLib()

/**
* @see FlexPolicy.calcSize
*/
override fun calcSize(amount: Double, signal: Signal, price: Double): Size {
val asset = signal.asset

Expand All @@ -87,6 +90,9 @@ class AtrPolicy(
}
}

/**
* @see FlexPolicy.act
*/
override fun act(signals: List<Signal>, account: Account, event: Event): List<Order> {
data.addAll(event)
return super.act(signals, account, event)
Expand All @@ -100,6 +106,9 @@ class AtrPolicy(
return talib.atr(serie, atrPeriod).coerceAtLeast(minAtr)
}

/**
* @see FlexPolicy.createOrder
*/
override fun createOrder(signal: Signal, size: Size, price: Double): Order? {
val asset = signal.asset

Expand All @@ -118,7 +127,9 @@ class AtrPolicy(
return BracketOrder(entry, takeProfit, stopLoss)
}


/**
* @see FlexPolicy.start
*/
override fun start(runPhase: RunPhase) {
super.start(runPhase)
data.clear()
Expand Down

0 comments on commit b945656

Please sign in to comment.