Beispiel #1
0
        // 成交通知
        public override bool OnTrade(TradeInfo trade)
        {
            QryTradingAccount qryTA = new QryTradingAccount();
            TradingAccount    taRet = new TradingAccount();

            GetTradingAccount(qryTA, ref taRet);

            QryPosition         qryPiso = new QryPosition();
            List <PositionInfo> lstPosi = new List <PositionInfo>();

            GetPositions(qryPiso, ref lstPosi);

            InputOrder req = new InputOrder();

            req.InstrumentID = trade.InstrumentID;
            req.Qty          = trade.Volume;
            req.Price        = trade.Price + (trade.Direction == '0' ? -1.0 : 1.0);
            req.Hedge        = '1';
            req.IsMarket     = false;
            req.Direction    = trade.Direction == '0' ? '1' : '0';
            req.OpenClose    = '1';

            ReqOrderInsert(req);

            return(true);
        }
Beispiel #2
0
        // 请求查询交易员资金帐号
        public bool GetTradingAccount(QryTradingAccount qry, ref TradingAccount refTradingAccount)
        {
            DebugOut("Call CStrategy Function GetTradingAccount from MainForm Successfully");

            if (this.orderServer == null)
            {
                return(false);
            }
            return(this.orderServer.GetTradingAccount(qry, ref refTradingAccount));
        }
Beispiel #3
0
        // 成交通知
        public override bool OnTrade(TradeInfo trade)
        {
            QryTradingAccount qryTA = new QryTradingAccount();
            TradingAccount    taRet = new TradingAccount();

            GetTradingAccount(qryTA, ref taRet);

            QryPosition         qryPiso = new QryPosition();
            List <PositionInfo> lstPosi = new List <PositionInfo>();

            GetPositions(qryPiso, ref lstPosi);

            return(true);
        }