Navigation

Search

Categories

On this page

網誌將移到 blogspot.com
在金融業的黑暗時代, 我決定自行創業....
RiskLib.NET 0.1.1 Released - Ideas about DataSource and DataDestination
Product Coding Scheme in RiskLib.NET
WSJ, Yahoo!Finance, and Bloomberg datasource added to RiskLib.NET with examples
The first part of RiskLib.NET uploaded: DataSource and Product namespace
Project RiskLib.NET launched
財務工程程式設計專業課程
Bridging FpML and QuantLib
日本將投入太空電梯的建造
將 QuantLib 改為 .NET/C# 版本
Porting QuantLib to .NET/C#
該認真考慮衍生性商品和 CDO 的風險了吧!!!
Generating Sobol in C#
用 C# 執行 Monte Carlo 模擬 -- 產生 Sobol 亂數

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 82
This Year: 0
This Month: 0
This Week: 0
Comments: 61

Sign In
Pick a theme:

 Monday, March 30, 2009
Monday, March 30, 2009 3:32:51 PM (台北標準時間, UTC+08:00) ( .NET Programming | Finance Glossary | Geocaching | GIS | Quant's Life | RiskLib | Travel Log | 古地圖 | 台灣小百岳 | 就是想旅遊 | 微笑319鄉記行 | 投資理財 | 時事評論 | 科學與幻想 | 科學與技術 | 程式交易 | 電影評論 )
目前的這個網站是存放在我自己的主機. 由於網路流量太大經常會有延遲的現象,
所以即日起這個網誌將移到新的位址: http://alvincho.blogspot.com

歡迎大家光臨我新的網誌.

 Sunday, March 29, 2009
Sunday, March 29, 2009 5:45:42 PM (台北標準時間, UTC+08:00) ( 投資理財 | 程式交易 )
規劃了好一陣子了, 終於將在三月底離開金融業進入資訊業, 專心在我自己的公司巨傑資訊 Jumbosoft.com.

為什麼現在離開固定的工作, 進入不穩定的自行創業?

幾乎所有人聽到我現在自己出來創業, 直覺的反應是: 你被裁員了?
其實並不是, 我覺得現在是創業很好的時間點. 目前景氣不好, 外包的案子也會減少. 但相對的各項成本也會降低. 軟體開發最重要的人才, 而現在的人力成本應該會比較低, 願意專職或兼職軟體開發的人也比較多. 如果能夠把握現在這個時間, 開發一些產品, 成本會比較低.

自從十年前開始接案以後, 我一直對金融業的軟體非常感興趣, 但當時沒有很多金融業的經驗, 接不到金融業的案子, 又回到金融業工作將近十年的時間, 對這個產業的應用累積了一定的經驗和能力,

所以, 在這個金融業的黑暗時期, 我下了決心跟老闆提辭呈, 走上了這個不歸路, 我想, 應該是時候了吧....

自行創業要做什麼?

初期會以接案為主, 再陸續將各項產品補強. 目前提供幾項軟體產品, 這些軟體大部份都是我過去利用下班時間設計的:
  • 程式交易: 配對交易 Pairs trading, 套利 arbitrage, 交易策略 strategy, 自動下單與部位管理 order management
  • 金融資料庫: 將金融商品資料自動從網頁或是 Bloomberg, Reuters 終端機下載到資料庫.
  • 衍生性商品評價: 各項衍生性商品的評價和風險管理軟體
另外還提供幾項服務
  • 金融資訊相關技術教育訓練: 在證基會講課已經有一段時間了, 未來會多開一些課程, 也希望能往金融業企業內訓的市場發展
  • 顧問服務: 在金融商品交易這個領域已經有十幾年的經驗, 有機會可以用顧問的方式提供服務
  • 專案開發: 一直以來都是以接案為主, 也會繼續努力在這個市場, 不過主要還是會以金融投資的專案為主
我的公司網站

 Saturday, March 07, 2009
Saturday, March 07, 2009 11:46:36 AM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life | RiskLib )
I released RiskLib.NET 0.1.1 yesterday after I finished a SQLCeDataSource and an example to retrieve and save data.

The idea I present in this release is getting data from any DataSource and save into any DataDestination. A datasource with IHistoricalSource or IDailyClosingSource interface can retrieve data and convert into generic HistoricalDataList format, then fire a HistoricalDataEvent (defined in IHistoricalBase). The example handle the event at application layer and call SaveData from any DataDestination instance, which can accept HistoricalData as input and save in specified table defined in derived DataDestination class.

The fundamental fields can be handled in the same way and I don't have plan to implement another example. I might focus on mathematical and portfolio parts of RiskLib.NET from now, after I add some content on scope of RiskLib.DataSource.

RiskLib.NET is an open source project hosted in CodePlex.com. You can visit the project at http://risklib.codeplex.com

 Wednesday, February 25, 2009
Wednesday, February 25, 2009 8:42:47 PM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life | RiskLib )

Rules of RiskLib Product Coding Scheme

Why Product Coding Scheme

If your company participates many markets and investment instruments, it is very difficult to consolidate so many different sources of market and position data. For example, if you trade US stocks only, you might have IBM stored in a field in your closing price and position tables. But after your portfolio extended into European markets, which are using alphabet as stock code, you will find it is not a good idea to just store the US stock code as a unique key in the table. For many Asian stock markets, including Japan, Hong Kong, Korea, and Taiwan, they are using numbers as stock code.

For fixed-income instruments, that is a more complicated case. Although all issues of bonds have ISIN (International Securities Identification Number), there are still many indices or interests rates have no common coding. ISIN is a good choice for bonds, but we need more.

Global futures market has its own coding scheme, I prefer to use Reuters' codes.

Product Coding Scheme is for Assets or Indices only, not for OTC or derivatives trades

Please note only standard assets (securities or indices) need standardized coding. Over-the-Counter or derivatives trades are usually one of a kind for each trade and is not necessary to define in a coding scheme.

Product Coding Scheme Used in Current Systems

I will introduce coding scheme used in Reuters and Bloomberg later.

Objective of RiskLib Product Coding Scheme

Where is a perfect coding scheme? I don't know. I think a good coding scheme is a key of good risk management system, unless your portfolio is simple and local. I think a good coding scheme should have the following attributes:
  • short
  • product type can be recognized from the code itself
  • connect to offical system

Wednesday, February 25, 2009 7:51:59 PM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life | RiskLib )
I added 3 datasource to RiskLib.NET to demostrate how to implement two different interface: IDailyClosingSource, IHisotricalSource, and a special designed datasource: Bloomberg. I also added a example to retrieve data from these datasources.

Although there are still a lot should be modified, the example worked fine to retrieve data from these datasource.

 Tuesday, February 24, 2009
Tuesday, February 24, 2009 9:12:30 PM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life | RiskLib )
THe first part of RiskLib.NET source code has been uploaded to codeplex.com. It contains ready for use source code in namespace DataSource and Product. Although not all the code of these two namespace is finished, these are codes that might not be change until next major release.

The RiskLib.DataSource is designed to contain flexible and extensible classes for various financial information sources. A Bloomberg datasource implementation has been included. Bloomberg Professional Services is a very good source for informations for investment. I will include a working example using Bloomberg class to retrieve daily closing and real-time data. Please note: You must have a Bloomberg Professional Service terminal to use this class.

The RiskLib.Product contains object model for some basic financial product. This namespace might have some modification but not expected huge.

 Friday, February 20, 2009
Friday, February 20, 2009 5:42:10 AM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life | RiskLib )
I created a new project named RiskLib.Net on Codeplex.com.

After developing software for financial industry for more than 10 years, I plan to develope an open source .NET library for derivatives and risk management. It is just started without any code. I invite anyone who have interests to join it.

Please visit the following link to see the project:
http://www.codeplex.com/risklib

 Tuesday, September 30, 2008
Tuesday, September 30, 2008 3:35:49 PM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life )
在證基會開課已經有一段時間了, 也很高興累積了一些 "粉絲", 有幾名學員上了到目前為止開的全部四堂課, 真是令我很感動. 原本擔心所講的課大家沒有興趣, 畢竟這些課程是很新的嚐試. 也很感謝證基會給我機會可以推出這些新的課程.

先前的課程比較不牽涉程式設計的部份, 十一月起會陸續開一些給財務人員的 C# 課程. 未來也計劃做一些衍生性商品評價和風險的 C# 程式設計.

我為這些課程做了一個專屬網站, 內容會陸續更新. 網址是 http://www.jumbosoft.com/dnn/Services/Training/%E8%B2%A1%E5%8B%99%E5%B7%A5%E7%A8%8B%E5%B0%88%E6%A5%AD%E8%AA%B2%E7%A8%8B/tabid/74/language/zh-TW/Default.aspx

 Sunday, September 28, 2008
Sunday, September 28, 2008 7:53:55 PM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life )
I am tring to make FpML and QuantLib working together. I use a plain vanilla swap sample of FpML and convert it to VanillaSwap class of QuantLib. The experiment is successful and I can read an FpML document of vanilla swap and pricing it using QuantLib. I will put the workable version of ASP.NET on my site after I maintain a database of historical price of interest rate index, ie LIBOR, Euribor, and Tainwanese indexes.

 Saturday, September 20, 2008
Saturday, September 20, 2008 11:26:21 PM (台北標準時間, UTC+08:00) ( 科學與幻想 )
今天在新聞裡看到日本將投入一兆日圓(約一百億美元/三千億台幣)經費來建造太空電梯(Space Elevator). 這應該不是什麼新聞, 日本人對太空電梯一向是很有興趣. 在目前太空科學遠遠落後美俄甚至中國的日本, 一直很有野心希望有所突破. 太空電梯的確是很好的切入點, 太空電梯如果能夠完成, 太空探險的成本將會大幅降低, 成為二十一世紀的太空霸主.

太空電梯的建造在目前仍有許多困難點, 最大的困難大概有三項:
  1. 長度十萬公里的超輕超堅固太空電梯纜繩: 電梯一定要有纜繩, 太空電梯沒有辦法從十萬公里將物品拉上去, 只能將纜繩固定, 讓載運車廂抓住這條纜繩往上爬. 這條纜繩不能太重, 否則沒有辦法固定在軌道上; 而且強度要夠, 否則沒有辦法承受各種加諸其上的力量. 這個部份目前已經露出曙光了, 奈米碳管(nanotube)的出現, 讓這項工作變很可行性很高. 實驗室中的成品已經可以達到所需的強度, 只不過要建造一條長十萬公里中間沒有連接點的奈米纜繩目前還沒有辦法.
  2. 可以傳送十萬公里的遠距能量傳輸方式. 由於電梯車廂要靠自己的力量抓住纜繩往上爬, 要爬行十萬公里, 即使是在平地跑十萬公里也是需要相當多的能量, 更何況要對抗地心引力往上爬? 即使以人類目前所能控制的最有效率的能源: 核分裂能源, 要扛著一座核電廠爬十萬公里也是很難想像的事. 唯一可行的辦法是讓車廂只擁有動力裝置, 並不儲存能量. 現行各國的政策是不在太空任務中使用核能, 因為太空任務不確定性很高, 如果發射失敗會導致核子污染. 所以現行的太空任務都使用固態或液態燃料. 所以每次太空任務發射升空的能量大概都是用來推動燃料, 真正有用的部份(衛星或太空梭)重量大概不到百分之五. 如果太空電梯不儲存能量, 那麼就得從地面傳送過去. 目前能做到遠距傳送最有效率的是光能, 也就是利用太陽能技術, 但是從地面站朝著車廂的接收器發射強力光束, 再將光能轉換為動力.
  3. 恐怖攻擊: 一條十萬公里長的細線, 可能是用類似石墨的材質製作的, 花一百億美金所做的太空電梯可能只要一根火柴就毀了. 而且沒有什麼辦法可以監控整條十萬公里的纜繩. 這個問題被提出來過但可能沒有什麼解決方法.
Spaceward Fundation (http://www.spaceward.org) 每年利用NASA贊助的獎金舉辦比賽, 比賽分兩個部份: 爬升器和材料. 以下是今年(2008)比賽的目標:

爬升器: 總重最高五十斤. 使用廠商所提供的雷射光源為能量, 以每秒五公尺的速度向上爬一公里, 奬金兩百萬美金. 去年最佳的成果是每秒1.8公尺爬行100公尺. 今年十一月的比賽有11隊報名.
材料: 長度兩公尺的環狀材料, 重量不超過兩克, 承受應力1.5噸, 奬金也是兩百萬美金. 目前最佳成果是承受0.72噸. 今年沒有人報名, 應該是沒有突破.

 Friday, September 19, 2008
Friday, September 19, 2008 10:33:49 PM (台北標準時間, UTC+08:00) ( Quant's Life )
QuantLib是目前最豐富的open source 財務工程程式庫. 原本是用C#做的, 我花了幾個月的時間改為C#版本, 並製作了一個專屬的網站. 有興趣的朋友歡迎光臨 http://quantlib.derivativepower.com 有詳細的說明和範例. 網站中目前已經有的範例包括

可轉債 Convertible Bond: 使用 Tsiveriotis-Fernandes 模型評價. 其中的二元樹包含
七種;

股權選擇權 Equity Option: 可以評價 European, Bermudan, 和 American Option, 共有十四種方法:

Interest Rate Swap: 利用 Depo, Interest Rate Future, FRA, Swap Rate 組合成 Yield Curve, 可以評價Spot Swap 和 Forward Start Swap.

QuantLib 包含的功能非常多, 有關QuantLib的資料可以參考 http://www.quantlib.org.

Friday, September 19, 2008 9:50:08 PM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life )
I have worked on porting QuantLib to C# for months. I am glad I have great progress on it.

I created a dedicated website to demostrate and to document the result. Please visit http://quantlib.derivativepower.com for docuemtation and examples.

Currently I have finished 3 examples: Convertible Bond, Interest Rate Swap, and Equity Option. These examples are cloned from original QuantLib examples for checking the correctness of this portion. More examples, such as BermudanSwaption, CDS, FRA, Repo will be available soon.

 Tuesday, September 16, 2008
Tuesday, September 16, 2008 5:27:53 PM (台北標準時間, UTC+08:00) ( Quant's Life | 投資理財 )
雷曼兄弟申請破產法Chapter 11保護, 六千億美元的資產等著被清算. 華爾街投資銀行放手任由雷曼兄弟跨台, 大家好等著吃這一塊腐肉, 華爾街一慣的秃鷹性格, 只不過會等到所有的風波都落幕時, 真的能全身而退的有幾家呢?

身處全球金融市場的邊硾, 看到評等比我們好, 一向是我們上手銀行的華爾街諸公也有這麼一天, 心裡不知道是該哭還是該笑. 以前生意往來得看他們的臉色, 非得存一筆保證金才能夠買他們的產品, 以後是不是要請他們也存一筆錢來我們的戶頭, 再來看看他們要跟我們買什麼商品? 要做 IRS? 先看看保證金夠不夠再說.... 如果真有這麼一天, 那我們真的可以說是出頭天了. 前輩交易員想都不敢想的事, 還真的有可能在我們手上實現呢...

話說回來, 這些衍生性商品的交易也該檢討檢討適可而止吧. 你買的商品你都了解嗎? 風險到底有多大知道嗎? 源源不絕的新種商品好像無止盡的數字遊戲, 評價和風控都是一門大學問. 如果教科書上有 Closed-Form 就輕鬆了, 沒有也沒關係, 還有萬能的Monte Carlo Simulation, 也不管到底前題假設符不符合, 只要算得出來, 反正也沒有人看得懂, 每天的評價損益風險值連自己都沒有把握, 這種生意能做嗎? 說實在的, 大家都這麼做...

先前在證基會的市場風險系統課程時, 有學員問我CDO的評價和風險的問題. 坦白說我不是這方面的專家, 我只有很簡單的概念: 交易員沒辦法做出評價模型, 那就不應該交易. 這不是很簡單很理所當然的事嗎? 但是交易員會說, 雖然我不會評價CDO, 但我知道CDO很好賺. 我只負責賺錢, 評價和風險不是我的事, 你們風控要去解決.聽到這種話真是令人吐血, 你不會評價怎麼知道很好賺?
只要詢三家, 找報價最低的就是啦. 如果是買生活必需品, 那麼非買不可我也無話可說. 難道除了CDO之外沒有生意可做嗎? 為什麼硬要買自己沒辦法評價的產品呢? 說不定報價最低的銀行也大賺你500bp. 另外, 我們風控不能說我們不會評價和計算風險嗎? 如果風控不會評估不能要求交易員不要做嗎? 現實狀況大概都是不行, 不管風控怎麼說, 交易單位還是最大, 交易主管說要做, 風控不能說不. 大多數機構裡的風控都是聊備一格, 沒有什麼控管的功能. 沒關係, 多傷幾次, 大家就會學乖了.

 Wednesday, September 03, 2008
Wednesday, September 03, 2008 11:39:35 AM (台北標準時間, UTC+08:00) ( Quant's Life )
Sobol is a very popular quasi-random number algorithm for Monte Carlo simulation. I implemented a Sobol quasi-random number generators at

http://www.derivativepower.com/dp/Demo/sobol.aspx

If you need some Sobol sequences, you can try it and give me some comment. Thanks.

Wednesday, September 03, 2008 11:35:59 AM (台北標準時間, UTC+08:00) ( .NET Programming | Quant's Life )
要執行 Monte Carlo 模擬, 要先有 Quasi Random Numbers 或是稱為 Low Discrepancy Sequences. 目前比較常用的是 Faure 或 Sobol 兩種演算法. 我將 Sobol 演算法用 C# 實作了一份 Sobol 產生器, 另外也有計算 L^2 Discrepancy. 有興趣的朋友歡迎到

http://www.derivativepower.com/dp/Demo/sobol.aspx

實際執行看看.