-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 981 send to market for basket trades fake oms (#986)
* #981 Added first cut of the OmsApi into example code. * #981 Added first cut of the OmsApi into example code. * #981 Added first test of send basket to market * #981 Added first cut of the OmsApi into example code. * #981 Added small fixes for basket service * #981 Added first working version of the happy acker * #981 fixed bug in Happy Acker with totalFileldQty. * #981 Added better fill model logic * #981 disabled semgrep warning, as demo is deliberately predictable on random
- Loading branch information
1 parent
1740ebb
commit 220c08e
Showing
17 changed files
with
520 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...in/scala/org/finos/vuu/core/module/basket/provider/BasketTradingConstituentProvider.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.finos.vuu.core.module.basket.provider | ||
|
||
import org.finos.toolbox.lifecycle.LifecycleContainer | ||
import org.finos.toolbox.thread.LifeCycleRunner | ||
import org.finos.toolbox.time.Clock | ||
import org.finos.vuu.core.module.basket.service.OrderStates | ||
import org.finos.vuu.core.table.{DataTable, RowWithData} | ||
import org.finos.vuu.order.oms._ | ||
import org.finos.vuu.provider.DefaultProvider | ||
|
||
class BasketTradingConstituentProvider(val table: DataTable, val omsApi: OmsApi)(implicit lifecycle: LifecycleContainer, clock: Clock) extends DefaultProvider { | ||
|
||
private val runner = new LifeCycleRunner("TradingConsProviderRunner", runOnce, 50L) | ||
|
||
import org.finos.vuu.core.module.basket.BasketModule.{BasketTradingConstituentColumnNames => BTC} | ||
|
||
omsApi.addListener(new OmsListener { | ||
override def onAck(ack: Ack): Unit = { | ||
table.processUpdate(ack.clientOrderId, RowWithData(ack.clientOrderId, Map[String, Any](BTC.InstanceIdRic -> ack.clientOrderId, | ||
BTC.OrderStatus -> OrderStates.ACKED)),clock.now()) | ||
} | ||
override def onCancelAck(ack: CancelAck): Unit = ??? | ||
override def onReplaceAck(ack: ReplaceAck): Unit = ??? | ||
override def onFill(fill: Fill): Unit = { | ||
val state = if(fill.orderQty == fill.totalFilledQty) OrderStates.FILLED else OrderStates.ACKED | ||
table.processUpdate(fill.clientOrderId, | ||
RowWithData(fill.clientOrderId, Map[String, Any](BTC.InstanceIdRic -> fill.clientOrderId, | ||
BTC.FilledQty -> fill.totalFilledQty, BTC.OrderStatus -> state)) | ||
,clock.now()) | ||
} | ||
}) | ||
|
||
def runOnce(): Unit = { | ||
omsApi.runOnce() | ||
} | ||
|
||
|
||
override val lifecycleId: String = "org.finos.vuu.core.module.basket.provider.BasketTradingConstituentProvider#" + hashCode() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
example/basket/src/main/scala/org/finos/vuu/core/module/basket/service/OrderStates.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.finos.vuu.core.module.basket.service | ||
|
||
object OrderStates { | ||
final val PENDING = "PENDING" | ||
final val ACKED = "ACKED" | ||
final val CANCELLED = "CANCELLED" | ||
final val FILLED = "FILLED" | ||
} | ||
|
||
object BasketStates{ | ||
final val OFF_MARKET = "OFF_MARKET" | ||
final val ON_MARKET = "ON_MARKET" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.