Wednesday, November 18, 2009

Trouble shooting commands

1. sp__who & sp_who

2. sp_lock

3. sp__whodo

4. uptime; who -b

Working on a FX trades upload project

1.

Monday, November 16, 2009

Concepts in FIX practice

1. the most important concept here is, FIX talks to IMR, and IMR talks to DBL. There're mappings between each layer.
(a) from FIX to IMR, we're basically talking about Group/Customer/Trader/Account/Broker etc

2. the FIX connectivity issues - see my other posts related to FIX

3. security search -> dup trades detection -> trades filter (trader/customer/broker/group/account mapping) -> price convert -> add trades -> calc charge based on broker -> ensureNotify_sp(?) -> update last processed trade ID

4. security search - based on what rules?
(a) securityType - tag 167

5. dup trades detection - we first check if there's an orderID (broker assigned one, unique for a single trading session) in the database already; if yes, we then go ahead, and check if there's an execID there in the database. If yes, that's great - we caught a dup trade!

6. cancel order?

7. name service - mapping name to IOR?

8. what's IOS?

Sunday, November 15, 2009

少室山之战

金庸笔下的少室山之战,无与伦比!
金庸笔下的萧峰,豪气干云!

有机会,一定去少室山看一看!

Thursday, November 12, 2009

Commands by Example in Perl

1. perl -c xxx.pl

Tuesday, November 10, 2009

Commands by Example in T-SQL

1. T-SQL - declare/select/if...else/exec

declare @user varchar(32)
select @user = '${userLogin}'

declare @groupName varchar(32)
select @groupName = 'xxx'

declare @fullName varchar(64)
select @fullName = xxx from xxx

declare @found int
select @found = 0
select @found = 1 from xxx

if(@found=0)
begin
print "--adding user %1! = %2! --", @user, @fullName
declare @id xxx
exec xxx @table_name='xxx', @nr=1, @next_id=@id output
insert xxx values (@id, @fullName, @groupName)
end

2. while/if/else etc
declare @hldQuantity int
select @hldQuantity = 0
declare @buysell int
declare @execQuantity int
declare @execId int
declare @nextId int
select @nextId = min(exec_id) from exec,order,port where order_id = id and hold_id = id and hold_id = 00001
while ( @nextId is not NULL)
begin
print '---working on %1!', @nextId
select @execQuantity = quantity, @buysell = buysell from exec,order where id = @nextId and id = order_id
if (@buysell = 0)
begin
print '---its a buy---'
select @hldQuantity = @hldQuantity + @execQuantity
end
else
if (@buysell = 2)
begin
print '---its a sell---'
select @hldQuantity = @hldQuantity - @execQuantity
end
select @execId = @nextId
select @nextId = min(id) from exec,order,holding where id = order_id and _id = holding_id and port_id= 00001 and exec_id > @execId
end
print "--the hold quantity %1! --", @hldQuantity

Monday, November 9, 2009

近期总结

1、学而不思则罔,思而不学则殆

比较喜欢目前工作的一个重要原因就是每天都能遇到新的挑战,而不是机械的重复同样的事情;每天都能接触到新的知识。但是,也有一个令人沮丧的地方,就是每天都疲于理解和实践新的东西,而没有时间和精力去好好弄懂并记住这些新的东西。随着时间的流逝,很多工作中接触的东西慢慢会忘掉。

现在重温孔子的这句话,真的获益匪浅。今后,尽量每天都抽出一点时间来温习和巩固工作中遇到和学到的知识!

2、拿得起放得下

我很讨厌自己性格的一个方面,就是做不到拿得起放得下。每次遇到一些事情和人,当触到自己心灵的时候,往往变得非常敏感和冲动,有时候甚至不能控制自己的情绪和感情。说得难听一点就是非常幼稚。真希望自己能够坚强一点,成熟一点。

3、Public Enemies

这是我近期看得一部电影。John Dillinger,一个传奇人物。Byebye Blackbird,最后听到这句话的时候,我眼眶湿润了。

some reading notes - Essential C++

1. this is doable - overload based on the constness

class T
{
public:
const tClass& val() const { return _val; }
tClass & val() const { return _val; }
}

2. a good practice - make sure two class objects are not the same when copying

T& T::copy(const T& rhs)
{
if (this != &rhs)
{
_var1 = rhs._var1;
_var2 = rhs._var2;
}
return *this;
}

3. static class members - the single, shared instance that is accessible to all the objects of that class (static members); don't access any non-static class members (static member functions)

---T.h
class T
{
public:
static bool is_elem(int);
private:
static vector _elements; // we need to put its explicit definition within a .cpp file
static const int _var1 = 1024; // no need to do that
}

---T.cpp
vector T::_elements;
bool T::is_elem(int val) { ... _elements ...} // only access static members

---Main.cpp
if (T::is_elem()) {}

4. constructor, copy constructor, copy assignment operator ...

copy assignment -

M& M::operator= (const M& rhs)
{
if (this != &rhs)
{
delete [] _elem;
_elem = new double [cnt];
for(int ix=0;ix != cnt; ++ix)
_elem[ix] = rhs._elem[ix];
}
return *this;
}

5. function object - an object of a class that has an instance of the function call operator

class LessThan
{
public:
LessThan(int val):_val(val) {}
int comp_val() const {return _val;}
void comp_val(int nval) {_val = nva;}
bool operator() (int value) const;
private:
int _val;
}

inline bool LessThan::operator() (int value) const
{ return value "<" _val; }

int count_less_than(const vector& vec, int comp)
{
LessThan lt(comp);
int count = 0;
for (int ix=0;ix!=vec.size();++ix)
{
if(lt(vec[ix])) ++count;
}
return count;
}

Pieces of knowledge in ITS

1. light crude oil - CLc1, gold - GCc1, USD Index - .DXY

Concepts in ITS

For holding level,

1. Delta



For security level,

1. option volatility - strick, expiry, style (A, E), put/call