Ejemplo n.º 1
0
        public void Init(CThostFtdcTradingAccountField pTradingAccount)
        {
            var account = accountRepo.FirstOrDefault(o => o.AccountID == pTradingAccount.AccountID) ?? new Account();

            ObjectUtils.CopyStruct(pTradingAccount, account);

            Accounts.RaiseListChangedEvents = false;

            Accounts.Add(account);

            Accounts.RaiseListChangedEvents = true;
        }
Ejemplo n.º 2
0
 private void OnRspQryTradingAccount(IntPtr pTraderApi, ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLastt)
 {
     if (0 == pRspInfo.ErrorID)
     {
         m_TradingAccount = pTradingAccount;
         //有资金信息过来了,重新计时
         timerAccount.Enabled = false;
         timerAccount.Enabled = true;
     }
     else
     {
         tdlog.Error("nRequestID:{0},ErrorID:{1},OnRspQryTradingAccount:{2}", nRequestID, pRspInfo.ErrorID, pRspInfo.ErrorMsg);
         EmitError(nRequestID, pRspInfo.ErrorID, "OnRspQryTradingAccount:" + pRspInfo.ErrorMsg);
     }
 }
Ejemplo n.º 3
0
 private void OnRspQryTradingAccount_callback(IntPtr pTraderApi, ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     if (null != OnRspQryTradingAccount)
     {
         OnRspQryTradingAccount(this, new OnRspQryTradingAccountArgs(pTraderApi, ref pTradingAccount, ref pRspInfo, nRequestID, bIsLast));
     }
 }
Ejemplo n.º 4
0
 public void FireOnRspQryTradingAccount(CThostFtdcTradingAccountField pTradingAccount)
 {
     if (null != OnRspQryTradingAccount)
     {
         OnRspQryTradingAccount(pTradingAccount);
     }
 }
Ejemplo n.º 5
0
 public void __RegTradingAccount(CThostFtdcTradingAccountField pTradingAccount)
 {
     TradingAccount = pTradingAccount;
 }
Ejemplo n.º 6
0
 void OnRspQryTradingAccount(CThostFtdcTradingAccountField pTradingAccount)
 {
     Console.WriteLine("==资金");
     Console.WriteLine(pTradingAccount.Balance);
     Console.WriteLine(pTradingAccount.TradingDay);
 }
Ejemplo n.º 7
0
 public OnRspQryTradingAccountArgs(IntPtr pTraderApi, ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     this.pTraderApi = pTraderApi;
     this.pTradingAccount = pTradingAccount;
     this.pRspInfo = pRspInfo;
     this.nRequestID = nRequestID;
     this.bIsLast = bIsLast;
 }
Ejemplo n.º 8
0
        private void OnRspQryTradingAccount(IntPtr pTraderApi, ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLastt)
        {
            if (0 == pRspInfo.ErrorID)
            {
                m_TradingAccount = pTradingAccount;

                //有资金信息过来了,重新计时
                timerAccount.Enabled = false;
                timerAccount.Enabled = true;

                //通知单例,还是使用GetBrokerInfo来取呢?
                CTPAPI.GetInstance().__RegTradingAccount(m_TradingAccount);
                CTPAPI.GetInstance().FireOnRspQryTradingAccount(pTradingAccount);
            }
            else
            {
                tdlog.Error("nRequestID:{0},ErrorID:{1},OnRspQryTradingAccount:{2}", nRequestID, pRspInfo.ErrorID, pRspInfo.ErrorMsg);
                EmitError(nRequestID, pRspInfo.ErrorID, "OnRspQryTradingAccount:" + pRspInfo.ErrorMsg);
            }
        }