2011年4月29日 星期五

GeniusTrader @ perl

在TradeStation的交易系統上, 可以寫簡單的 Easy Language 做系統的回測分析. 可參考大象飛上天,裡面有很多簡單的例子.不過你需要先有 TradeStation 這套付錢的軟體. 這對Free Software的人來說真是太困難了. 還好有 GeniusTrader, 透過內建的 Indicator, money management...下些簡單的 Script commands, 可以模擬出類似 TradeStation 的 Chart 跟 Report 呢. GeniusTrader support 1.backtrack history data insert .txt 2.real time quote from Yahoo finance DBI:SQLite3, MySQL, 3. indicator support DMA,KD,... 5. money management & profit report hold time, max benefit, max lost. 可參考底下的安裝流程. http://geniustrader.org/first_use.html ps: 記得設定 GeniusTrader 的 system 變數 @ ~/.gt/options
DB::module Text
DB::text::directory /home/sean/prj/geniustrader/data
# relying on DB::Text defaults for sample database access

Brokers::module SelfTrade

Path::Font::Arial    /usr/share/fonts/truetype/msttcorefonts/arial.ttf
Path::Font::Courier  /usr/share/fonts/truetype/msttcorefonts/couri.ttf
Path::Font::Times    /usr/share/fonts/truetype/msttcorefonts/times.ttf

Analysis::ReferenceTimeFrame year

#Graphic::BackgroundColor black
#Graphic::ForegroundColor white

Aliases::Global::TFS    SY:TFS 50 10|CS:SY:TFS
Aliases::Global::TFS[]  SY:TFS #1 #2|CS:SY:TFS #1|CS:Stop:Fixed #3
ps: @ ex1 有沒有像 TradeStation 內的 Easy Language 阿.不過好像沒有 TradeStation那麼簡單. 全部是 GUI 的介面. 要跑回測要用 backtest.pl. 要圖形跑 graphic.pl. Run Mode 設定要修改 DB::module @ ~/.gt/options....還有一堆 script 要下,當然最大的特點是可以加入自己的想法到 library 中. 不過還是要找到適合自己的交易工具才重要. @ ex1
CS:Generic \
{S:Generic:CrossOverDown {I:DMI/3 14} 12 } \
{S:Generic:CrossOverUp   {I:DMI/3 14} -12 }
Ref: http://www.geniustrader.org/ https://help.ubuntu.com/8.04/serverguide/C/postgresql.html

2011年4月26日 星期二

Trader API update...

底下是 2009 年,高大師所做的演講,小弟就借來膜拜一下,順便把Trader API 做些改進. update lists 1. DBI data base support 2. backup & redundant remove support 3. history data co-sync support 4. error check 5. iJump entry rule 6. profit analysis ps: 如果你不想自己開發,我想底下的這套tool,對於股票的篩選還蠻有幫助的. http://sonyshare.com/FreeSoft/index.php Refs: Finance-GeniusTrader https://github.com/clkao

2011年4月25日 星期一

SystemC kernel core trace

小弟之前用SystemC 開發了一些簡單的IP, 但都沒有花時間在 trace 其核心是怎樣完成的,於是小弟最近就花點時間把底層的 kernel 部份看了一下,底下就大致說明整體SystemC 的核心架構是如何摟. utils 利用底層的 C library 來實現 SystemC C++ library, 如 sc_memory map, sc_vector, sc_list... 分別用來儲存 sc_event, sc_cthread kernel 主要是用 C library 中的 pthread 做 extend, 分別建立出 sc_thread, sc_thread, sc_method. 的 thread module 出來.在透過 sc_object_manager 把現有的 thread 儲存到 sc_list 中, 最後在根據每個 thread 的 time stamp 做 priority check. 且 sort 出在 current time stamp 要做的 thread. 把使用權給 lock 住, 以此確保 data 的正確性. 除此之外還要考慮到 thread 彼此間的關係, 藉由 Parent, children 的關係把 thread 的使用權 pass 下去. 這之中當然也 support pthread 中的 time wait, fork,join,event wait ... ,感覺有點像是 OS 的 multi tasks 的 schedule assignment. datatypes 定義 struct type. 如 sc_int, sc_bit... 的資料型態. tracing 為event signal trace, dump VCD waveform file. boost 為boost c++ library communication 提供sc_channel, sc_fifio, sc_signal, sc_clock 的function. ps: 如果要更高階的語法來做 Architecture Algorithm 驗證.又不想要把type, class 定的很死.我想 Inline::CPP / Inline::C 可以是不錯的選擇, 可利用現有的 library 做到快速的 System explore. 不過很底層的東西就要看有沒有 support 的 Driver 摟. refs: http://search.cpan.org/~sisyphus/Inline/C/C.pod#Example_#1_-_Greetings