コード例 #1
0
        /* Functions below are the actual functions used to
         * parse instrument strings into actual objects. We've created
         * a method for each of the instrument classes we consider.
         * Note that the string has to have a very specific format.
         */

        private void InterpretTenorBasisSwapString(string instrumentString)
        {
            string identifier, type, currency, swapNoSpreadIdent, swapSpreadIdent;

            string[] infoArray = instrumentString.Split(',').ToArray();

            identifier = infoArray[0];
            type       = infoArray[1];
            currency   = infoArray[2];

            // In accordance with market practice, we put the spread on the short leg
            swapSpreadIdent   = infoArray[3];
            swapNoSpreadIdent = infoArray[4];

            try
            {
                IrSwap         swapNoSpread = IrSwaps[swapNoSpreadIdent];
                IrSwap         swapSpread   = IrSwaps[swapSpreadIdent];
                TenorBasisSwap swap         = new TenorBasisSwap(swapSpread, swapNoSpread, _defaultTradeSign);
                BasisSwaps[identifier] = swap;
                DateTime curvePoint = swap.GetCurvePoint();
                CurvePointMap[identifier]           = swap.GetCurvePoint();
                InstrumentTypeMap[identifier]       = QuoteType.ParBasisSpread;
                InstrumentFormatTypeMap[identifier] = InstrumentFormatType.BasisSpreads;
                IdentifierStringMap[identifier]     = instrumentString;
            }
            catch
            {
                // Ignore instrument
            }
        }