public InstrumentVector(InstrumentVector other) : this(NQuantLibcPINVOKE.new_InstrumentVector__SWIG_1(InstrumentVector.getCPtr(other)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public InstrumentVectorEnumerator(InstrumentVector collection)
 {
     collectionRef = collection;
     currentIndex  = -1;
     currentObject = null;
     currentSize   = collectionRef.Count;
 }
예제 #3
0
 public void precalculate(InstrumentVector optionList)
 {
     NQuantLibcPINVOKE.FFTVarianceGammaEngine_precalculate(swigCPtr, InstrumentVector.getCPtr(optionList));
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public void SetRange(int index, InstrumentVector values)
 {
     NQuantLibcPINVOKE.InstrumentVector_SetRange(swigCPtr, index, InstrumentVector.getCPtr(values));
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
        public static InstrumentVector Repeat(Instrument value, int count)
        {
            global::System.IntPtr cPtr = NQuantLibcPINVOKE.InstrumentVector_Repeat(Instrument.getCPtr(value), count);
            InstrumentVector      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new InstrumentVector(cPtr, true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        public InstrumentVector GetRange(int index, int count)
        {
            global::System.IntPtr cPtr = NQuantLibcPINVOKE.InstrumentVector_GetRange(swigCPtr, index, count);
            InstrumentVector      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new InstrumentVector(cPtr, true);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
예제 #7
0
    public bool addCommand(String strCommand)
    {
        bool bSuccess = true;
        String[] strTmp = strCommand.Split(new char[] { ':' });

        int lLength = strTmp.Length;
        if (strTmp[0].Equals("PAGE"))
        {
            if (lLength < 2)
                return false;

            int pageNo = 0;

            try
            {
                pageNo = int.Parse(strTmp[1]);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex.Source);
                return false;
            }

            /*******************************************************************
             *
             * To download and subscribe for all available instruments for markets 
             * where Pages are supported, sends a page request to get a page 
             * update to list all instruments on the page.
             * When an Issue Update is recieved for each unique instrument for 
             * the page, the download is complete.
             * Note: Comments (dividers or other info) displayed on a page are 
             * also present in the Page Update as an instrument. These 'comment' 
             * issues can be filtered out when the Issue Update is received as 
             * they all have Market Type = eComment (0). Once a Page Request is 
             * sent you will continuously receive issue updates (market prices) 
             * for all instruments on the page.
             *
             ******************************************************************/


            iCMsg msg = new iCMsgPageRequest(ushort.Parse(pageNo.ToString()));

            m_vecMsg.Add(msg);
        }
        else if(strTmp[0].Equals("MARKET"))
        {
            if(lLength < 2)
                return false;
            int marketId = 0;
            eICMarketId mktId;

            try
            {
                marketId = int.Parse(strTmp[1]);
                mktId = (eICMarketId)marketId;
                //mktId = eICMarketId.swigToEnum(marketId);
            }
            catch (Exception ie)
            {
                System.Console.WriteLine("Invalid market id : " + strTmp[1] + ie.Source);
                return false;
            }
			
			/*******************************************************************
			 *
			 * To download and subscribe for all available instruments for a given
			 * market where the Issue List request is supported, a two step process 
			 * is recommended. First send an initial Issue List request for the 
			 * market is sent without any subscription to Issue Updates or Issue 
			 * Book updates. This to receive all available divisions within 
			 * requested market in the response, as all available instruments are 
			 * grouped in divisions within the market. When the Positive Issue 
			 * List response is recieved, iterate through all the available divisions 
			 * and send another Issue List Request for each divison where you now 
			 * subscribe for all Issue Updates. When an Issue Update is recieved 
			 * for each unique instrument per market, the download is complete. 
			 * Send an initial issue list response to recieve all available 
			 * divisions (groups) within the market. 
			 *
			 ******************************************************************/
            IssueRequestTypeVector issueTypes = new IssueRequestTypeVector();
            issueTypes.Add(eICIssueRequestType.eIssueRequestNoData);  // No Issue Updates 

            iCMsg msg = new iCMsgIssueListRequest(mktId, issueTypes);

//            iCMsg msg = new iCMsgIssueListRequest(eICMarketId.eUST, issueTypes);

            m_vecMsg.Add(msg);
        }
        else if(strTmp[0].Equals("ISSUE"))
        {
            if(lLength < 3)
                return false;

            int icInstrument = 0;

            try
            {
                /***************************************************************
                 *
                 * To download and subscribe for a single instrument, an Issue 
                 * Request is sent. All issues are uniquely indentified by its 
                 * instrument id. The instrument id is an integer (4 bytes), 
                 * which is a combination of an instrument type and instrument 
                 * number, as the instrument type shifted 16 bits plus the 
                 * instrument number.
                 *
                 **************************************************************/

                short instrtype = short.Parse(strTmp[1]);
                short instrnumb = short.Parse(strTmp[2]);

                icInstrument = (instrtype << 16) + instrnumb;

            }
            catch(Exception ex)
            {
                System.Console.WriteLine(ex.Message);
                return false;
            }

            /*******************************************************************
             *
             * Sends an issue request to continuously receive issue updates 
             * (market prices) for a single instrument
             *
             ******************************************************************/

            IssueRequestTypeVector issueTypes = new IssueRequestTypeVector();
            InstrumentVector iv = new InstrumentVector();
            iv.Add((uint)icInstrument);

            issueTypes.Add(eICIssueRequestType.eIssueRequestAllData);  //Requesting all 
 
            iCMsg msg = new iCMsgIssueRequest(iv, issueTypes);

            m_vecMsg.Add(msg);

        }
        else if(strTmp[0].Equals("BOOK"))
        {
            if(lLength < 3)
                return false;

            int icInstrument = 0;

            try
            {
                /***************************************************************
                 *
                 * To subscribe for the below-the-market market data for a single 
                 * instrument, an Issue Book Request is sent. All issues are 
                 * uniquely indentified by its instrument id. The instrument id 
                 * is an integer (4 bytes), which is a combination of an instrument 
                 * type and instrument number, as the instrument type shifted 
                 * 16 bits plus the instrument number.
                 *
                 **************************************************************/
                short instrtype = short.Parse(strTmp[1]);
                short instrnumb = short.Parse(strTmp[2]);

                icInstrument = (instrtype << 16) + instrnumb;
            }
            catch(Exception ex)
            {
                System.Console.WriteLine(ex.Message);
                return false;
            }

            /*******************************************************************
             *
             * Sends an Issue Book request to continuously receive 
             * Issue Book Updates (market depth) for a single instrument.
             *
             ******************************************************************/
            IssueRequestTypeVector issueTypes = new IssueRequestTypeVector();
            issueTypes.Add(eICIssueRequestType.eIssueRequestBidDepth);
            issueTypes.Add(eICIssueRequestType.eIssueRequestOfferDepth);

            InstrumentVector iv = new InstrumentVector();
            iv.Add((uint)icInstrument);

            iCMsg msg = new iCMsgIssueRequest(iv, issueTypes);

            m_vecMsg.Add(msg);


        }
        else if(strTmp[0].Equals("DETAILS"))
        {
            if(lLength < 3)
                return false;

            int icInstrument = 0;

            try
            {
                /***************************************************************
                 *
                 * To download details for a single instrument, an Issue Detail 
                 * Request is sent. All issues are uniquely indentified by its 
                 * instrument id. The instrument id is an integer (4 bytes), 
                 * which is a combination of an instrument type and instrument 
                 * number, as the instrument type shifted 16 bits plus the 
                 * instrument number.
                 *
                 **************************************************************/

                short instrtype = short.Parse(strTmp[1]);
                short instrnumb = short.Parse(strTmp[2]);

                icInstrument = (instrtype << 16) + instrnumb;
            }
            catch(Exception ex)
            {
                System.Console.WriteLine(ex.Message);
                return false;
            }

            /*******************************************************************
             *
             * Sends a issue detail request to get a positive issue detail reponse 
             * (instrument description and info) for a single instrument.
             *
             ******************************************************************/


            IssueRequestTypeVector issueTypes = new IssueRequestTypeVector();
            issueTypes.Add(eICIssueRequestType.eIssueRequestStaticData);

            InstrumentVector iv = new InstrumentVector();
            iv.Add((uint)icInstrument);

            iCMsg msg = new iCMsgIssueRequest(iv, issueTypes);

            m_vecMsg.Add(msg);
        }
        else if(strTmp[0].Equals("LOOKUP"))
        {
            if(lLength < 4)
                return false;

            int marketId = 0;
            eICMarketId mktId;

            short marketType = 0;
            //eICMarketType mktType;

			/*******************************************************************
			 *
			 * To download details for a single instrument 
			 * (e.g. to get the instrument id) when the IssueID 
			 * (CUSIP, ISIN or other standard market issue identifier) is known, 
			 * an Issue Detail Request is sent. An issue can be identified by 
			 * its standard market issue identifier + market id + market type.
			 * For Repos the start and end date must also be known 
			 * (not yet supported by this request).
			 *
			 ******************************************************************/

            try
            {
                marketId = int.Parse(strTmp[1]);
//                mktId = eICMarketId.swigToEnum(marketId);
                mktId = (eICMarketId)marketId;
            }
            catch (Exception ie)
            {
                System.Console.WriteLine("Invalid market id : " + strTmp[1] + ie.Source);
                return false;
            }
            try
            {
                marketType = short.Parse(strTmp[2]);
            }
            catch (Exception ie)
            {
                System.Console.WriteLine("Invalid market Type : " + strTmp[2] + ie.Source);
                return false;
            }
		
			// CUSIP, ISIN or other standard market issue identifier (IssueId)
            iCIssueId issueId = new iCIssueId(strTmp[3]);

            /*******************************************************************
             *
             * Sends an Issue Lookup request to receive issue information for 
             * a single instrument based on MarketId, MarketType and IssueId.
             *
             ******************************************************************/
            // $$ S.T. 9-1-2015 $$
            //iCMsg msg = new iCMsgIssueLookupRequest(mktId, (byte)marketType, issueId);

            //m_vecMsg.Add(msg);
        }
        else if(strTmp[0].Equals("TICKER"))
        {
            // Sends an Ticker request to receive ticker information.

            iCMsg msg = new iCMsgTickerRequest();


            m_vecMsg.Add(msg);
        }

        // STP LOGIN
        else if(strTmp[0].Equals("REQUEST"))
        {
            if (strTmp[1].Equals("ALL,0"))
            {
                // Send the Trade Request ALL message
                iCMsg msg = new iCMsgTradeRequest(eICTradeRequest.eTradeRequestAll, "00000000000000000000");
                m_iAckFlag = 0;
                m_vecMsg.Add(msg);
            }
      
            else if (strTmp[1].Equals("ALL,1"))
            {
                // Send the Trade Request ALL message
                iCMsg msg = new iCMsgTradeRequest(eICTradeRequest.eTradeRequestAll, "00000000000000000000");
                m_iAckFlag = 1;
                m_vecMsg.Add(msg);
            }

            else if (strTmp[1].Equals("UNMATCHED,0"))
            {
                // Send the Trade Request ALL message
                iCMsg msg = new iCMsgTradeRequest(eICTradeRequest.eTradeRequestUnmatched, "00000000000000000000");
                m_iAckFlag = 0;
                m_vecMsg.Add(msg);
            }

            else if (strTmp[1].Equals("UNMATCHED,1"))
            {
                // Send the Trade Request ALL message
                iCMsg msg = new iCMsgTradeRequest(eICTradeRequest.eTradeRequestUnmatched, "00000000000000000000");
                m_iAckFlag = 1;
                m_vecMsg.Add(msg);
            }

        }

        return bSuccess;
    }
예제 #8
0
 public void precalculate(InstrumentVector optionList) {
   NQuantLibcPINVOKE.FFTVarianceGammaEngine_precalculate(swigCPtr, InstrumentVector.getCPtr(optionList));
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InstrumentVector obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }