最近完成了SAS回溯系统的架构和底层demo,自己摸索着总共有四大模块,然后通过统一标准的策略编辑窗口就可以实现策略的回溯代码了。
1、数据通信(
Loading Data API.sas)
2、信号检测(
Long And Short API.sas )
3、模拟交易(
Calculation Performance API.sas)
4、绩效报告(
Performance Report API.sas )
这四个模块初具成形,但还有待提高。系统介绍如下:
|*****************The Information of SAS Back Trading System****************|
|--Description--------------------------------------------------------------|
| This is a Programming Trading Back System that provide accurate |
| back transaction record executive bag and detailed transaction report |
| package,applicable to all kinds of securities. |
| |
|--Routine Package----------------------------------------------------------|
| 1. Loading Data API.sas |
| 2. Long And Short API.sas |
| 3. Calculation Performance API.sas |
| 4. Performance Report API.sas |
| |
|--Loading Data API.sas-----------------------------------------------------|
| This routine package contains three Macro Programs,Their main task |
| is to read dataset.Three Macro Program name are LoadingDataAlone(1), |
| LoadingDataMore(2) and LoadingDataFromYahoo(3) respectively,Now to |
| describe their usage. |
| (1)LoadingDataAlone(Dir=,DataTableType=,Library=,DataSetName=,getnames=) |
| Call methods: |
| % LoadingDataAlone( |
| Dir = "C:\Documents\IF300.csv", |
| DataTableType = csv, |
| Library =work, |
| DataSetName = a4, |
| getnames = yes ) |
| Each variable meaning:Dir外部数据表的路径 DataTableType数据类型 |
| Library逻辑库名 DataSetName输出数据集名称 getnames是否读入变量名YES NO |
| (2) LoadingDataMore(dir= ,Library = ) |
| Call methods: |
| % LoadingDataMore( dir=E:\期货EXCEL表,Library =work ) |
| (3)LoadingDataFromYahoo(code=, start=, end=, prompt=NO) |
| Call methods: |
| % LoadingDataFromYahoo(code=000001.SZ, start=1/1/2005, end=11/16/2012) |
| Each variable meaning:code为股票代码,美票不用加后缀,深市代码后加.SZ, |
| 沪市代码后加.SS,如000001.SZ为深发展代码.start和end分别为起止日期,格式为 |
| mm/dd/yyyy .prompt:是否弹出窗口输入上述参数(一般为NO) |
| |
|--Long And Short API.sas---------------------------------------------------|
| This routine package contains eight Macro Programs,their main task |
| is to detection trading signal in market.Now to describe their usage. |
| (1)OpenLong(BuyPrice = ) |
| This is a Macro that opening Long Position. |
| (2)OpenShort(SellShortPrice = ) |
| This is a Macro that opening Short Position. |
| (3)CloseLong(SellPrice = ) |
| This is a Macro that closing Long Position. |
| (4)CloseShort(BuytoCoverPrice = ) |
| This is a Macro that closing Short Position. |
| (5)CloseLongAndOpenShort(SellPrice = ,SellShortPrice = ) |
| This is a Macro that closing Long and opening Short Position. |
| (6)CloseShortAndOpenLong(BuytoCoverPrice = , BuyPrice = ) |
| This is a Macro that closing Short and opening Long Position. |
| (7)ForceCloseLong(SellPrice = ) |
| This is a Macro that force closing Long Position. |
| (8)ForceCloseShort(BuytoCoverPrice = ) |
| This is a Macro that force closing Short Position. |
| |
|--Calculation Performance API.sas------------------------------------------|
| This routine package contains one Macro Program,it main task is to |
| place an order and excution simulation trade in market.This Macro need |
| to use macro variable -Short- to specify strategy have shorting mechanism|
| Now to describe it usage. |
| Call methods: |
| % computePerformace(Short = NO) |
| Note: The strategy have no shorting mechanism then variable Short to be |
| set NO,and they have shorting mechanism then Short to be set YES must. |
策略编辑界面:
/*还请感兴趣的人士,讨论我的方案可行性*/