楼主: wanwanle2
3281 8

[问答] 基于SAS平台证券回溯系统的搭建构想 [推广有奖]

  • 1关注
  • 22粉丝

已卖:153份资源

博士生

87%

还不是VIP/贵宾

-

威望
0
论坛币
310 个
通用积分
294.0629
学术水平
16 点
热心指数
18 点
信用等级
14 点
经验
287070 点
帖子
306
精华
0
在线时间
370 小时
注册时间
2011-4-13
最后登录
2024-10-23

楼主
wanwanle2 在职认证  发表于 2012-12-24 16:47:52 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
最近完成了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.   |


策略编辑界面:
  1. /***************************************************************************/
  2. /*Subject: Programming Trading Strategy Editor */
  3. /*策略描述:*/
  4. /*作 者: */
  5. /*通讯方式:*/
  6. /*完成日期:*/
  7. /***************************************************************************/
  8. Options mprint mlogic;
  9. /*接口程序目录*/
  10. filename Frame "E:\工作\SAS程序化交易系统\Framework API";
  11. /*调用并编译各API的源文件*/
  12. %include Frame(LoadingDataAPI.sas);
  13. %include Frame(LoadingStockDataFromYahoo.sas);
  14. %include Frame(LongAndShortAPI.sas);
  15. %include Frame(CalculationPerformanceAPI.sas);

  16. *****************Step1:数据装载;



  17. *****************Step2:策略算法;



  18. *****************Step3:检查信号;


  19. *****************Step3:模拟交易,并输出策略评估报告;
复制代码


SAS画K线图.jpg


/*还请感兴趣的人士,讨论我的方案可行性*/


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:SAS平台 respectively performance Calculation Programming 搭建 平台

回帖推荐

davil2000 发表于5楼  查看完整内容

站在SAS巨人的肩膀上。这个比较C++的平台会更有价值!
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
davil2000 + 5 + 5 + 5 精彩帖子

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

本帖被以下文库推荐

沙发
wanwanle2 在职认证  发表于 2012-12-25 13:14:36
LangAndShort API的代码:
  1. %let inforOpenLong ="开多API,参数BuyPrice为买入的价格,变量TradingSignal为标识符";
  2. %let inforOpenShort ="开空API,参数SellShortPrice为卖空的价格,变量TradingSignal为标识符";
  3. %let inforCloseLong ="平多API,参数SellPrice为平多的价格,变量TradingSignal为标识符";
  4. %let inforCloseShort ="平多API,参数BuytoCoverPrice为平空的价格,变量TradingSignal为标识符";
  5. %let inforCloseLongAndOpenShort ="平多并且反手开空API,参数SellPrice为平多的价格,SellShortPrice为卖空的价格,变量TradingSignal为标识符";
  6. %let inforCloseShortAndOpenLong ="平空并且反手开多API,参数BuytoCoverPrice为平空的价格,BuyPrice为开多的价格,变量TradingSignal为标识符";
  7. %let inforForceCloseLong ="强制平多API,参数SellPrice为强制平多的价格,变量TradingSignal为标识符";
  8. %let inforForceCloseShort ="强制平空API,参数SellPrice为强制平空的价格,变量TradingSignal为标识符";
  9. %Macro OpenLong(BuyPrice = );
  10. %let inforOpenLong = "开多API,参数BuyPrice为买入的价格,变量TradingSignal为标识符";
  11. TradingSignal = "开多";
  12. BuyPrice = &BuyPrice.;
  13. %mend;

  14. %Macro OpenShort(SellShortPrice = );
  15. %let inforOpenShort = "开空API,参数SellShortPrice为卖空的价格,变量TradingSignal为标识符";
  16. TradingSignal = "开空";
  17. SellShortPrice = &SellShortPrice.;
  18. %mend;

  19. %Macro CloseLong(SellPrice = );
  20. %let  inforCloseLong = "平多API,参数SellPrice为平多的价格,变量TradingSignal为标识符";
  21. TradingSignal = "平多";
  22. SellPrice = &SellPrice.;
  23. %mend;

  24. %Macro CloseShort(BuytoCoverPrice = );
  25. %let  inforCloseShort = "平多API,参数BuytoCoverPrice为平空的价格,变量TradingSignal为标识符";
  26. TradingSignal = "平空";
  27. BuytoCoverPrice = &BuytoCoverPrice.;
  28. %mend;

  29. %Macro CloseLongAndOpenShort(SellPrice = ,SellShortPrice = );
  30. %let  inforCloseLongAndOpenShort = "平多并且反手开空API,参数SellPrice为平多的价格,SellShortPrice为卖空的价格,变量TradingSignal为标识符";
  31. TradingSignal ="平多且开空";
  32. SellPrice = &SellPrice.;
  33. SellShortPrice = &SellShortPrice.;
  34. %mend;


  35. %Macro CloseShortAndOpenLong(BuytoCoverPrice = , BuyPrice = );
  36. %let  inforCloseShortAndOpenLong = "平空并且反手开多API,参数BuytoCoverPrice为平空的价格,BuyPrice为开多的价格,变量TradingSignal为标识符";
  37. TradingSignal = "平空且开多";
  38. BuytoCoverPrice = &BuytoCoverPrice.;
  39. BuyPrice = &BuyPrice.;
  40. %mend;

  41. %Macro ForceCloseLong(SellPrice = );
  42. %let  inforForceCloseLong = "强制平多API,参数SellPrice为强制平多的价格,变量TradingSignal为标识符";
  43. TradingSignal = "强制平多";
  44. SellPrice = &SellPrice.;
  45. %mend;

  46. %Macro ForceCloseShort(BuytoCoverPrice = );
  47. %let  inforForceCloseShort = "强制平空API,参数SellPrice为强制平空的价格,变量TradingSignal为标识符";
  48. TradingSignal = "强制平空";
  49. BuytoCoverPrice = &BuytoCoverPrice.;
  50. %mend;
复制代码

藤椅
davil2000 发表于 2012-12-25 13:26:15
很有意义的项目!希望能坚持做下去!
R是万能的,SAS是不可战胜的!

板凳
wanwanle2 在职认证  发表于 2012-12-25 13:52:26
davil2000 发表于 2012-12-25 13:26
很有意义的项目!希望能坚持做下去!
不过,用SAS做回溯系统好像没有太多人看好啊,自己的SAS水平不高,好多资源都学习不到。感觉自己闭门造车了...

报纸
davil2000 发表于 2012-12-25 13:58:19
站在SAS巨人的肩膀上。这个比较C++的平台会更有价值!
R是万能的,SAS是不可战胜的!

地板
wanwanle2 在职认证  发表于 2012-12-25 14:04:45
davil2000 发表于 2012-12-25 13:58
站在SAS巨人的肩膀上。这个比较C++的平台会更有价值!
嗯,希望自己会取得应有的成绩!

7
ziyenano 发表于 2012-12-25 14:11:10
对这块不懂,但是支持楼主,有兴趣就用心做下去

8
clhclhjdz 发表于 2013-1-8 14:08:42
支持楼主! 现在券商、期货公司对系统这块很重视,用SAS去做系统确实非常好!看好你 ,加油!

9
yuankecheng 发表于 2013-1-19 20:32:46
thks

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-6 07:31