/// <summary> /// Add an option contract. This method would not normally be /// invoked by a user application. Rather, /// MamdaOptionChainListener would be most likely to call this /// method. /// </summary> /// <param name="contractSymbol">The option instrument symbol.</param> /// <param name="contract">The Mamda option contract representation.</param> public void addContract( string contractSymbol, MamdaOptionContract contract) { DateTime expireDate = contract.getExpireDate(); double strikePrice = contract.getStrikePrice(); string exchange = contract.getExchange(); MamdaOptionContract.PutOrCall putCall = contract.getPutCall(); mOptions.put(contractSymbol, contract); if (putCall == MamdaOptionContract.PutOrCall.Call) { mCallOptions.add(contract); } else { mPutOptions.add(contract); } // Add the contract to the expiration-by-strike set. MamdaOptionExpirationStrikes expireStrikes = (MamdaOptionExpirationStrikes)mExpirationSet.valueOf(expireDate); if (expireStrikes == null) { expireStrikes = new MamdaOptionExpirationStrikes(); mExpirationSet.put(expireDate, expireStrikes); } MamdaOptionStrikeSet strikeSet = (MamdaOptionStrikeSet)expireStrikes.valueOf(strikePrice); if (strikeSet == null) { strikeSet = new MamdaOptionStrikeSet(expireDate, strikePrice); expireStrikes.put(strikePrice, strikeSet); } MamdaOptionContractSet contractSet = (putCall == MamdaOptionContract.PutOrCall.Call) ? strikeSet.getCallSet() : strikeSet.getPutSet(); if (MamdaOptionExchangeUtils.isBbo(exchange)) { contractSet.setBboContract(contract); } else if (MamdaOptionExchangeUtils.isWombatBbo(exchange)) { contractSet.setWombatBboContract(contract); } else { contractSet.setExchangeContract(exchange, contract); mExchanges.add(exchange); } mStrikePrices.add(strikePrice); }
public MamdaOptionExpirationStrikes(MamdaOptionExpirationStrikes copy) : base(copy) { // Shallow copy. }