protected int CalculateVolumeInBaseCurrency(decimal volumeDepo, string tradeTicker, VolumeRoundType roundType, QuoteData quoteByTicker = null) { var volumeBase = volumeDepo; var depoCurx = robotContext.AccountInfo.Currency; var quotes = QuoteStorage.Instance.ReceiveAllData(); bool inverse, pairsEqual; var tickerTrans = DalSpot.Instance.FindSymbol(tradeTicker, true, depoCurx, out inverse, out pairsEqual); if (!pairsEqual) { QuoteData quote; if (tickerTrans == tradeTicker && quoteByTicker != null) { quote = quoteByTicker; } else { quotes.TryGetValue(tickerTrans, out quote); } if (quote == null) { var msgError = string.Format( "Невозможно рассчитать объем - отсутствует котировка \"{0}\"", tickerTrans); Logger.Info(msgError); return(0); } var priceTrans = inverse ? 1 / quote.bid : quote.ask; volumeBase /= (decimal)priceTrans; } return(MarketOrder.RoundDealVolume((int)volumeBase, roundType, RoundMinVolume, RoundVolumeStep)); }
// Constructor public RRTS(int accountNumber, bool rateAsClass50, bool isAAFES, ref QuoteData quoteData) { this.accountNumber = accountNumber; this.quoteData = quoteData; this.rateAsClass50 = rateAsClass50; this.isAAFES = isAAFES; }
public bool MoveToTime(DateTime time, out QuoteData quote) { quote = null; if (reader == null) { return(false); } // читать котировки из файла до даты "time" while (true) { var nextQuote = ReadNextQuoteFromStream(); if (nextQuote == null) {// дошли до конца файла reader = null; return(false); } if (nextQuote.time < time) { continue; } quote = nextQuote; buffer.Add(quote); bufferPosition = 0; // зачитать N строк в буфер FillBuffer(); return(true); } }
private void ClosePositionAndCalculateProfit(MarketOrder pos, QuoteData quote, PositionExitReason reason) { pos.PriceExit = pos.Side < 0 ? quote.ask : quote.bid; // убираем проскальзывания на истории if (pos.StopLoss != null && pos.StopLoss != 0) { if ((pos.StopLoss > pos.PriceExit && pos.Side == 1) || (pos.StopLoss < pos.PriceExit && pos.Side == -1)) { pos.PriceExit = pos.StopLoss; } } else if (pos.TakeProfit != null && pos.TakeProfit != 0) { if ((pos.TakeProfit < pos.PriceExit && pos.Side == 1) || (pos.TakeProfit > pos.PriceExit && pos.Side == -1)) { pos.PriceExit = pos.TakeProfit; } } pos.TimeExit = curModelTime; //quote.time; pos.State = PositionState.Closed; var deltaAbs = pos.Side * (pos.PriceExit.Value - pos.PriceEnter); pos.ResultPoints = DalSpot.Instance.GetPointsValue(pos.Symbol, deltaAbs); pos.ResultDepo = (float)profitCalculator.CalculatePositionProfit(pos, AccountInfo.Currency, quotesStorage.ReceiveAllData()); pos.ResultDepo = pos.ResultDepo; pos.ExitReason = reason; // скорректировать баланс AccountInfo.Balance += (decimal)pos.ResultDepo; // обновить историю и убрать позицию из списка posHistory.Add(pos); Positions.Remove(pos); }
// POST api/getltlrates public string Post(FormDataCollection form) { try { //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HelperFuncs.writeToSiteErrors("get_ltl_rates new ", "get_ltl_rates new "); //HelperFuncs.QuoteData quoteData = new HelperFuncs.QuoteData(); QuoteData quoteData = new QuoteData(); Models.LTL.Helper helper = new Models.LTL.Helper(); helper.setParameters(ref form, ref quoteData); LTL_Carriers carriers = new LTL_Carriers(quoteData); SharedLTL.CarriersResult result = carriers.GetRates(); //string res = carriers.GetRates(); //HelperFuncs.writeToSiteErrors("get_ltl_rates result", res); StringBuilder res = new StringBuilder(); //res.Append("myObj = {\"carrierRates\": "); //res.Append("\"carrierRates\": "); res.Append(result.totalQuotes.ToJSON()); //SharedLTL.getCarriersResultJSON(ref result.totalQuotes, ref res); //res.Append("}"); //res.Append("]"); return(res.ToString()); } catch (Exception e) { HelperFuncs.writeToSiteErrors("get_ltl_rates", e.ToString()); return("0"); } }
public bool IsValid(string symbol, QuoteData quote) { var logMsgCode = symbol.GetHashCode(); var price = (quote.ask + quote.bid) * 0.5f; if (price < MinValue) { logNoFlood.LogMessageFormatCheckFlood(LogEntryType.Debug, logMsgCode, 1000 * 60 * 120, "Котировка {0} ({1}) меньше допустимого значения {2}", symbol, price, MinValue); return(false); } float val; if (!quoteByTicker.TryGetValue(symbol, out val)) { return(true); } var delta = Math.Abs(price - val) / val; if (delta > MaxDeltaRel) { logNoFlood.LogMessageFormatCheckFlood(LogEntryType.Debug, logMsgCode, 1000 * 60 * 120, "Котировка {0} ({1}): последнее сохраненное значение {2}", symbol, price, val); return(false); } return(true); }
string UserName; //, APIKey #endregion #region Constructor public Parser(ref QuoteData quoteData, ref string UserName, ref bool guaranteedService, ref bool is_Estes_HHG_Under_500) { this.quoteData = quoteData; this.UserName = UserName; this.guaranteedService = guaranteedService; this.is_Estes_HHG_Under_500 = is_Estes_HHG_Under_500; }
void axGQuoteOpr_Data(object sender, _DGQuoteOprEvents_DataEvent e) { QuoteData QD; string symbo = e.strSymbolName; if (Datas.quoteWareHouse.ContainsKey(symbo)) { QD = Datas.quoteWareHouse[symbo]; } else { QD = new QuoteData(); QD.Symbol = symbo; QD.SymboType = (int)axGQuoteOpr.GetSymbolInfoValue(e.nSymbolIndex, 0); Datas.quoteWareHouse.Add(symbo, QD); } QD.TradingPrice = axGQuoteOpr.GetSymbolInfoValue(e.nSymbolIndex, 3); QD.ReferencePrice = axGQuoteOpr.GetSymbolInfoValue(e.nSymbolIndex, 12); QD.Bid = axGQuoteOpr.GetSymbolInfoValue(e.nSymbolIndex, 30); QD.Ask = axGQuoteOpr.GetSymbolInfoValue(e.nSymbolIndex, 50); if (getDataNotify != null) { getDataNotify(symbo); } }
private void OpenDeal(QuoteData quote, int dealSide) { var dealVolumeDepo = CalculateVolume(ticker); if (dealVolumeDepo == 0) { return; } decimal?stop = StopLossPoints == 0 ? (decimal?)null : (decimal)quote.bid - dealSide * DalSpot.Instance.GetAbsValue(ticker, (decimal)StopLossPoints); decimal?take = TakeProfitPoints == 0 ? (decimal?)null : (decimal)quote.bid + dealSide * DalSpot.Instance.GetAbsValue(ticker, (decimal)TakeProfitPoints); robotContext.SendNewOrderRequest( protectedContext.MakeProtectedContext(), RequestUniqueId.Next(), new MarketOrder { AccountID = robotContext.AccountInfo.ID, Magic = Magic, Symbol = ticker, Volume = dealVolumeDepo, Side = dealSide, StopLoss = (float?)stop, TakeProfit = (float?)take, ExpertComment = "FibonacciRobot" }, OrderType.Market, 0, 0); }
/// <summary> /// считаемтся суммарный ордер /// текущая котировка берется из curQuote, если таковая null - из /// avgPrice /// </summary> public MarketOrder CalculateSummaryOrder(List <MarketOrder> orders, QuoteData curQuote, float?avgPrice) { if (orders.Count == 0) { return(null); } if (orders.Count == 1) { return(orders[0].MakeCopy()); } var symbol = orders[0].Symbol; float sumBuys = 0, sumSells = 0; var sumVolume = 0; var totalProfit = 0f; foreach (var order in orders) { sumVolume += order.Side * order.Volume; if (order.Side > 0) { sumBuys += order.Volume * order.PriceEnter; } else { sumSells += order.Volume * order.PriceEnter; } totalProfit += order.ResultDepo; } var miniPipCost = GetAbsValue(symbol, 1 / 10f); if (sumVolume != 0) { var averagePrice = (sumBuys - sumSells) / sumVolume; var avgOrder = new MarketOrder { Symbol = orders[0].Symbol, PriceEnter = averagePrice, ResultDepo = totalProfit, Side = Math.Sign(sumVolume), Volume = Math.Abs(sumVolume), StopLoss = GetDefaultSample(orders.Select(o => o.StopLoss), true, miniPipCost), TakeProfit = GetDefaultSample(orders.Select(o => o.TakeProfit), true, miniPipCost), }; var price = avgPrice; if (curQuote != null) { price = avgOrder.Side > 0 ? curQuote.bid : curQuote.ask; } avgOrder.ResultPoints = price.HasValue ? (int)Math.Round(GetPointsValue(symbol, avgOrder.Side * (price.Value - avgOrder.PriceEnter))) : 0; return(avgOrder); } return(null); }
private void MakeOrder(string expertComment, string comment, int dealSign, QuoteData curQuote, List <string> hints) { var tradeVolume = GetEnterVolume(); if (tradeVolume == 0) { hints.Add(comment + ", объем входа 0"); return; } var order = new MarketOrder { ExpertComment = expertComment, // описание проекции Comment = comment, Symbol = ticker, Volume = tradeVolume, Side = dealSign, //StopLoss = }; // запрос входа на сервере var status = NewOrder(order, OrderType.Market, (decimal)(dealSign > 0 ? curQuote.ask : curQuote.bid), 0); if (status != RequestStatus.OK) { hints.Add(comment + ", вход неуспешен: " + status); } }
private void CheckPendingOrders(string symbol, QuoteData quote) { var execOrders = GetFireingPendgingOrders(symbol, quote); foreach (var ord in execOrders) { // ордер сработал, открываем позицию и удаляем его if (SendNewOrderRequest(null, 0, new MarketOrder { AccountID = AccountInfo.ID, Magic = ord.Magic, Symbol = ord.Symbol, Volume = ord.Volume, Side = ord.Side, StopLoss = ord.StopLoss, TakeProfit = ord.TakeProfit, Comment = ord.Comment, ExpertComment = ord.ExpertComment }, OrderType.Market, (decimal)ord.PriceFrom, 0) != RequestStatus.OK) { continue; } positions[positions.Count - 1].PendingOrderID = ord.ID; orders.Remove(ord); } }
/// <summary> /// Расчитать объем сделки в валюте депозита /// </summary> public void CalculateDealVolumeInDepoCurrency(MarketOrder deal, QuoteData dealQuote, string depoCurrency, QuoteArchive arc, DateTime date) { var volumeInCounter = deal.Volume * dealQuote.GetPrice(QuoteType.NonSpecified); // перевести из контрвалюты в валюту депо bool inverse, pairsAreEqual; var smb = DalSpot.Instance.FindSymbol(deal.Symbol, false, depoCurrency, out inverse, out pairsAreEqual); if (pairsAreEqual) { deal.VolumeInDepoCurrency = volumeInCounter; return; } if (string.IsNullOrEmpty(smb)) { return; } var quoteCtDepo = arc.GetQuoteOnDateSeq(smb, date); if (quoteCtDepo == null) { return; } var priceCtDepo = quoteCtDepo.GetPrice(QuoteType.NonSpecified); if (priceCtDepo == 0) { return; } deal.VolumeInDepoCurrency = inverse ? volumeInCounter / priceCtDepo : volumeInCounter * priceCtDepo; }
public List <QuoteData> GetQuoteService() { List <QuoteData> listReponse = new List <QuoteData>(); try { using (SqlConnection con = new SqlConnection(connectionString)) { using (SqlCommand cmd = new SqlCommand("SPQuoteGetService", con)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; con.Open(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { QuoteData quote = new QuoteData(); quote.date = Convert.ToDateTime(reader["DTQuote"]); quote.symbol = reader["CDQuote"].ToString(); quote.value = Convert.ToDouble(reader["VLQuote"]); quote.openValue = Convert.ToBoolean(reader["STOpen"]); listReponse.Add(quote); } } } } } catch (Exception ex) { } return(listReponse); }
public QuoteData Create(QuoteData quote) { var newQuote = DB.Quotes.Add(quote); DB.SaveChanges(); return(newQuote.Entity); }
protected void newQuoteDataArrived(QuoteData data) { _log.Debug("通知股票{0}Actor,有新Quote数据到达", data.Alias); symbolActors[data.Symbol].Tell(new SecuritiesQuotationRequest() { Type = SecuritiesQuotationRequest.RequestType.NEW_QUOTEDATA, Body = data }); }
public static BarSeries CompressBars(QuoteSeries quotes, QuoteData input, BarType barType, long barSize) { if (barType == BarType.Range && input == QuoteData.BidAsk) { throw new ArgumentException(string.Format("Cannot make range bars from {0}", input)); } return(DataManager.CompressBars(new QuoteDataEnumerator(quotes, input), barType, 1L, barSize)); }
public Result CalculateChapter7(QuoteData quoteData) { Result result = new Result(); result.Total = ...; result.Discount = ...; result.Comparison = ...; return(result); }
private int GetSignalSide(List <string> hints, QuoteData curQuote, out string comment, out string expertComment) { comment = string.Empty; expertComment = string.Empty; // есть ли "пробитая" проекция? string projString; var projSign = GetLastProjectionSide(out projString); if (projSign == 0) { return(0); } // есть ли дивер? var diverSpan = GetDivergence(); var lastSign = diverSpan == null ? 0 : diverSpan.sign; if (lastSign == 0) { return(0); } // знаки не совпали - входа нет if (lastSign != projSign) { if (ExtendedMarks) { hints.Add(new RobotHint(ticker, BarSettingsStorage.Instance.GetBarSettingsFriendlyName(timeframe), string.Format("Знаки расширения {0} и дивергенции [{1}:{2}] не совпали", projString, diverSpan.sign > 0 ? "бычья" : "медвежья", candles[diverSpan.end].timeClose.ToStringUniform()), "Нет входа", "", curQuote.bid ) { Time = curQuote.time, ColorFill = Color.LightGreen, ColorLine = Color.Black, RobotHintType = lastSign > 0 ? RobotHint.HintType.Покупка : RobotHint.HintType.Продажа }.ToString()); } return(0); } if (diverSpan != null) { expertComment = projString; comment = string.Format("Ф: {0}, дивер: [{1}:{2}]", projString, diverSpan.sign > 0 ? "бычья" : "медвежья", candles[diverSpan.end].timeOpen.ToStringUniform()); } // вернуть знак предполагаемого входа в рынок return(lastSign); }
private void UpdateQuoteData(string ticker, string exchange, DateTime lastTrade, decimal last, decimal bid, decimal ask, int bidSize, int askSize) { bool changed = false; QuoteData quote = null; if (!QuoteDatas.ContainsKey(ticker)) { quote = new QuoteData() { Ticker = ticker, Exchange = exchange }; QuoteDatas[ticker] = quote; changed = true; } else { quote = QuoteDatas[ticker]; } if (quote.Last != last) { quote.Last = last; changed = true; } if (quote.Bid != bid) { quote.Bid = bid; changed = true; } if (quote.Ask != ask) { quote.Ask = ask; changed = true; } if (quote.BidSize != bidSize) { quote.BidSize = bidSize; changed = true; } if (quote.AskSize != askSize) { quote.AskSize = askSize; changed = true; } if (quote.LastTrade != lastTrade) { quote.LastTrade = lastTrade; changed = true; } if (changed) { QuoteChanged(quote); } }
private List <PendingOrder> GetFireingPendgingOrders(string symbol, QuoteData quote) { var execList = new List <PendingOrder>(); for (var i = 0; i < orders.Count; i++) { var order = orders[i]; // ордер устарел? if (order.TimeTo.HasValue && quote.time > order.TimeTo.Value) { orders.RemoveAt(i); i--; continue; } if (order.Symbol != symbol) { continue; } // время еще не подошло? if (order.TimeFrom.HasValue && order.TimeFrom.Value > quote.time) { continue; } // цена должна пробить заявку снизу-вверх (1) или сверху вниз (-1) var priceDirection = (order.Side == 1 && order.PriceSide == PendingOrderType.Stop) || (order.Side == -1 && order.PriceSide == PendingOrderType.Limit) ? 1 : -1; var checkedPrice = order.Side > 0 ? quote.ask : quote.bid; var priceOk = priceDirection > 0 ? (checkedPrice >= order.PriceFrom && (!order.PriceTo.HasValue || order.PriceTo.Value <= order.PriceTo)) : (checkedPrice <= order.PriceFrom && (!order.PriceTo.HasValue || order.PriceTo.Value >= order.PriceTo)); if (!priceOk) { continue; } // цена должна перешагнуть рубеж if (!order.TimeFrom.HasValue) { var prevQuote = previousQuotes.ReceiveValue(symbol); if (prevQuote == null) { continue; } checkedPrice = order.Side > 0 ? prevQuote.ask : prevQuote.bid; priceOk = priceDirection > 0 ? checkedPrice <order.PriceFrom : checkedPrice> order.PriceFrom; } if (priceOk) { execList.Add(order); } } return(execList); }
/* * function GetClassByDensity(totDensity) { * var classDensityBased = "-1"; * * if (totDensity < 1) * classDensityBased = "400"; * else if (totDensity >= 1 && totDensity < 2) * classDensityBased = "300"; * else if (totDensity >= 2 && totDensity < 4) * classDensityBased = "250"; * else if (totDensity >= 4 && totDensity < 6) * classDensityBased = "175"; * else if (totDensity >= 6 && totDensity < 8) * classDensityBased = "125"; * else if (totDensity >= 8 && totDensity < 10) * classDensityBased = "100"; * else if (totDensity >= 10 && totDensity < 12) * classDensityBased = "92.5"; * else if (totDensity >= 12 && totDensity < 15) * classDensityBased = "85"; * else if (totDensity >= 15 && totDensity < 22.5) * classDensityBased = "70"; * else if (totDensity >= 22.5 && totDensity < 30) * classDensityBased = "65"; * else //greater than 30 * classDensityBased = "60"; * * return classDensityBased; * } */ public static void Get_class_by_density(ref QuoteData quoteData) { #region Get quoteData.calculated_freight_class by density if (quoteData.totalDensity <= 0) { HelperFuncs.writeToSiteErrors("quoteData.calculated_freight_class", "Density was less than zero"); quoteData.calculated_freight_class = -1; } else if (quoteData.totalDensity > 0 && quoteData.totalDensity < 1) { quoteData.calculated_freight_class = 400; } else if (quoteData.totalDensity >= 1 && quoteData.totalDensity < 2) { quoteData.calculated_freight_class = 300; } else if (quoteData.totalDensity >= 2 && quoteData.totalDensity < 4) { quoteData.calculated_freight_class = 250; } else if (quoteData.totalDensity >= 4 && quoteData.totalDensity < 6) { quoteData.calculated_freight_class = 175; } else if (quoteData.totalDensity >= 6 && quoteData.totalDensity < 8) { quoteData.calculated_freight_class = 125; } else if (quoteData.totalDensity >= 8 && quoteData.totalDensity < 10) { quoteData.calculated_freight_class = 100; } else if (quoteData.totalDensity >= 10 && quoteData.totalDensity < 12) { quoteData.calculated_freight_class = 92.5; } else if (quoteData.totalDensity >= 12 && quoteData.totalDensity < 15) { quoteData.calculated_freight_class = 85; } else if (quoteData.totalDensity >= 15 && quoteData.totalDensity < 22.5) { quoteData.calculated_freight_class = 70; } else if (quoteData.totalDensity >= 22.5 && quoteData.totalDensity < 30) { quoteData.calculated_freight_class = 65; } else { quoteData.calculated_freight_class = 60; } #endregion }
//public ActionResult<string> Get(int id) public ActionResult <QuoteData> Get(int id) { var data = new QuoteData(); data.getQuoteByID = Provider.getQuoteByID(id); data.showQuotes = Provider.showQuotes(); data.getRandomQuote = Provider.getRandomQuote(); //return "value"; return(data); }
public CandleDataBidAsk UpdateCandle(QuoteData q) { var candleBid = packerBid.UpdateCandle(q.bid, q.time) ?? packerBid.CurrentCandle; var candleAsk = packerAsk.UpdateCandle(q.ask, q.time) ?? packerAsk.CurrentCandle; return(new CandleDataBidAsk(candleBid, candleAsk) { timeClose = q.time }); }
private void BrodcastQuote(QuoteData quote) { lock (_subscribers) { foreach (var subscriber in _subscribers) { subscriber.OnPriceUpdate(quote); } } }
private static void UpdateCellSafe(QuoteTradeControl cell, QuoteData quote) { try { cell.BeginInvoke(new UpdateCellDel(UpdateCellUnsafe), cell, quote); } catch (Exception ex) { Logger.Error("QuoteTableControl.UpdateSellSafe: " + ex.Message); } }
public QuoteData GetData() { var data = new QuoteData { TimeStart = TimeStart, TimeEnd = TimeEnd, Line = Line }; return(data); }
protected virtual void onQuoteData(QuoteData data) { // 当报价数据到来的时候,更新价格 foreach (var share in this.Desc.Holders) { if (share.Symbol == data.Symbol) { share.LastPrice = data.CurrentPrice; } } }
public IActionResult OnGet(long quoteID) { Quote = QuoteData.GetById(quoteID); if (Quote == null) { return(RedirectToPage("./NotFound")); } return(Page()); }
public ActionResult EMailQuote() { Calculations calc = new Calculations(); QuoteData quoteData = new QuoteData { StepFilingInformation = new Models.StepFilingInformation { PaymentPlanRadioButton = Models.StepFilingInformation.PaymentPlan.Yes, } }; var total = calc.CalculatePrice(quoteData); }
public ConsumerWebBusinessLogic(QuoteHeader qHeader, QuoteData qData) : this(qHeader) { this.qData = qData; }
public AjaxResponse ReCalculate(QuoteHeader qHeader, QuoteData qData) { this.QHeader = qHeader; this.QData = qData; // This is to fix an issue where walmart validates email and user changes it. if (this.QHeader.PartnerId.Equals(2319)) { QuoteServices quoteServices = new QuoteServices(); if (!quoteServices.ValidateEmailVerificationCode(this.QHeader.QuoteNumber, QData.cvgPartnerDiscount)) { if (QData.cvgPartnerDiscount != null) { this.QHeader.OLSStatus = OlsStatusPaperlessStoredId; this.QData.cvgPartnerDiscount = String.Empty; } else { this.QHeader.OLSStatus = OlsStatusPaperlessStoredIdNegative; } } } switch (QHeader.FormCode) { case 3: if (QData.cvgDeductible != null) { UpdateWindHailOrHurricaneValues(QData.cvgDeductible); } break; case 4: if (QData.propertyCoverageDeductible != null) { UpdateWindHailOrHurricaneValues(QData.propertyCoverageDeductible); } break; } this.DataBinder.BindCoverageData(); this.BusinessLogic().Quote.ApexBillingOption = this.QHeader.ApexBillingOption; this.BusinessLogic().Quote.Save(); // do rating this.ServiceInterface.CallRatingService(); //call logging ITR#5549 LogRateChangeEvent(2); DoCompleteQuoteSave(); // return response AjaxResponse response = new AjaxResponse(); //ITR#8181 Apex if (qHeader.IsApexState) { response.WindoidContentList = QuoteServices.GetQuoteSummary(this.BusinessLogic().Header, this.BusinessLogic().Quote, this.BusinessLogic().Coverage); response.WindoidContent = QuoteServices.GetQuoteSummaryFromList(response.WindoidContentList, quote.ApexBillingOption); } else { response.WindoidContent = QuoteServices.GetQuoteSummary(this.BusinessLogic().Header, this.BusinessLogic().Quote, this.BusinessLogic().Coverage, this.BusinessLogic().Structure.PropertyType, this.BusinessLogic().QHeader.H04Ui_V2); } response.quoteHeader = this.BusinessLogic().QHeader; response.NextPanel = AjaxPanel.Coverage; return response; }
public static Context.IBusinessLogic Get(QuoteHeader qHeader, QuoteData qData) { return GetBusinessLogic(qHeader, qData); }
/* private static Context.IBusinessLogic GetLegacyBusinessLogic(QuoteHeader qHeader, QuoteData qData) { return new LegacyConsumerBusinessLogic<ProgressiveBusinessLogic>(qData, qHeader); } */ private static Context.IBusinessLogic GetBusinessLogic(QuoteHeader qHeader, QuoteData qData) { TimerCache.StaticCollection.SaveSessionDateTime(qHeader.SessionId); return BusinessLogicCache.StaticCollection.GetSessionBusinessLogic(qHeader, qData); }
public QuoteDataEnumerator(QuoteSeries series, QuoteData input) : base(series.Count) { this.series = series; this.input = input; }
public bool MoveToTime(DateTime time, out QuoteData quote) { quote = null; if (reader == null) return false; // читать котировки из файла до даты "time" while (true) { var nextQuote = ReadNextQuoteFromStream(); if (nextQuote == null) {// дошли до конца файла reader = null; return false; } if (nextQuote.time < time) continue; quote = nextQuote; buffer.Add(quote); bufferPosition = 0; // зачитать N строк в буфер FillBuffer(); return true; } }
private string MakeInsertQuoteCmd(int ticker, QuoteData q) { return string.Format("insert into QUOTE (trd_currency, date, bid, ask, volume, maker) values " + "('{0}', '{1:yyyyMMdd HH:mm:ss}', '{2:f4}', '{3:f4}', '0', '{4}')", ticker, q.time, q.bid, q.ask, quoteMakerCode); }
public BarSeries CompressBars(QuoteData input, BarType barType, long barSize) { return DataManager.CompressBars(this, input, barType, barSize); }
public static BarSeries CompressBars(QuoteSeries quotes, QuoteData input, BarType barType, long barSize) { if (barType == BarType.Range && input == QuoteData.BidAsk) { throw new ArgumentException(string.Format("Cannot make range bars from {0}", input)); } return DataManager.CompressBars(new QuoteDataEnumerator(quotes, input), barType, 1L, barSize); }
private void DisplayQuote(string target, QuoteData quote, string header) { IList<string> display; //multiline if (_multilineOut) display = SplitQuote(quote.Quote); else display = new List<string> { quote.Quote }; _irc.SendMessage(SendType.Message, target, String.Format(header ?? "Quote 04{0}: {1}", quote.Id, display[0])); for (int i = 1; i < display.Count; i++) _irc.SendMessage(SendType.Message, target, display[i]); }
private void AddQuote(IrcMessageData data) { if ((data.MessageArray.Length < 2) || (String.IsNullOrEmpty(data.MessageArray[1])) || (String.IsNullOrEmpty(data.MessageArray[1].Trim()))) return; int index = (_quotes.OrderBy(x => x.Id).LastOrDefault() ?? new QuoteData()).Id + 1; QuoteData qd = new QuoteData(); qd.Date = DateTime.Now; qd.Id = index; qd.Channel = data.Channel; qd.Submitter = data.Nick; qd.Quote = data.Message.Substring(5); _quotes.Add(qd); _store.Flush(_quotes); _irc.SendMessage(SendType.Message, data.Channel, String.Format("Quote 04{0} added.", index)); }