예제 #1
0
 public OnRspQryTradingAccountArgs(ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     this.pTradingAccount = pTradingAccount;
     this.pRspInfo        = pRspInfo;
     this.nRequestID      = nRequestID;
     this.bIsLast         = bIsLast;
 }
예제 #2
0
 public void FireOnRspQryTradingAccount(CThostFtdcTradingAccountField pTradingAccount)
 {
     if (null != OnRspQryTradingAccount)
     {
         OnRspQryTradingAccount(pTradingAccount);
     }
 }
예제 #3
0
 private void OnRspQryTradingAccount_callback(object sender, ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     if (null != OnRspQryTradingAccount)
     {
         OnRspQryTradingAccount(this, new OnRspQryTradingAccountArgs(ref pTradingAccount, ref pRspInfo, nRequestID, bIsLast));
     }
 }
예제 #4
0
 private void CTPOnRspQryTradingAccount(ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     if (!string.IsNullOrEmpty(pTradingAccount.AccountID))
     {
         TradingAccount.Available = pTradingAccount.Available;
         //this.TradingAccount.CashIn = pTradingAccount.CashIn; //资金查额
         TradingAccount.CloseProfit = pTradingAccount.CloseProfit;
         TradingAccount.Commission  = pTradingAccount.Commission;
         TradingAccount.CurrMargin  = pTradingAccount.CurrMargin;
         //this.TradingAccount.DeliveryMargin = pTradingAccount.DeliveryMargin;
         TradingAccount.FrozenCash     = pTradingAccount.FrozenCash;
         TradingAccount.PositionProfit = pTradingAccount.PositionProfit;
         TradingAccount.PreBalance     = pTradingAccount.PreBalance + pTradingAccount.Deposit - pTradingAccount.Withdraw;
         //this.TradingAccount.Reserve = pTradingAccount.Reserve;
         //this.TradingAccount.WithdrawQuota = pTradingAccount.WithdrawQuota;//可取
         TradingAccount.Fund = TradingAccount.PreBalance                                                                    //静态权益
                               + pTradingAccount.CloseProfit + pTradingAccount.PositionProfit - pTradingAccount.Commission; //动态权益
         TradingAccount.Risk = TradingAccount.CurrMargin / TradingAccount.Fund;
     }
     if (bIsLast)
     {
         //首次查询后启动循环查询
         if (!IsLogin)
         {
         }
     }
 }
예제 #5
0
 /// <summary>
 /// 查询交易账户的回报
 /// </summary>
 /// <param name="pTradingAccount"></param>
 /// <param name="pRspInfo"></param>
 /// <param name="nRequestID"></param>
 /// <param name="bIsLast"></param>
 private void CTradeApi_OnRspQryTradingAccount(ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     this._taf.CThostFtdcTradingAccountFieldInstance = pTradingAccount;
     if (bIsLast)
     {
         this._OnTradingAccount?.Invoke(this._taf);
     }
     this._isQryTradingAccountCompleted = bIsLast;
 }
예제 #6
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
     {
         EmitError(nRequestID, pRspInfo.ErrorID, "OnRspQryTradingAccount:" + pRspInfo.ErrorMsg);
     }
 }
예제 #7
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);
            }
        }
예제 #8
0
 public TradeAccount(CThostFtdcTradingAccountField cftaf)
 {
     this.CThostFtdcTradingAccountFieldInstance = cftaf;
 }
예제 #9
0
 private void OnRspQryTradingAccount_3(IntPtr pTraderApi, ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     OnRspQryTradingAccount_1(this, pTraderApi, ref pTradingAccount, ref pRspInfo, nRequestID, bIsLast);
 }
예제 #10
0
 private void OnRspQryTradingAccount_3(ref CThostFtdcTradingAccountField pTradingAccount, ref CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     OnRspQryTradingAccount_1(this, ref pTradingAccount, ref pRspInfo, nRequestID, bIsLast);
 }
 ///请求查询资金账户响应
 public void OnRspQryTradingAccount(CThostFtdcTradingAccountField pTradingAccount,
                                    CThostFtdcRspInfoField pRspInfo, int nRequestID, bool bIsLast)
 {
     Console.WriteLine("OnRspQryTradingAccount");
 }
예제 #12
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));
     }
 }
 public override void OnRspQryTradingAccount(CThostFtdcTradingAccountField pTradingAccount, CThostFtdcRspInfoField pRspInfo,
                                             int nRequestID, bool bIsLast)
 {
     _callbackApi.OnRspQryTradingAccount(pTradingAccount, pRspInfo, nRequestID, bIsLast);
 }
예제 #14
0
 void OnRspQryTradingAccount(CThostFtdcTradingAccountField pTradingAccount)
 {
     Console.WriteLine("==资金");
     Console.WriteLine(pTradingAccount.Balance);
     Console.WriteLine(pTradingAccount.TradingDay);
 }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CThostFtdcTradingAccountField obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #16
0
파일: EventArgs.cs 프로젝트: vcfriend/CTP
 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;
 }
예제 #17
0
 public void __RegTradingAccount(CThostFtdcTradingAccountField pTradingAccount)
 {
     TradingAccount = pTradingAccount;
 }