public ExecuteOrderSummaryItem(InstrumentClient instrument) { this._ChildSummaryItems = new ObservableCollection<ExecuteOrderSummaryItem>(); this._Id = instrument.Id.ToString(); this._ExecuteOrderSummaryType = ExecuteOrderSummaryType.Instrument; this._Instrument = instrument; }
public OrderTaskModel() { this._OrderTasks = new ObservableCollection<OrderTask>(); this._Instrument = new InstrumentClient(); this._TopToolBarImages = new TopToolBarImages(); this.CreateCellDataDefine(); }
public DQOrderTaskForInstrument() { this._Instrument = new InstrumentClient(); this._OrderTasks = new ObservableCollection<OrderTask>(); this.BuySellList = new ObservableCollection<string>() { "All","Buy","Sell"}; this.OpenCloseList = new ObservableCollection<string> { "All", "Open", "Close" }; this.CreateCellDataDefine(); }
public SettingsChangedEventArgs(Account[] changedAccounts, Account[] removedAccounts, InstrumentClient[] addedInstruments, InstrumentClient[] removedInstruments, InstrumentClient[] changedInstruments) { this.ChangedAccounts = changedAccounts; this.RemovedAccounts = removedAccounts; this.AddedInstruments = addedInstruments; this.RemovedInstruments = removedInstruments; this.ChangedInstruments = changedInstruments; }
public MooMocOrderForInstrument(InstrumentClient instrument) { this._Instrument = instrument; this._Ask = instrument.Ask; this._Bid = instrument.Bid; this._Origin = instrument.Origin; this._OrderTasks = new ObservableCollection<OrderTask>(); this.BuySellList = new ObservableCollection<string>() { "All","Buy","Sell"}; this.OpenCloseList = new ObservableCollection<string> { "All", "Open", "Close" }; }
public ExecuteOrderSummaryItem(InstrumentClient instrument, OrderRange orderRange) { this._ChildSummaryItems = new ObservableCollection<ExecuteOrderSummaryItem>(); this._Code = orderRange.BeginRange + "~" + orderRange.EndRange; this._Id = instrument.Id + "_" + this._Code; this._ExecuteOrderSummaryType = ExecuteOrderSummaryType.Range; this._MinNumeratorUnit = instrument.NumeratorUnit; this._MaxDenominator = instrument.Denominator; this._Instrument = instrument; this._OrderRange = orderRange; }
public static Dictionary<Guid, InstrumentClient> GetInitializeTestDataForInstrument() { Dictionary<Guid, InstrumentClient> instruments = new Dictionary<Guid,InstrumentClient>(); for (int i = 0; i < 10; i++) { InstrumentClient instrument = new InstrumentClient(); string guidStr = "66adc06c-c5fe-4428-867f-be97650eb3b" + i; instrument.Id = new Guid(guidStr); instrument.Code = "GBPUSA" + i; instrument.ExchangeCode = "WF01"; instrument.Ask = "121.32"; instrument.Bid = "121.30"; if (i == 1) { instrument.Denominator = 10; } else { instrument.Denominator = 100; } instrument.NumeratorUnit = 1; instrument.MaxSpread = 100; instrument.MaxAutoPoint = 100; instrument.AcceptDQVariation = 10; instrument.Spread = 2; instrument.AutoPoint = 10; instrument.Origin = "121.30"; if (i == 3 || i == 2) { instrument.IsNormal = false; } else { instrument.IsNormal = true; } if (i < 3) { instrument.SummaryGroupId = new Guid(); instrument.SummaryGroupCode = "AAA"; } else if(i == 4) { instrument.SummaryGroupId = new Guid(); instrument.SummaryGroupCode = "BBB"; } instruments.Add(instrument.Id, instrument); } return instruments; }
public QuotePriceClient(QuoteMessage quoteMessage, int waitTimes, InstrumentClient instrument, Customer customer, ExchangeQuotation quotation) { this._ExchangeQuotation = quotation; this._Origin = quotation.Origin; this._CustomerClient = customer; this._Instrument = instrument; this._ExchangeCode = quoteMessage.ExchangeCode; this._CustomerId = quoteMessage.CustomerID; this._InstrumentId = quoteMessage.InstrumentID; this._Lot = (decimal)quoteMessage.QuoteLot; this._AnswerLot = this._Lot; this._BSStatus = (BSStatus)quoteMessage.BSStatus; this._BuyLot = this._BSStatus == BSStatus.Buy ? this._Lot : decimal.Zero; this._SellLot = this._BSStatus == BSStatus.Sell ? this._Lot : decimal.Zero; if (this._BSStatus == BSStatus.Both) { this._BuyLot = this._Lot; this._SellLot = this._Lot; } this._WaitTimes = waitTimes; this._TimeStamp = quoteMessage.TimeStamp; }
internal void FirstQuoteUpdate(QuotePriceClient quotePriceClient) { this._QuoteId = quotePriceClient.Id; this._Instrument = quotePriceClient.Instrument; this._InstrumentCode = this._Instrument.Code; this._Origin = quotePriceClient.ExchangeQuotation.Origin; this._Ask = quotePriceClient.ExchangeQuotation.Ask; this._Bid = quotePriceClient.ExchangeQuotation.Bid; this._SumBuyLot = quotePriceClient.BuyLot; this._SumSellLot = quotePriceClient.SellLot; this._Lot = quotePriceClient.Lot; this._AnswerLot = this._Lot; this._AdjustLot = this._Lot; this._BSStatus = quotePriceClient.BSStatus; this._AdjustPoint = (decimal)this.Instrument.NumeratorUnit / (decimal)this.Instrument.Denominator; this.CreateBestPrice(true); this.SettingBackGround(); }
public static bool? IsValidPrice(InstrumentClient instrument, string origin, decimal adjust) { Price lastOriginPrice = Price.CreateInstance(origin, instrument.NumeratorUnit, instrument.Denominator); string validInt = "^-?\\d+$"; Price originPrice; if (Regex.IsMatch(adjust.ToString(), validInt)) { originPrice = lastOriginPrice + (int)adjust; } else { originPrice = Price.CreateInstance((double)adjust, instrument.NumeratorUnit, instrument.Denominator); } if (originPrice != null) { if (lastOriginPrice != null) { return (Math.Abs(lastOriginPrice - originPrice) > instrument.AlertPoint); } else { return false; } } else { return null; } }
public Transaction(CommonOrder commonOrder, Account account, InstrumentClient instrument) { this.Account = account; this.Instrument = instrument; this.Initialize(commonOrder); }
public Transaction(CommonTransaction tran,Account account,InstrumentClient instrument) { this.Account = account; this.Instrument = instrument; this.Update(tran); }
private void SubtractBuySellLot(InstrumentClient instrument, QuotePolicyDetail quotePolicyDetail, bool isBuy, decimal lotBalance) { instrument.BuyLot -= isBuy ? lotBalance : 0; instrument.SellLot -= !isBuy ? lotBalance : 0; if (quotePolicyDetail != null) { quotePolicyDetail.BuyLot -= isBuy ? lotBalance : 0; quotePolicyDetail.SellLot -= !isBuy ? lotBalance : 0; } }
public InstantOrderForInstrument() { this._Instrument = new InstrumentClient(); }
public int CheckDQVariation(InstrumentClient instrument,int adjustDQVariation) { if (instrument.CheckVariation(adjustDQVariation)) { return adjustDQVariation; } else { return (0 - instrument.AcceptDQVariation); } }
public static bool IsProblePrice(InstrumentClient instrument,string marketPrice,string executedPrice) { Price setExecutedPrice = new Price(executedPrice, instrument.NumeratorUnit, instrument.Denominator); Price currentPrice = new Price(marketPrice, instrument.NumeratorUnit, instrument.Denominator); return (Math.Abs(currentPrice - setExecutedPrice) > instrument.AlertVariation); }
private InstrumentClient GetInstrument(QuotePriceClient quotePriceClient) { //Property not empty InstrumentClient instrument = new InstrumentClient(); instrument.Id = quotePriceClient.InstrumentId; instrument.Code = "GBP" + GetCode(); instrument.Origin = "1.1"; instrument.Ask = "1.5"; instrument.Bid = "1.2"; instrument.Denominator = 10; instrument.NumeratorUnit = 1; instrument.MaxAutoPoint = 100; instrument.MaxSpread = 100; //instrument.AlertPoint = 10; instrument.AutoPoint = 1; instrument.Spread = 3; return instrument; }
private OrderRange GetPriceRange(string executePrice, int interval, InstrumentClient instrument) { Price rangeValue = new Price(executePrice, (int)instrument.NumeratorUnit, (int)instrument.Denominator); Price beginPrice = rangeValue; Price EndPrice = rangeValue + interval; OrderRange orderRange = new OrderRange(RangeType.Price, interval, beginPrice.ToString(), EndPrice.ToString()); return orderRange; }
private void FilterOrderByInstrument(InstrumentClient instrument) { if (instrument.Id == Guid.Empty) //All { this._OrderTaskGrid.ItemsSource = this._ProcessLmtOrder.OrderTasks; return; } this._OrderTaskGrid.ItemsSource = this._ProcessLmtOrder.OrderTasks.Where(P => P.InstrumentId == instrument.Id); this._ProcessLmtOrder.InitializeBinding(instrument.Id); this.LayRootGrid.DataContext = this._ProcessLmtOrder.LmtOrderForInstrument; }
private ExecuteOrderSummaryItem AddInstrumentSummaryItem(InstrumentClient instrument) { ExecuteOrderSummaryItem summaryItem = this.ExecuteOrderSummaryItems.SingleOrDefault(P => P.Instrument == instrument); if (summaryItem == null) { summaryItem = new ExecuteOrderSummaryItem(instrument); this.ExecuteOrderSummaryItems.Add(summaryItem); } return summaryItem; }
internal void Update(Order order) { InstrumentClient instrument = order.Transaction.Instrument; this._ExecuteOrderSummaryType = ExecuteOrderSummaryType.Order; this._MinNumeratorUnit = instrument.NumeratorUnit; this._MaxDenominator = instrument.Denominator; this._Instrument = instrument; bool isBuy = order.BuySell == BuySell.Buy; decimal buyLot = isBuy ? order.Lot:0; decimal sellLot = !isBuy ? order.Lot:0; this._Id = order.Id.ToString(); this._Code = order.Transaction.ExecuteTime.Value.ToString(); this._BuyLot = buyLot; this._SellLot = sellLot; this._BuyAvgPrice = isBuy ? order.ExecutePrice : "0"; this._SellAvgPrice = !isBuy ? order.ExecutePrice : "0"; this.AccountCode = order.Transaction.Account.Code; }
public LMTProcessForInstrument() { this._OrderTasks = new ObservableCollection<OrderTask>(); this._Instrument = new InstrumentClient(); }
internal void Update(Order order) { this._ExchangeCode = order.ExchangeCode; this._OrderId = order.Id; this._Code = order.Code; this._Phase = order.Phase; this._OrderStatus = order.Status; this._IsBuy = order.BuySell; this._IsOPen = order.OpenClose; this._Lot = order.Lot; this._ContractSize = order.Transaction.ContractSize; this._OrderType = order.Transaction.OrderType; this._OrderTypeString = order.Type; this._SetPrice = order.SetPrice; this._SubmitDateTime = order.Transaction.SubmitTime; this._ExpireTime = order.Transaction.SubmitTime; this._Account = order.Transaction.Account; this._Transaction = order.Transaction; this._Instrument = order.Transaction.Instrument; this._HitCount = order.HitCount; this._BestPrice = order.BestPrice; this._BestTime = order.BestTime; this.ChangeStatus(this._OrderStatus); }
private void GetComboListData() { InstrumentClient allInstrument = new InstrumentClient(); allInstrument.Code = "All"; foreach (string exchangeCode in this._App.ExchangeDataManager.ExchangeCodes) { ExchangeSettingManager settingManager = this._App.ExchangeDataManager.GetExchangeSetting(exchangeCode); foreach (InstrumentClient instrument in settingManager.Instruments.Values) { this._InstrumentList.Add(instrument); } } this._InstrumentList.Insert(0, allInstrument); this._InstrumentCombo.ItemsSource = this._InstrumentList; this._InstrumentCombo.DisplayMemberPath = "Code"; this._InstrumentCombo.SelectedIndex = 0; this._InstrumentCombo.SelectedValuePath = "Id"; this._InstrumentCombo.SelectedItem = allInstrument; AccountGroup allGroup = new AccountGroup(); allGroup.Code = "All"; foreach (string exchangeCode in this._App.ExchangeDataManager.ExchangeCodes) { ExchangeSettingManager settingManager = this._App.ExchangeDataManager.GetExchangeSetting(exchangeCode); foreach (AccountGroup group in settingManager.GetAccountGroups()) { this._AccountGroups.Add(group); } } this._AccountGroups.Insert(0, allGroup); this._AccountGroupCombo.ItemsSource = this._AccountGroups; this._AccountGroupCombo.DisplayMemberPath = "Code"; this._AccountGroupCombo.SelectedIndex = 0; this._AccountGroupCombo.SelectedValuePath = "Id"; this._AccountGroupCombo.SelectedItem = allGroup; this.ExchangeComboBox.ItemsSource = this._App.ExchangeDataManager.ExchangeCodes; this.ExchangeComboBox.SelectedItem = this._App.ExchangeDataManager.ExchangeCodes[0]; }
private void GetComboBoxData() { InstrumentClient allInstrument = new InstrumentClient(); allInstrument.Code = "All"; foreach (string exchangeCode in this._App.ExchangeDataManager.ExchangeCodes) { ExchangeSettingManager settingManager = this._App.ExchangeDataManager.GetExchangeSetting(exchangeCode); foreach (InstrumentClient instrument in settingManager.Instruments.Values) { this._InstrumentList.Add(instrument); } } this._InstrumentList.Insert(0, allInstrument); this._InstrumentCombo.ItemsSource = this._InstrumentList; this._InstrumentCombo.DisplayMemberPath = "Code"; this._InstrumentCombo.SelectedIndex = 0; this._InstrumentCombo.SelectedValuePath = "Id"; this._InstrumentCombo.SelectedItem = allInstrument; }
private void LoadComboListData(string exchangeCode) { this._InstrumentList.Clear(); this._AccountGroups.Clear(); ExchangeSettingManager settingManager = this._App.ExchangeDataManager.GetExchangeSetting(exchangeCode); foreach (InstrumentClient instrument in settingManager.GetInstruments()) { this._InstrumentList.Add(instrument); } foreach (AccountGroup group in settingManager.GetAccountGroups()) { this._AccountGroups.Add(group); } InstrumentClient allInstrument = new InstrumentClient() { Code = "All" }; AccountGroup allAccountGroup = new AccountGroup(){Code = "All"}; this._InstrumentList.Insert(0, allInstrument); this._AccountGroups.Insert(0, allAccountGroup); this._InstrumentCombo.ItemsSource = this._InstrumentList; this._InstrumentCombo.DisplayMemberPath = "Code"; this._InstrumentCombo.SelectedValuePath = "Id"; this._InstrumentCombo.SelectedItem = allInstrument; this._AccountGroupCombo.ItemsSource = this._AccountGroups; this._AccountGroupCombo.DisplayMemberPath = "Code"; this._AccountGroupCombo.SelectedValuePath = "Id"; this._AccountGroupCombo.SelectedItem = allAccountGroup; }
public static bool IsLimitedPriceByDailyMaxMove(string newPrice,InstrumentClient instrument) { bool isLimited = false; if (!string.IsNullOrEmpty(newPrice) && instrument.DailyMaxMove != 0) { Price adjustPrice = new Price(newPrice, instrument.NumeratorUnit, instrument.Denominator); Price previousClosePrice = new Price(instrument.PreviousClosePrice, instrument.NumeratorUnit, instrument.Denominator); if((adjustPrice > (previousClosePrice + instrument.DailyMaxMove)) || (adjustPrice < (previousClosePrice - instrument.DailyMaxMove))) { isLimited = true; } } return isLimited; }