diff --git a/vuu/src/main/scala/org/finos/vuu/core/module/basket/BasketModule.scala b/vuu/src/main/scala/org/finos/vuu/core/module/basket/BasketModule.scala index 850fe402d..966e628fd 100644 --- a/vuu/src/main/scala/org/finos/vuu/core/module/basket/BasketModule.scala +++ b/vuu/src/main/scala/org/finos/vuu/core/module/basket/BasketModule.scala @@ -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 @@ -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), ) @@ -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() } diff --git a/vuu/src/main/scala/org/finos/vuu/core/module/basket/provider/BasketConstituentProvider.scala b/vuu/src/main/scala/org/finos/vuu/core/module/basket/provider/BasketConstituentProvider.scala index 2a8a20bac..4dc7f2371 100644 --- a/vuu/src/main/scala/org/finos/vuu/core/module/basket/provider/BasketConstituentProvider.scala +++ b/vuu/src/main/scala/org/finos/vuu/core/module/basket/provider/BasketConstituentProvider.scala @@ -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, diff --git a/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala b/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala index 5cc1e7eff..0dbeb885c 100644 --- a/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala +++ b/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala @@ -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 }