public ElwOptionArbData AdjustEnteredOptionCount(ElwOptionArbData bestEOAD) { if (bestEOAD == null) { return null; } String elwCode = bestEOAD.ElwCode; long enteredOptionCount = (long)Math.Abs(GetEnteredLiveOptionCount_PairWithElw(elwCode)); long elwEnteredCount = ElwOptionUtil.ConvertOptionCountToElwCount(bestEOAD.Elw, enteredOptionCount); bestEOAD.OptionCount -= enteredOptionCount; bestEOAD.ElwCount -= elwEnteredCount; if (IsValidEOAD(bestEOAD)) { return bestEOAD; } return null; }
ElwOptionArbData GetBestEOAD(ElwOptionArbData eoad, ElwOptionArbData bestEOAD) { if (eoad != null) { if (bestEOAD == null) { bestEOAD = eoad; } else { if (bestEOAD.OptionCount < eoad.OptionCount) { bestEOAD = eoad; } } } return bestEOAD; }
public ElwArbSweepUnit EnterPosition(ElwOptionArbData eoad) { ElwInfo elwInfo = eoad.Elw; String elwCode = eoad.ElwCode; long optionEnterCount = eoad.OptionCount; long elwEnterCount = eoad.ElwCount; double elwPrice = eoad.ElwPrice; double optionPrice = eoad.OptionPrice; return EnterPosition_Raw( elwInfo, elwCode, eoad.ElwLS, elwEnterCount, elwPrice, eoad.RmdElw, eoad.OptionLS, optionEnterCount, optionPrice, eoad.RmdOption); }
static ElwOptionArbData GetElwOptionArbData_WithProfit(PreData data) { if (!IsEnoughElwPrice(data.ElwPrice)) { return null; } double boundary = GetProfitBoundary(data); if (!IsArbChance(data, boundary)) { return null; } long minOptionCount = GetOptionCount(data, 1024); if (minOptionCount <= 0) { return null; } ElwOptionArbData eod = new ElwOptionArbData( data.Elw, data.ElwPrice, data.ElwLS, data.KOI, data.OptionPrice, data.OptionLS, minOptionCount, data.Diff, data.RmdOption, data.RmdElw, data.IsForward); return Return_EOAD_If_Spread_And_Nabi_Is_OK(eod, data); }
static ElwOptionArbData Return_EOAD_If_Spread_And_Nabi_Is_OK(ElwOptionArbData eod, PreData data) { double optionBidAskSpread = Math.Round(data.RmdOption.AskPrice1, 2) - Math.Round(data.RmdOption.BidPrice1, 2); if (optionBidAskSpread > 0.15) { long elwBookValue = ElwOptionUtil.GetOneOptionValueOfElw(data.Elw, data.ElwPrice); // 나비테스트를 통과해야한다. if (!IsCheapEnoughPassNabiTest(data.IsForward, data.KOI, data.RmdElw, data.Elw, elwBookValue)) { return null; } } return eod; }
static ElwOptionArbData GetElwOptionArbData_WO_Profit(PreData data) { if (!data.IsForward) { return null; } long limitOptionCount = GetTimeBasedLimitOptionCountFor_WO_Profit(data.TotalAttemptOptionCount, DateTime.Now); if (limitOptionCount < 5) { return null; } Debug.Assert(limitOptionCount <= 1024, "ElwArbCalculator.LimitOptionCount error"); if (!IsEnoughElwPrice(data.ElwPrice)) { return null; } double boundary = Get_WO_ProfitBoundary(data); // without profit boundary if (!IsArbChance(data, boundary)) { return null; } long minOptionCount = GetOptionCount(data, limitOptionCount); if (minOptionCount <= 0) { return null; } ElwOptionArbData eod = new ElwOptionArbData( data.Elw, data.ElwPrice, data.ElwLS, data.KOI, data.OptionPrice, data.OptionLS, minOptionCount, data.Diff, data.RmdOption, data.RmdElw, data.IsForward); return Return_EOAD_If_Spread_And_Nabi_Is_OK(eod, data); }
Boolean IsValidEOAD(ElwOptionArbData eoad) { if (eoad.OptionCount >= 2) { return true; } return false; }
ElwOptionArbData AdjustExistElwCount(ElwOptionArbData eoad) { if (_elwOptionReverseLimit.ContainsKey(eoad.Key)) { long exposureElwCount = _elwOptionReverseLimit[eoad.Key] + GetEnteredElwCount(eoad.Key); if (eoad.ElwCount > exposureElwCount) { long exposureOptionCountOfElw = ElwOptionUtil.ConvertElwCountToOptionCount(eoad.Elw, exposureElwCount); eoad.ResetCount_BasedOnOptionCount(exposureOptionCountOfElw); } } else { eoad.ResetCount_BasedOnOptionCount(0); } return eoad; }