For debugging purposes, we can use the following reflection based code:
public static string DumpOrderBean(OrderBean ob)
{
PropertyInfo[] pi = typeof(OrderBean).GetProperties();
StringBuilder sb= new StringBuilder();
foreach (PropertyInfo p in pi)
{
if (p.Name.IndexOf("Bean")<0)
sb.Append(p.Name +" :"+ p.GetValue(ob, null)+"\r\n");
}
StreamWriter w= new StreamWriter(@"c:\JGBRollTestOB.txt");
w.Write(sb.ToString()); w.Flush();
OrderAllocationBean oa = ob.allocationBeans[0];
PropertyInfo[] pi2 = typeof(OrderAllocationBean).GetProperties();
StringBuilder sb2 = new StringBuilder();
foreach (PropertyInfo p2 in pi2)
{
if (p2.Name.IndexOf("Bean") < 0)
sb2.Append(p2.Name + ":" + p2.GetValue(oa, null) + "\r\n");
}
StreamWriter w2 = new StreamWriter(@"c:\JGBRollTestOAB.txt");
w2.Write(sb2.ToString()); w2.Flush();
return sb.ToString();
}
Wednesday, August 13, 2008
Use reflection to dump properies
Friday, August 1, 2008
Constrain SQL like pattern for Commission Rate lookup
SQL Like allow pattern match but normally return multiple rows. If you have one
commision rate for a pattern, carefully specified pattern will allow look up to
return just one value without the ambiguity as shown here:
FSMI% vs. FSMIU%
In general, we need to consider the following:
(1) Clearly define Bloomberg symbol as 2 charaters key and Add GMO prefix to
generate external security id pattern. (GMO_EXT_SEC_ID_PATN_DEF).
In particular, Commission Rate table GMO_BROKER_COMM need to have Foreign key
constraints from GMO_EXT_SEC_ID_PATN_DEF to avoid invalid security.
(2) GMO_BROKER_COMM need to have a trigger constraint to make sure the following
will not return more than one row:
select * from GMO_BROKER_COMM2 where
(EXT_SEC_ID_PATN like @EXT_SEC_ID_PATN or
@EXT_SEC_ID_PATN like EXT_SEC_ID_PATN)
in particular, if we need to have both FSMI% and FSMIU%, we will need to span out
even with duplcation rates:
FSMIH% 2.95
FSMIG% 2.95
FSMIZ% 2.95
FSMIU% 4.95
This will eliminate ambiguity.
(3) We need [BB_SYMBOL] [char](2) NOT NULL to keep space for Bloomberg symbol
and that will avoid some ambiguity like FBC % vs. FBCC%
(4) FBC % vs. FBC%
FB C -- SET50 FUTURES maps to FBC %
F BC -- CORN FUTURE maps to FBC%
we currenlty do not have commission rate for FBC %. But we need to be
careful when enter rates in the future
(5) The following is the SQL used in Mid-Tier:
select * from GMO_BROKER_COMM where @ext_sec_id like EXT_SEC_ID_PATN
Subscribe to:
Posts (Atom)