public static int GetPfsSecId(DBConnectionDetails conn, string pfsId) { if (pfsId == null) { return(-1); } return(DbUtils.ObtainCmdAndEval(conn.ConnectionString(), cmd => (int?)DbUtils.ExecuteScalar(false, cmd, "select secId from externalPositionMap where externalId = '" + pfsId + "'", null)) ?? -1); }
public static string GetUnderlyer(DBConnectionDetails conn, int posId) { return(DbUtils.ObtainCmdAndEval(conn.ConnectionString(), cmd => (string)DbUtils.ExecuteScalar(false, cmd, @" --select 'A/C='+pd.firmAccount + ', RIC='+ric.altId + ', Uccy='+undfi.currency + ', RIC2='+ric2.altId + ', FutMult='+cast(fut.multiplier as varchar(20)) + ', CB {type='+ct.mnem + ', initConvPrc='+cast(c.initialConversionPrice as varchar(20)) + ', FaceVal='+cast(c.faceValue as varchar(20)) + ', tradesGross='+c.tradesGross + '}' select 'A/C='+pd.firmAccount + ', RIC='+ric.altId + ', RIC2='+ric2.altId + ', FutMult='+cast(fut.multiplier as varchar(20)) + ', CB {type='+ct.mnem + ', initConvPrc='+cast(c.initialConversionPrice as varchar(20)) + ', FaceVal='+cast(c.faceValue as varchar(20)) + ', tradesGross='+c.tradesGross + '}' from externalPositionMap epm join positionDescription pd on pd.posId=epm.posId join ETSderivative der on der.derId = epm.secId -- join ETSfinancialInstrument undfi on undfi.id = der.undId and undfi.validUntil=99999999 left outer join ETSforward fut on fut.id=der.undId and fut.validUntil=99999999 left outer join ETSalternativeIdentifier ric on ric.id=der.undId and ric.type='RIC' --left outer join ETSalternativeIdentifier cus on cus.id=der.undId and cus.type='CUS' left outer join ETSderivative der2 on der2.derId = der.undId left outer join ETSalternativeIdentifier ric2 on ric2.id=der2.undId and ric2.type='RIC' left outer join CDM_basket_detail bd on bd.secId=der.undId left outer join CDM_basket_list bl on bl.bskt_name=bd.bskt_name left outer join ETSconvertible c on c.id=bl.undId and c.validUntil=99999999 left outer join ETSconvertibleType ct on ct.code=c.type where epm.posId = " + posId, null))); }
public static string GetPfsId(DBConnectionDetails conn, int posId) { return(DbUtils.ObtainCmdAndEval(conn.ConnectionString(), cmd => (string)DbUtils.ExecuteScalar(false, cmd, "select externalId from externalPositionMap where posId = " + posId, null))); }