Ejemplo n.º 1
0
        public void setData(string sData)
        {
            string[] sVals = sData.Split(',');

            m_dtOpenTime_req  = Convert.ToDateTime(sVals[0]);
            m_dtOpenTime_exc  = Convert.ToDateTime(sVals[1]);
            m_dtCloseTime_req = Convert.ToDateTime(sVals[2]);
            m_dtCloseTime_exc = Convert.ToDateTime(sVals[3]);

            m_sSymbol   = sVals[4];
            m_dLots_req = Convert.ToDouble(sVals[5]);
            m_dLots_exc = Convert.ToDouble(sVals[6]);

            m_nCmd = TRADER.string2Cmd(sVals[7]);

            m_dOpenPrice_req = Convert.ToDouble(sVals[8]);
            m_dOpenPrice_exc = Convert.ToDouble(sVals[9]);

            m_dClosePrice_req = Convert.ToDouble(sVals[10]);
            m_dClosePrice_exc = Convert.ToDouble(sVals[11]);

            m_dProfit_real = Convert.ToDouble(sVals[12]);
            m_sLogicID     = sVals[13];
            m_sComment     = sVals[14];
        }
Ejemplo n.º 2
0
 public int getSignal_unitTest()
 {
     for (int i = 0; i < m_lstUnitTest_signal.Count; i++)
     {
         if (m_lstUnitTest_signal[i].m_dtTime == CFATCommon.m_dtCurTime)
         {
             CFATLogger.output_proc(string.Format("unitTest signal : {0},{1}", m_sLogicID, m_lstUnitTest_signal[i].m_sCmd));
             return((int)TRADER.string2Cmd(m_lstUnitTest_signal[i].m_sCmd));
         }
     }
     return((int)ETRADER_OP.NONE);
 }
Ejemplo n.º 3
0
        public override bool updateRealPositions()
        {
            if (CFATManager.m_nRunMode != ERUN_MODE.REALTIME)
            {
                return(true);
            }

            TPosItem posItem;

            m_lstPos_real.Clear();

            string sSymbol = "";
            double dPrice  = 0;
            int    nLots   = 0;

            CSHGoldAPI.sg_getPositionList();
            int    nPosCnt = CSHGoldAPI.sg_getPositionCount();
            string sMsg    = string.Format("SHGold Position count = {0}\r\n", nPosCnt);
            string sCmd    = "";

            for (int i = 0; i < nPosCnt; i++)
            {
                CSHGoldAPI.sg_getPositionInfo(i, ref sSymbol, ref dPrice, ref nLots, ref sCmd);
                sMsg += string.Format("symbol = {0}, open price = {1}, lots = {2}\r\n", sSymbol, dPrice, nLots);
                if (nLots == 0)
                {
                    continue;
                }
                posItem                  = new TPosItem();
                posItem.m_sSymbol        = sSymbol;
                posItem.m_dOpenPrice_exc = dPrice;
                posItem.m_nCmd           = TRADER.string2Cmd(sCmd);
                if (sCmd == "BUY")
                {//Buy
                    posItem.m_nCmd      = ETRADER_OP.BUY;
                    posItem.m_dLots_exc = nLots;
                }
                else
                {//Sell
                    posItem.m_nCmd      = ETRADER_OP.SELL;
                    posItem.m_dLots_exc = nLots;
                }

                m_lstPos_real.Add(posItem);
            }
            //CFATLogger.output_proc(sMsg);
            return(true);
        }