Skip to content

Commit

Permalink
#850 found a bug with basket constituents, not resolved as of this co…
Browse files Browse the repository at this point in the history
…mmit.
  • Loading branch information
chrisjstevo committed Oct 29, 2023
1 parent ec93e79 commit 6cc77c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.finos.toolbox.time.Clock
import org.finos.vuu.api.{JoinSpec, JoinTableDef, JoinTo, LeftOuterJoin, Link, TableDef, ViewPortDef, VisualLinks}
import org.finos.vuu.core.module.basket.provider.{AlgoProvider, BasketConstituentProvider, BasketProvider, NullProvider, PriceStrategyProvider}
import org.finos.vuu.core.module.basket.service.{BasketService, BasketTradingConstituentService}
import org.finos.vuu.core.module.price.PriceModule
import org.finos.vuu.core.module.simul.SimulationModule
import org.finos.vuu.core.module.{DefaultModule, ModuleFactory, TableDefContainer, ViewServerModule}
import org.finos.vuu.core.table.Columns
Expand Down Expand Up @@ -48,7 +49,7 @@ object BasketModule extends DefaultModule {
columns = Columns.fromNames(BC.RicBasketId.string(), BC.Ric.string(), BC.BasketId.string(), BC.Weighting.double(), BC.LastTrade.string(), BC.Change.string(),
BC.Volume.string(), BC.Side.string()), // we can join to instruments and other tables to get the rest of the data.....
VisualLinks(),
joinFields = BC.RicBasketId
joinFields = BC.RicBasketId, BC.Ric
),
(table, vs) => new BasketConstituentProvider(table),
)
Expand Down Expand Up @@ -111,18 +112,18 @@ object BasketModule extends DefaultModule {
),
(table, _) => new AlgoProvider(table)
)
// .addJoinTable(tableDefs =>
// JoinTableDef(
// name = "basketTradConsPrices",
// baseTable = tableDefs.get(NAME, "basketTradingConstituent"),
// joinColumns = Columns.allFrom(tableDefs.get(NAME, "basketTradingConstituent")) ++ Columns.allFromExcept(tableDefs.get(SimulationModule.NAME, "prices"), "ric"),
// joins =
// JoinTo(
// table = tableDefs.get(SimulationModule.NAME, "prices"),
// joinSpec = JoinSpec(left = "ric", right = "ric", LeftOuterJoin)
// ),
// joinFields = Seq()
// ))
.addJoinTable(tableDefs =>
JoinTableDef(
name = "basketConsPrices",
baseTable = tableDefs.get(NAME, BasketConstituentTable),
joinColumns = Columns.allFrom(tableDefs.get(NAME, BasketConstituentTable)) ++ Columns.allFromExcept(tableDefs.get(PriceModule.NAME, "prices"), "ric"),
joins =
JoinTo(
table = tableDefs.get(PriceModule.NAME, "prices"),
joinSpec = JoinSpec(left = "ric", right = "ric", LeftOuterJoin)
),
joinFields = Seq()
))
.asModule()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class BasketConstituentProvider(val table: DataTable)(implicit lifecycle: Lifecy
table.processUpdate(symbol, RowWithData(symbol, Map(
Ric -> symbol,
BasketId -> basketId,
RicBasketId -> (symbol + "." + basketId),
LastTrade -> lastTrade,
Change -> change,
Weighting -> weighting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ class VuuJoinTableProvider(implicit timeProvider: Clock, lifecycle: LifecycleCon

def eventToKey(tableName: String, ev: util.HashMap[String, Any]): String = {
val keyField = sourceTableDefsByName.get(tableName).keyField
if(keyField == null)
println("here")

ev.get(keyField).toString
}

Expand Down

0 comments on commit 6cc77c2

Please sign in to comment.