Example #1
0
        public void CBInsertOrder(DataResult <OrderInfo> result)
        {
            OrderInfo orderInfo = new OrderInfo();

            orderInfo = result.Result;
            if (result.IsSuccess)
            {
                Global.AddInfo("下單成功, OrderRef:{0}, OrderSysID:{1}",
                               orderInfo.OrderRef, orderInfo.OrderSysID);
            }
        }
Example #2
0
 internal void CBInfo(DataResult result, string action)
 {
     if (result.IsSuccess)
     {
         Global.AddInfo("{0} success", action);
     }
     else
     {
         Global.GBAddInfo("{0} failed: {1}", action, result.Error);
     }
 }
Example #3
0
        public void CBAccountInfo(DataResult <AccountInfo> result)
        {
            if (!result.IsSuccess)
            {
                Global.GBAddInfo("User info failed: {0}", result.Error);
                return;
            }

            var res = result.Result;

            Global.AddInfo("{0}, {1}, {2}, {3}, {4}",
                           res.InvestorID, res.LoginTime, res.TradingDay, res.Available, res.Balance);
        }
Example #4
0
        public void CBUserInfo(DataResult <InvestorInfo> result)
        {
            if (!result.IsSuccess)
            {
                Global.GBAddInfo("User info failed: {0}", result.Error);
                return;
            }

            var res = result.Result;

            Global.AddInfo("{0}, {1}, {2}, {3}",
                           res.InvestorID, res.InvestorName, res.OpenDate, res.IdentifiedCardNo);
        }
Example #5
0
        public void CBQueryPosition(DataListResult <PositionInfo> result)
        {
            if (!result.IsSuccess)
            {
                Global.GBAddInfo("Query position failed: {0}", result.Error);
                return;
            }

            int n = result.Result.Count;

            // Global.AddInfo("Result count:{0}", n);
            for (int i = 0; i < n; ++i)
            {
                var res = result.Result[i];
                Global.AddInfo("{0}: {1}, {2}, {3}, {4}, {5}",
                               i + 1, res.InstrumentID, res.PositionDirection,
                               res.Position, res.PrePosition, res.PositionDate);
            }
        }
Example #6
0
        public void CBQueryTrade(DataListResult <TradeInfo> result)
        {
            if (!result.IsSuccess)
            {
                Global.GBAddInfo("Query order failed: {0}", result.Error);
                return;
            }

            int n = result.Result.Count;

            // Global.AddInfo("Result count:{0}", n);
            for (int i = 0; i < n; ++i)
            {
                var res = result.Result[i];
                Global.AddInfo("{0}: {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}",
                               i + 1, res.TradeID, res.SequenceNo, res.InstrumentID,
                               res.TradeDate, res.TradeTime, res.OpenCloseFlag, res.TradeType,
                               res.TradePrice, res.TradeQuantity);
            }
        }
Example #7
0
 private void OnData(CTPMarketData market)
 {
     Global.AddInfo("Ticker: {0}, Price: {1}, Volume: {2}",
                    market.InstrmentID, market.LastPrice, market.Volume);
 }