- UID
- 2
- 积分
- 2892307
- 威望
- 1396185 布
- 龙e币
- 1496122 刀
- 在线时间
- 13313 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-25
|
单均线交易系统程式码部分1【.h头文件】
test.h头文件部件:- #pragma once
- #include <iostream>
- #include "Interface.h"
- #include <map>
- #include <iostream>
- #include <string>
- #include <list>
- #include <sstream>
- #include <vector>
- #include "cStruct.h"
- using namespace std;
- #pragma warining(disable:4996)
- class test :public Interface
- {
- public:
- test(HWND hw, string sName, string sPeriod, string sInst);
- virtual ~test();
- public:
- virtual void InitParm();
- virtual void UpdateParm(string s);
- virtual void UpdateSub(string sub, double ratio);
- virtual void OnRun();
- virtual void OnStop();
- virtual void OnTimer(string s);
- virtual void OnMarketData(CThostFtdcDepthMarketDataField* t);
- virtual void OnRsqBar(string sPeriod, string sInst, map<string, TKVALUE> mapK);
- virtual void OnBarOpen(TKVALUE t);
- virtual void OnRtnOrder(CThostFtdcOrderField t);
- virtual void OnRtnTrade(CThostFtdcTradeField t);
- virtual void OnInstrumentStatus(CThostFtdcInstrumentStatusField* t);
- virtual void OnInstrumentAll(map<string,CThostFtdcInstrumentField>*m);
- virtual void OnInstrument(CThostFtdcInstrumentField t);
- virtual void OnRspQryOrder(map <string, CThostFtdcOrderField>* m);
- virtual void OnRspQryTrade(map <string, CThostFtdcTradeField>* m);
- virtual void OnPosition(map<string, map <string, TPOSITION>>* m);
- virtual void OnPositionDetail(map<string, TDETAIL>* m);
- virtual void OnCommissionRate(map<string, map<string, TCOMMISSION>>* m);
- virtual void OnAccount(map<string, CThostFtdcTradingAccountField>* m);
- private:
- int numod = 0;
- HWND hwnd;
- string sName;
- string sPeriod;
- string sInst;
- string t1, t2, t3, t4, t0;
- int jxzq, jyfx, num, hd, yxpc, jg, fx, ss, tm,cscc;
- double jx, zg, zd, ma, rcjg, dbfx, ccjg;
- map<string, CThostFtdcDepthMarketDataField>mapMd;
- map<string, CThostFtdcInstrumentField>mapInstrument;
- map<string, CThostFtdcOrderField>mapOrder;
- map<string, CThostFtdcTradeField>mapTrade;
- map<string, map<string, TPOSITION>>mapPos;
- map<string, CThostFtdcTradingAccountField>mapAcc;
- map<string, map<string, TKVALUE>>mapReal;
- map<string, double>mapSub;
- map <string, map<string, map<string, TKVALUE>>>mapK;
- map<string, TDETAIL> mapPosDeta;
- map<string, map<string, TCOMMISSION>>mapCom;
- map<int, string>maps; // 日志信息
- private:
- int n = 0;
- map<string, TDLLPARM>parm;
- list<string>lst;
- list<string>lstActionOrdrSysID;
- list<string>lstbeigenOrdrSysID;
- bool IsActionOrdrSysID(string orderid);
- bool IsbeigenOrdrSysID(string orderid);
- string state = "stop";
- string path = "D:\\data\\log";
- void OnState(string s);
- void end();
- void tend(TDLLPARM t);
- void SubscribeMarketData(string s);
- void OrderInsert(string acc, string inst, char bs, char oc, int volume, double price, string forfok, string ref2);
- void OrderAction(CThostFtdcOrderField t);
- void RsqBar(string period, string inst);
- void InsertLog(string msg);
- void RsqInstrument(string inst);
- void RsqRspQryOrder();
- void RsqRspQryTrade();
- void RsqPosition();
- void RsqPositionDetail(string acc);
- void RsqCommissionRate();
- void RsqAccount();
- void sound(string s);
- double avg(string period, string inst, int num);
- double highest(string period, string inst, int num);
- double lowerest(string period, string inst, int num);
- double avg1(string period, string inst, int num, int ref);
- double highest1(string period, string inst, int num, int ref);
- double lowerest1(string period, string inst, int num, int ref);
- void chedan();
- void shuchurizhi();
- void xieruzhuangtai();
- void chongfa(CThostFtdcOrderField t);
- void closesell1(string sInvestorID, string sName, int sl, double jg);
- void closebuy1(string sInvestorID, string sName, int sl, double jg);
- void closesell2(string sInvestorID, string sName, int sl, double jg);
- void closebuy2(string sInvestorID, string sName, int sl, double jg);
- };
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|