Friday, November 27, 2009

一些宏观层面上的经济学原理

1、各大中央银行已经说得清清楚楚:他们就是要尽可能增加货币供应,促成纸币贬值,帮助负债者。
-- for this point, there's no need to talk about China (we have plenty of Chinese newspapers on it). Just look at today's Bloomberg post on Japan - BOJ to Provide 10 Trillion Yen in Emergency Credit. The Bank of Japan said it’s ready to pump more money into the financial system after unveiling a 10 trillion yen ($115 billion) program to help an economy battered by falling prices and the yen’s surge to a 14-year high. Yen is gaining against USD in the past six months, once peaked at almost 84...

Thursday, November 26, 2009

FIX Learning Notes (2)

1. Symbol - Tag 55
ticker symbol

2. SecurityType - Tag 167
sample values: CS, FUT, OPT, WAR etc

3. IDSource - Tag 22 (symbol type)
sample values: 1-cusip, 2-sedol, 3-quik, 4-isin, 5-RIC, 8-exchange symbol etc

4. some other config's

Wednesday, November 25, 2009

RIC Futures & Options Name Convention

1. Reuters monthly codes for futures

my %futureCode = (
"01" => "F",
"02" => "G",
"03" => "H",
"04" => "J",
"05" => "K",
"06" => "M",
"07" => "N",
"08" => "Q",
"09" => "U",
"10" => "V",
"11" => "X",
"12" => "Z",
);

2. Reuters monthly codes for options

my %optionCode = (
P => { # codes for put option
"01" => "M",
"02" => "N",
"03" => "O",
"04" => "P",
"05" => "Q",
"06" => "R",
"07" => "S",
"08" => "T",
"09" => "U",
"10" => "V",
"11" => "W",
"12" => "X",
},
C => { # call option
"01" => "A",
"02" => "B",
"03" => "C",
"04" => "D",
"05" => "E",
"06" => "F",
"07" => "G",
"08" => "H",
"09" => "I",
"10" => "J",
"11" => "K",
"12" => "L",
},
);

3. for Options -- market symbol = security root + strike + option code shown above + expiry year (only one digit)

4. for futures -- market symbol = security root + future code shown above + expiry year (only one digit)

5. examples,

RIO2300X9.L - RIO.L O 20091218 2300.00 AP (RIO.L 2300 Put 20091218)
CBRY800L9.L - CBRY.L O 20091218 800.00 AC

Thursday, November 19, 2009

awk & nawk

1. nawk -F'\t' '$4==1 {print $5"\t"$1"\t"$2"\t"$3"\tYes"}; $4==0 {print $5"\t"$1"\t"$2"\t"$3"\tNO"}' xxxxx

2. grep xxxx XXXX | awk '$2 == 1 { ++total }; END {print "total = ", total} '

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