public Order?DecideOrder(PositionDelta delta) { OptionQuote quote = delta.Quote ?? MarketDataClient.GetOptionQuote(delta.Symbol); // TODO: Remove after testing //Log.Warning("Not getting real quote"); //OptionQuote quote = new OptionQuote(delta.Symbol, delta.Price * (float).99, delta.Price * (float)1.01, delta.Price, delta.Price * (float)1.06, (float)1.0); if (quote.Time < DateTime.Now.AddSeconds(-15)) { Log.Information("Getting new quote. Old quote- {@Quote}", quote); quote = MarketDataClient.GetOptionQuote(delta.Symbol); } Log.Information("{DeltaType} delta {@Delta}- current mark price {Mark}. Symbol {Symbol}", delta.DeltaType, delta, quote.Mark.ToString("0.00"), delta.Symbol); Position?currentPos = BrokerClient.GetPosition(delta.Symbol); if (delta.DeltaType == DeltaType.SELL) { return(DecideSell(delta, currentPos)); } else if (delta.DeltaType == DeltaType.ADD || delta.DeltaType == DeltaType.NEW) { return(DecideBuy(delta, currentPos, quote)); } else { Log.Error("Unrecognized deltaType: {type}", delta.DeltaType); return(null); } }