public EZFill(DateTime fillTime, EZInstrument instrument, zBuySell buySell, ezQuantity quantity, ezPrice price, zFillType fillType) { TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(fillTime, cst); DateTime time = localTime; string timeStr = time.ToString("H:mm:ss.fff"); string shortTimeStr = time.ToString("hh:mm:ss tt"); Time = timeStr; ShortTime = shortTimeStr; Identifiers = ""; // GetFillIdenifiers(fill); Instrument = instrument; BuySell = buySell; InstrumentName = ""; // ParseInstrumentKey(fill.InstrumentKey.ToString()); Quantity = quantity; Price = price; FFT2 = ""; // fill.FFT2; FFT3 = ""; // fill.FFT3; FillType = fillType; //_fill = fill; Originator = FillOriginator.TRADER; Action = FillAction.ADD; ReplacementForFill = null; }
public EZOrder(ezInstrumentKey instrumentKey, zBuySell buySell, ezQuantity quantity, ezPrice price) { InstrumentKey = instrumentKey; BuySell = buySell; _quantity = quantity; _price = price; Status = EZOrderStatus.None; }
void api_OnInsideMarketUpdate(EZInstrument instrument) { if (instrument == null || currentInstrument == null || instrument.Key != currentInstrument.Key) { return; } /*if (selectedMarketData.Equals("Bid Price")) * UpdateDataValue(instrument.Bid.ToString()); * else if (selectedMarketData.Equals("Bid Quantity")) * UpdateDataValue(instrument.BidQty.ToString()); * else if (selectedMarketData.Equals("Offer Price")) * UpdateDataValue(instrument.Ask.ToString()); * else if (selectedMarketData.Equals("Offer Quantity")) * UpdateDataValue(instrument.AskQty.ToString());*/ ezPrice price = instrument.Last; ezQuantity qty = instrument.LastQty; // Check if the price has moved. if (price != lastPrint) { Spy.Print("{0} : {1}", price, lastPrint); //StoreLastPrice(price); lastPrint = price; timeFrames.StoreTradeVolume(qty); UpdateDataValue(timeFrames.VolumeInTimePeriod(TimeSpan.FromMinutes(5))); lastPrintTotalVolume = instrument.LastTotalVolume; } else // last price is the same - check to see if another trade occurred at the same price { if (instrument.LastTotalVolume > lastPrintTotalVolume) { timeFrames.StoreTradeVolume(qty); UpdateDataValue(timeFrames.VolumeInTimePeriod(TimeSpan.FromMinutes(5))); lastPrintTotalVolume = instrument.LastTotalVolume; } } //UpdateDataValue(instrument.LastQty.ToString()); /*this.Invoke((MethodInvoker)delegate * { * lblBid1.Text = instrument.Bid.ToString(); * lblBidVol1.Text = instrument.BidQty.ToString(); * lblOffer1.Text = instrument.Ask.ToString(); * lblOfferVol1.Text = instrument.AskQty.ToString(); * lblLast1.Text = instrument.Last.ToString(); * lblLastVol1.Text = instrument.LastQty.ToString(); * lblTotalVol1.Text = instrument.Volume.ToString(); * lblNet1.Text = instrument.NetPos.ToString(); * lblBuys1.Text = instrument.NetBuys.ToString(); * lblSells1.Text = instrument.NetSells.ToString(); * });*/ }
/// <summary> /// Construct a TTOrder object from a TTAPI Order object /// </summary> /// <param name="order">TTAPI Order object</param> public EZOrder(ezOrder order) { _order = order; InstrumentKey = order.InstrumentKey; BuySell = order.BuySell; _quantity = order.OrderQuantity; _price = order.LimitPrice; Status = EZOrderStatus.None; }
/// <summary> /// Set the market depth at a specified level by specifying bid/ask price/quantity /// </summary> /// <param name="level">market depth level to change</param> /// <param name="bid">bid price</param> /// <param name="bidQty">bid quantity</param> /// <param name="ask">ask price</param> /// <param name="askQty">ask quantity</param> public void SetDepth(int level, ezPrice bid, ezQuantity bidQty, ezPrice ask, ezQuantity askQty) { if (_marketDepth[level] == null) { _marketDepth[level] = new EZMarketDepthLevel(); } _marketDepth[level].Bid = bid; _marketDepth[level].BidQty = bidQty; _marketDepth[level].Ask = ask; _marketDepth[level].AskQty = askQty; }
public void Sell(EZInstrument instrument, int quantity, string strategyName) { if (strategyName != null) { executionStatus[strategyName] = new ExecutionStatus(strategyName); } ezPrice bid = instrument.Bid; EZOrder ezo = api.SellLimit(instrument, quantity, bid, strategyName); StoreOrder(strategyName, ezo); Spy.Print("SELL: {0} @ {1}", quantity, bid); }
public void Buy(EZInstrument instrument, int quantity, string strategyName) { if (strategyName != null) { executionStatus[strategyName] = new ExecutionStatus(strategyName); executionStatus[strategyName].quantitySubmitted = quantity; } ezPrice ask = instrument.Ask; EZOrder ezo = api.BuyLimit(instrument, quantity, ask, strategyName); StoreOrder(strategyName, ezo); Spy.Print("BUY: {0} @ {1}", quantity, ask); }
public DataProviderMomentum() : base() { // For the momentum indicator, we will start off assuming we are in the // "collecting data" state (which will change to "READY" when the DataProvider // has enough data that it can begin returning calculations. //dataProviderState = DataProviderState.COLLECTING_DATA; // Start off with ZERO momentum. As the indicator changes, POSITIVE values means market moving UP with // momentum. NEGATIVE values means market moving DOWN with momentum. momentum = 0.0; uiControl = null; uiModifyControl = null; DataUpdate += DataProviderMarketData_DataUpdate; lastPrint = null; lastPrintQty = null; lastPrintTotalVolume = 0; timeFrames = new VolumeTimeFrames(); api = APIMain.Instance; }