public void ShowNormalInstrumentState(InstrumentMode eWhichInstrument) { InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument]; if (instrument != null) { instrument.renderer.sprite = instrument.normalSprite; instrument.holder.transform.localPosition = instrument.normalPosition; instrument.holder.transform.localRotation = Quaternion.Euler(instrument.normalRotation); instrument.holder.transform.localScale = instrument.normalScale; if (m_agoTambourineCymbals[(int)eWhichInstrument] != null) { m_agoTambourineCymbals[(int)eWhichInstrument].SetActive(true); foreach (Transform cymbal in m_agoTambourineCymbals[(int)eWhichInstrument].transform) { cymbal.GetComponent <Button_TambourineCymbal>().enabled = true; } } if (m_arTambourineTargets[(int)eWhichInstrument] != null && m_arTambourineTargets[(int)eWhichInstrument].Visible) { m_arTambourineTargets[(int)eWhichInstrument].HideShakenTambourineTargets(); } } }
public static List <Candle> HA_D_Candles(Instrument instrument, out InstrumentDetails instrumentDetails) { instrumentDetails = new InstrumentDetails(); Candle haPreviounsCandle = null; Candle haCurrentCandle = null; List <Candle> haCandles = new List <Candle>(); int emaPeriod = 21; List <Candle> candles = OANDA.Data.Prices.GetCandles(instrument.Name, emaPeriod, "D"); instrumentDetails.Current = candles.LastOrDefault().Close; EMA ema = new EMA(emaPeriod); List <MyTrade.Core.Model.Candle> wcandles = MyTrade.Core.SqliteDataAccess.WeekyCandles.LoadCandles(instrument.Name); PivotPoints pps = new PivotPoints(); PivotPoint wpps = pps.Get(wcandles[wcandles.Count - 2], instrumentDetails.Current); instrumentDetails.W_PivotPoints = wpps; List <MyTrade.Core.Model.Candle> mcandles = MyTrade.Core.SqliteDataAccess.MonthlyCandles.LoadCandles(instrument.Name); PivotPoint mpps = pps.Get(mcandles[mcandles.Count - 2], instrumentDetails.Current); instrumentDetails.M_PivotPoints = mpps; instrumentDetails.TimeFrame = Core.Constants.TimeFrame.DAILY; for (int i = 0; i < candles.Count; i++) { instrumentDetails.Max = Math.Max(instrumentDetails.Max, candles[i].High); if (i == 0) { instrumentDetails.Min = candles[i].Low; instrumentDetails.Min = Math.Min(candles[i].Low, instrumentDetails.Min); haPreviounsCandle = HeikinAshi.GeneratePrevious(candles[i]); haCandles.Add(haPreviounsCandle); } else { haCurrentCandle = HeikinAshi.Generate(haPreviounsCandle, candles[i]); haCandles.Add(haCurrentCandle); haPreviounsCandle = haCurrentCandle; } if (i == (candles.Count - 1)) { instrumentDetails.EMAs = new List <Core.Model.Indicators.EMA>(); ema.AddDataPoint(candles[i].Close); instrumentDetails.EMAs.Add(new Core.Model.Indicators.EMA() { Period = 21, Value = ema.Average }); } else { ema.AddDataPoint(candles[i].Close); } } return(haCandles); }
// // // public bool TryGetInstrumentDetails(InstrumentName instrumentName, out InstrumentDetails details) { double tickSize = this.TickValue / this.UnitValue; double calTickSize = this.CalendarTickValue / this.UnitValue; details = new InstrumentDetails(instrumentName, this.Currency, tickSize, calTickSize, this.UnitValue, this.LastTradeDate, this.Type); return(true); }//TryGetInstrumentDetails()
// // /// <summary> /// Called by external thread to request that the hub thread create a /// query to check to make sure out database has the /// instrument details supplied /// correctly in the database. /// </summary> /// <param name="instrDetails"></param> public void RequestCheckInstrDBDetails(InstrumentDetails instrDetails) { QueryBuilderHubRequest e = new QueryBuilderHubRequest(); e.Request = QueryBuilderHubRequestCode.RequestCheckDBInstrDetails; e.Data.Add(instrDetails); this.HubEventEnqueue(e); }
// protected void OnInstrumentsFound(InstrumentDetails instrDetails) { if (this.InstrumentFound != null) { UV.Lib.Products.InstrumentsFoundEventArgs e = new UV.Lib.Products.InstrumentsFoundEventArgs(); e.InstrumentDetails = instrDetails; this.InstrumentFound(this, e); } }
private OrderBook m_DefaultBook; // default order book for uknown orders not owned by a strat(yet) #endregion // members #region Constructors // ***************************************************************** // **** Constructors **** // ***************************************************************** /// <summary> /// Main constructor for Order Instrument. An RecycleFactory<Order> must /// be passed in for the deafult order book to be constructed /// </summary> /// <param name="instrumentName"></param> /// <param name="details"></param> /// <param name="orderRecycleFactory"></param> public OrderInstrument(InstrumentName instrumentName, InstrumentDetails details, RecycleFactory <Order> orderRecycleFactory) { this.Instrument = instrumentName; this.Details = details; m_OrderIDToBookMap = new ConcurrentDictionary <int, int>(); m_DefaultBook = new OrderBook(instrumentName, orderRecycleFactory); // create our default book m_OrderBooks.Add(m_DefaultBook.BookID, m_DefaultBook); // add it to our look up tables m_DefaultBook.IsReady = true; }
private OrderBook m_DefaultBook; // default order book for uknown orders not owned by a strat(yet) #endregion // members #region Constructors // ***************************************************************** // **** Constructors **** // ***************************************************************** /// <summary> /// Main constructor for Order Instrument. /// </summary> /// <param name="instrumentName"></param> /// <param name="details"></param> public OrderInstrument(InstrumentName instrumentName, InstrumentDetails details) { this.Instrument = instrumentName; this.Details = details; m_OrderIDToBookMap = new Dictionary <int, int>(); m_DefaultBook = new OrderBook(instrumentName, string.Empty); // create our default book m_OrderBooks.Add(m_DefaultBook.BookID, m_DefaultBook); // add it to our look up tables m_DefaultBook.IsReady = true; }
// // #endregion//Properties #region Public Methods // ***************************************************************** // **** Public Methods **** // ***************************************************************** // // ********************************************************* // **** TrySetInstrumentDetails() **** // ********************************************************* // /// <summary> /// Called to set the instrument details for the first time. This also /// will set up the variables which rely upon this information. /// This is a method and not a property only to hide it from the GUI. /// </summary> /// <param name="instrDetails"></param> /// <returns></returns> public bool TrySetInstrumentDetails(InstrumentDetails instrDetails) { if (InstrumentDetails != null) { return(false); } InstrumentDetails = instrDetails; return(true); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // * New Method: Disable Instrument //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public void DisableInstrument(InstrumentMode eWhichInstrument) { InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument]; if (instrument != null) { instrument.holder.SetActive(false); } }
}// ProcessQueryBuildEvent() // // // /// <summary> /// called by the hub thread to process a request to create a query for instrument details /// </summary> /// <param name="requestArg"></param> private void ProcessRquestDBInstrDetails(QueryBuilderHubRequest requestArg) { Log.NewEntry(LogLevel.Minor, "ProcessCheckDBInstrDetails: Processing Request"); foreach (object obj in requestArg.Data) { InstrumentDetails instrDetails = (InstrumentDetails)obj; // TODO CALL DB INSTRUMENT METHODS FROM HERE } }
// // #endregion//Properties #region Public Methods // ***************************************************************** // **** Public Methods **** // ***************************************************************** // // ********************************************************* // **** TrySetInstrumentDetails() **** // ********************************************************* // /// <summary> /// Called to set the instrument details for the first time. This also /// will set up the variables which rely upon this information. /// This is a method and not a property only to hide it from the GUI. /// </summary> /// <param name="instrDetails"></param> /// <returns></returns> public bool TrySetInstrumentDetails(InstrumentDetails instrDetails) { if (InstrumentDetails != null) { return(false); } InstrumentDetails = instrDetails; m_OffMarketPriceDifference = m_OffMarketTicks * instrDetails.TickSize; return(true); }
// GET: Instruments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //getting the instrument Instruments instrument = db.Instruments.SqlQuery("select * from Instruments where instrumentid = @id", new SqlParameter("id", id)).FirstOrDefault(); if (instrument == null) { return(HttpNotFound()); } //getting the artists that are matched with this instrument in the bridging table string query = "select Artists.* from Artists inner join InstrumentsArtists on Artists.artistid=InstrumentsArtists.Artists_artistid " + " where InstrumentsArtists.Instruments_instrumentid=" + id; List <Artists> artists = db.Artists.SqlQuery(query).ToList(); Debug.WriteLine("Artists that play this instrument = "); foreach (var a in artists) { Debug.WriteLine(a.artistfname + " " + a.artistlname); } //getting all artists EXCEPT for those already associated with this instrument (to prevent duplicates) //if there are artists matched, grab everyone else who isn't matched List <Artists> allArtists; if (artists.Any()) { string artistIds = ""; foreach (var a in artists) { artistIds += a.artistid.ToString() + ","; } artistIds = artistIds.Remove(artistIds.Length - 1); //removing the last comma in the list query = "select * from Artists where artistid NOT IN (" + artistIds + ")"; allArtists = db.Artists.SqlQuery(query).ToList(); } else //there are no artists matched with this instrument, so grab everybody { allArtists = db.Artists.SqlQuery("select* from Artists").ToList(); } InstrumentDetails viewModel = new InstrumentDetails(); viewModel.instrument = instrument; viewModel.artists = artists; viewModel.allArtists = allArtists; return(View(viewModel)); }
public static InstrumentDetails WeeklyinstrumentDetails(Instrument instrument) { InstrumentDetails instrumentDetails = new InstrumentDetails(); int ema50Period = 50; int ema9Period = 9; List <Candle> candles = OANDA.Data.Prices.GetCandles(instrument.Name, ema50Period, "W"); instrumentDetails.Current = candles.LastOrDefault().Close; EMA ema50 = new EMA(ema50Period); EMA ema9 = new EMA(ema9Period); List <MyTrade.Core.Model.Candle> wcandles = MyTrade.Core.SqliteDataAccess.WeekyCandles.LoadCandles(instrument.Name); PivotPoints pps = new PivotPoints(); PivotPoint wpps = pps.Get(wcandles[wcandles.Count - 2], instrumentDetails.Current); instrumentDetails.W_PivotPoints = wpps; instrumentDetails.TimeFrame = Core.Constants.TimeFrame.DAILY; for (int i = 0; i < candles.Count; i++) { instrumentDetails.Max = Math.Max(instrumentDetails.Max, candles[i].High); if (i == 0) { instrumentDetails.Min = candles[i].Low; instrumentDetails.Min = Math.Min(candles[i].Low, instrumentDetails.Min); } if (i == (candles.Count - 1)) { if (instrumentDetails.EMAs == null) { instrumentDetails.EMAs = new List <Core.Model.Indicators.EMA>(); } ema50.AddDataPoint(candles[i].Close); ema9.AddDataPoint(candles[i].Close); instrumentDetails.EMAs.Add(new Core.Model.Indicators.EMA() { Period = 50, Value = ema50.Average }); instrumentDetails.EMAs.Add(new Core.Model.Indicators.EMA() { Period = 9, Value = ema9.Average }); } else { ema50.AddDataPoint(candles[i].Close); ema9.AddDataPoint(candles[i].Close); } } return(instrumentDetails); }
private async void LstItems_OnItemTapped(object sender, ItemTappedEventArgs e) { //listviewDevices.SelectedItem.ToString ListView lv = (ListView)sender; InstrumentDetails instrumendetails = (InstrumentDetails)lv.SelectedItem; var test = instrumendetails.ItemNumber; var newpage = new Details(instrumendetails); //CONSTRUCTUR REQUIREMENT HERE await Navigation.PushAsync(newpage); }
} // public bool TryLookupInstrumentDetails(MistyProds.InstrumentName instrName, out InstrumentDetails details) { details = null; lock (m_InstrumentLock) { if (!m_InstrumentDetails.TryGetValue(instrName, out details)) { details = null; } } //lock return(details != null); } //TryGetInstrument()
}//TryCreateNewBook() // // // ************************************************************* // **** GetRequest() **** // ************************************************************* // <summary> // This utility method uses the RequestFactory for request to create // and clear a request for new use. // </summary> // <param name="request"></param> // <returns></returns> /* * protected MarketHubRequest GetRequest(RequestCode request) * { * MarketHubRequest eventArg = m_RequestFactory.Get(); * eventArg.Request = request; * eventArg.Data.Clear(); * return eventArg; * }//GetRequest() * // * // * protected void RecycleRequest(MarketHubRequest requestToRecycle) * { * //m_RequestFactory.Recycle(requestToRecycle); * } */ // // // ************************************************************* // **** TryAddInstrumentDetails() **** // ************************************************************* /// <summary> /// Hub thread calls to try and add instrument details to the dictionary table. /// </summary> /// <param name="instrName"></param> /// <param name="instrDetails"></param> protected bool TryAddInstrumentDetails(InstrumentName instrName, InstrumentDetails instrDetails) { if (m_InstrumentDetailsTable.TryAdd(instrName, instrDetails)) // try and add it { return(true); } if (!m_InstrumentDetailsTable.ContainsKey(instrName)) // if we fail, and we don't already have this instrument...something went wrong! { Log.NewEntry(LogLevel.Major, "MarketHub.TryAddInstrumentDetails: {0} Failed to Add to Instrument Details Dictionary.", instrName.ToString()); } return(false); }
// ***************************************************************** // **** Event Handler **** // ***************************************************************** // // // // ***************************************************************** // **** ExecutionListener_InstrumentsFound() **** // ***************************************************************** /// <summary> /// Called when our execution listener has found a new instrument. This means that it has also created /// a market for this instrument which we can now have a pointer to in the quoter leg, as well as subscribe /// to the MarketChanged events. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void ExecutionListener_InstrumentsFound(object sender, EventArgs eventArgs) { // // Gather and save pertinent information about the Instrument found. // InstrumentsFoundEventArgs instrEventArgs = (InstrumentsFoundEventArgs)eventArgs; InstrumentDetails instrDetails = instrEventArgs.InstrumentDetails; int internalId = m_CurveTrader.m_InstrumentToInternalId[instrDetails.InstrumentName]; m_Scratchers[internalId].m_Market = m_ExecutionContainer.m_Markets[instrDetails.InstrumentName]; // keep a pointer to the market m_Scratchers[internalId].m_InstrumentDetails = instrDetails; }
private async Task ShouldGetCustomerDetailsWithInstrument() { var cardTokenResponse = await PreviousApi.TokensClient().Request(GetCardTokenRequest()); cardTokenResponse.ShouldNotBeNull(); var request = new CreateInstrumentRequest { Token = cardTokenResponse.Token, Customer = new InstrumentCustomerRequest { Email = "*****@*****.**", Name = "Instrument Customer", Default = true, Phone = new Phone { CountryCode = "+1", Number = "4155552671" } } }; var createInstrumentResponse = await PreviousApi.InstrumentsClient().Create(request); createInstrumentResponse.ShouldNotBeNull(); createInstrumentResponse.Customer.ShouldNotBeNull(); createInstrumentResponse.Customer.Id.ShouldNotBeNullOrEmpty(); CustomerDetailsResponse customerDetailsResponse = await PreviousApi.CustomersClient().Get(createInstrumentResponse.Customer.Id); customerDetailsResponse.ShouldNotBeNull(); customerDetailsResponse.Instruments.ShouldNotBeNull(); customerDetailsResponse.Instruments.Count.ShouldBe(1); InstrumentDetails instrumentDetails = customerDetailsResponse.Instruments[0]; createInstrumentResponse.Id.ShouldBe(instrumentDetails.Id); createInstrumentResponse.Type.ShouldBe(InstrumentType.Card); createInstrumentResponse.Fingerprint.ShouldBe(instrumentDetails.Fingerprint); createInstrumentResponse.ExpiryMonth.ShouldBe(instrumentDetails.ExpiryMonth); createInstrumentResponse.ExpiryYear.ShouldBe(instrumentDetails.ExpiryYear); createInstrumentResponse.Scheme.ShouldBe(instrumentDetails.Scheme); createInstrumentResponse.Last4.ShouldBe(instrumentDetails.Last4); createInstrumentResponse.Bin.ShouldBe(instrumentDetails.Bin); createInstrumentResponse.CardType.ShouldBe(CardType.Credit); createInstrumentResponse.Issuer.ShouldBe(instrumentDetails.Issuer); createInstrumentResponse.IssuerCountry.ShouldNotBeNull(); createInstrumentResponse.ProductId.ShouldBe(instrumentDetails.ProductId); createInstrumentResponse.ProductType.ShouldBe(instrumentDetails.ProductType); }
// ***************************************************************************** // **** Private Methods **** // ***************************************************************************** // // ***************************************************************** // **** Process Instruments Found() **** // ***************************************************************** // /// <summary> /// When a new instrument details is found this method appropiate events to sbuscribers /// who would like to know about the insturment and details /// </summary> /// <param name="instrumentDetails"></param> protected void ProcessInstrumentsFound(InstrumentDetails instrumentDetails) { m_UVInstrumentDetails[instrumentDetails.InstrumentName] = instrumentDetails; if (m_PendingOrderBooks.ContainsKey(instrumentDetails.InstrumentName)) { while (m_PendingOrderBooks[instrumentDetails.InstrumentName].Count > 0) { // remove from list and send to be processed. OrderBook orderBookToProcess = m_PendingOrderBooks[instrumentDetails.InstrumentName][0]; m_PendingOrderBooks[instrumentDetails.InstrumentName].Remove(orderBookToProcess); ProcessCreateBook(orderBookToProcess); } } OnInstrumentsFound(instrumentDetails); }
public void ToggleInstrumentState(InstrumentMode eWhichInstrument) { InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument]; if (instrument != null) { if (instrument.renderer.sprite == instrument.specialSprite) { ShowNormalInstrumentState(eWhichInstrument); } else { ShowSpecialInstrumentState(eWhichInstrument); } } }
internal Details(InstrumentDetails instrumendetails) { InstrumentDetails test = instrumendetails; InitializeComponent(); this.Title = "" + test.Model; Number.Text = "" + test.ItemNumber; Name.Text = "" + test.Model; Manufactur.Text = "" + test.Manufacturer; String ss = CrossSecureStorage.Current.GetValue("password"); getData(); }
/// <summary> /// InstrumentCatalogSubscription InstrumentsUpdated event. /// </summary> private void InstrumentsUpdated(object sender, InstrumentCatalogUpdatedEventArgs e) { InstrumentCatalogSubscription instrumentCatalogSubscription = sender as InstrumentCatalogSubscription; if (instrumentCatalogSubscription?.Instruments?.Values != null) { foreach (Instrument instru in instrumentCatalogSubscription.Instruments.Values) { if (!_availableInstrumentDico.ContainsKey(instru.Key.SeriesKey)) { _availableInstrumentDico.Add(instru.Key.SeriesKey, instru); InstrumentDetails instruDetails = instru.InstrumentDetails; DataUpdateEvent?.Invoke(this, instruDetails.Key.SeriesKey, instruDetails.ExpirationDate.ToDateTime(), instruDetails.StrikePrice, instruDetails.OptionType.ToString().ToUpper(), instruDetails.Name, instru.Product.Type.Name, instru.Product.Name); } } } }
// // // ***************************************************************** // **** ExecutionListener_InstrumentsFound() **** // ***************************************************************** /// <summary> /// Called when our execution listener has found a new instrument. This means that it has also created /// a market for this instrument which we can now have a pointer to in the quoter leg, as well as subscribe /// to the MarketChanged events. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void ExecutionListener_InstrumentsFound(object sender, EventArgs eventArgs) { // // Gather and save pertinent information about the Instrument found. // InstrumentsFoundEventArgs instrEventArgs = (InstrumentsFoundEventArgs)eventArgs; m_InstrumentDetails = instrEventArgs.InstrumentDetails; m_FillBook = new FillBook(m_PriceLeg.InstrumentName.ToString(), m_InstrumentDetails.Multiplier); if (double.IsNaN(m_QuoteTickSize)) // if our user hasn't defined this yet { m_QuoteTickSize = m_InstrumentDetails.TickSize; // set it to the default tick size here } m_IsLegSetUpComplete = true; m_RiskManager.Start(); m_ExecutionContainer.ConfirmStrategyLaunched(); // confirm we are "launched" }
public static string SendAutospreaderOrder(ttapiUtils.AutoSpreader autoSpreader, int qty, decimal price, string orderTag, Logger logger, int reloadQuantity = 0) { Instrument instrument = autoSpreader.AutoSpreaderInstrument; InstrumentDetails instrumentDetails = instrument.InstrumentDetails; AutospreaderSyntheticOrderProfile op = new AutospreaderSyntheticOrderProfile(((AutospreaderInstrument)instrument).GetValidGateways()[autoSpreader.GateWay], (AutospreaderInstrument)instrument); BuySell Direction = BuySell.Buy; Rounding Rounding = Rounding.Down; if (qty < 0) { Direction = BuySell.Sell; qty = -qty; Rounding = Rounding.Up; } string OrderKey = op.SiteOrderKey; if (reloadQuantity != 0) { op.SlicerType = SlicerType.Reload; op.DisclosedQuantity = Quantity.FromInt(instrument, reloadQuantity); } op.BuySell = Direction; op.OrderQuantity = Quantity.FromInt(instrument, qty); op.OrderType = OrderType.Limit; op.OrderTag = orderTag; op.LimitPrice = Price.FromDouble(instrumentDetails, Convert.ToDouble(price), Rounding); if (!autoSpreader.ts.SendOrder(op)) { logger.Log("Send new order failed: " + op.RoutingStatus.Message); } else { logger.Log("Send new order succeeded."); } return(OrderKey); }
}//ProcessProductCatalogUpdate() // // // // ***************************************************************** // **** Process Instruments Found() **** // ***************************************************************** private void ProcessInstrumentsFound(PriceListener.InstrumentsFoundEventArgs e) { List <MistyProds.InstrumentName> instrFound = new List <MistyProds.InstrumentName>(); lock (m_InstrumentLock) { foreach (MistyProds.InstrumentName name in e.InstrumentDetails.Keys) { if (!m_InstrumentDetails.ContainsKey(name)) { InstrumentDetails detail = e.InstrumentDetails[name]; m_InstrumentDetails.Add(name, detail); // TODO: Here, we may need to create our own Misty InstrumentInfo entry in lieu of using the TT InstrumentDetails. instrFound.Add(name); // TODO: ? Update product list if its a new product. }//if new instrument. } } OnMarketFoundResource(instrFound); }// ProcessInstrumentsFound()
public void Run() { instruments = OANDA.Data.Instrument.AllFromDB().OrderBy(x => x.Type).OrderBy(x => x.DisplayName).ToList(); foreach (Instrument instrument in instruments) { InstrumentDetails instrumentDetails = null; List <Candle> ha_M_Candles = HA_M_Candles(instrument, out instrumentDetails); Candle ha_W_LastCandle = HA_W_Candles(instrument); Candle ha_D_LastCandle = HA_D_Candles(instrument);; Candle ha_H4_LastCandle = HA_H4_Candles(instrument); Result result = Results.GetResult_HA_PP(instrument, ha_M_Candles, ha_W_LastCandle.HaColor, ha_D_LastCandle.HaColor, ha_H4_LastCandle.HaColor, instrumentDetails); if (result != null) { GetResult(result, instruments.Count()); } } }
public void ShowSpecialInstrumentState(InstrumentMode eWhichInstrument) { InstrumentDetails instrument = m_aInstrumentDetails[(int)eWhichInstrument]; if (instrument != null) { instrument.renderer.sprite = instrument.specialSprite; instrument.holder.transform.localPosition = instrument.specialPosition; instrument.holder.transform.localRotation = Quaternion.Euler(instrument.specialRotation); instrument.holder.transform.localScale = instrument.specialScale; if (m_agoTambourineCymbals[(int)eWhichInstrument] != null) { m_agoTambourineCymbals[(int)eWhichInstrument].SetActive(false); } if (m_arTambourineTargets[(int)eWhichInstrument] != null && m_arTambourineTargets[(int)eWhichInstrument].Visible) { m_arTambourineTargets[(int)eWhichInstrument].ShowShakenTambourineTargets(); } } }
private void PriceListener_InstrumentsFound(object sender, EventArgs eventArgs) { PriceListener.InstrumentsFoundEventArgs e = (PriceListener.InstrumentsFoundEventArgs)eventArgs; List <Misty.Lib.Products.InstrumentName> instrFound = new List <Misty.Lib.Products.InstrumentName>(); lock (m_InstrumentLock) { foreach (InstrumentName name in e.InstrumentDetails.Keys) { if (!m_InstrumentDetails.ContainsKey(name)) { InstrumentDetails details = e.InstrumentDetails[name]; m_Name2Key.TryAdd(name, details.Key); m_Key2Name.TryAdd(details.Key, name); m_InstrumentDetails.TryAdd(name, details); Market mkt = new Market(name); m_Markets.TryAdd(name, mkt); } m_PriceListener.SubscribeTo(e.InstrumentDetails[name].Key, new PriceSubscriptionSettings(PriceSubscriptionType.InsideMarket)); } }// lock }
public void Run() { instruments = OANDA.Data.Instrument.AllFromDB().OrderBy(x => x.Type).OrderBy(x => x.DisplayName).ToList(); foreach (Instrument instrument in instruments) { //if (instrument.Name == "DE30EUR") //{ InstrumentDetails instrumentDetails = null; List <Candle> ha_D_Candles = HA_D_Candles(instrument, out instrumentDetails); Candle ha_H4_LastCandle = HA_H4_Candles(instrument); Candle ha_H1_LastCandle = HA_H1_Candles(instrument); Candle ha_M15_LastCandle = HA_M15_Candles(instrument);; Result result = Results.GetResult_HA_EMAs(instrument, ha_D_Candles[ha_D_Candles.Count - 1].OriginalColor, ha_D_Candles, ha_H4_LastCandle.HaColor, ha_H1_LastCandle.HaColor, ha_M15_LastCandle.HaColor, instrumentDetails); if (result != null) { GetResult(result, instruments.Count()); } //} } }
public void Run() { instruments = MyTrade.Core.SqliteDataAccess.StockInstruments.LoadInstruments().Where(x => x.IsFavorite == true).OrderBy(x => x.Type).OrderBy(x => x.DisplayName).ToList(); foreach (Instrument instrument in instruments) { //if (instrument.Name == "CHF_JPY") //{ InstrumentDetails instrumentDetails = null; List <Candle> ha_D_Candles = HA_D_Candles(instrument, out instrumentDetails); Candle ha_H4_LastCandle = HA_H4_Candles(instrument); Candle ha_H1_LastCandle = HA_H1_Candles(instrument); Candle ha_M15_LastCandle = HA_M15_Candles(instrument);; Result result = Results.GetResult_HA_EMAs(instrument, ha_D_Candles[ha_D_Candles.Count - 1].OriginalColor, ha_D_Candles, ha_H4_LastCandle.HaColor, ha_H1_LastCandle.HaColor, ha_M15_LastCandle.HaColor, instrumentDetails); if (result != null) { GetResult(result, instruments.Count()); } //} } }
public static bool SendAutospreaderOrder(TradingTechnologies.TTAPI.Instrument instrument, InstrumentDetails instrumentDetails, ttapiUtils.AutoSpreader autoSpreader, int qty, decimal price, string orderTag,Logger logger) { AutospreaderSyntheticOrderProfile op = new AutospreaderSyntheticOrderProfile(((AutospreaderInstrument)instrument).GetValidGateways()[autoSpreader.GateWay], (AutospreaderInstrument)instrument); BuySell Direction = BuySell.Buy; Rounding Rounding = Rounding.Down; if (qty < 0) { Direction = BuySell.Sell; qty = -qty; Rounding = Rounding.Up; } op.BuySell = Direction; op.OrderQuantity = Quantity.FromInt(instrument, qty); op.OrderType = OrderType.Limit; op.OrderTag = orderTag; op.LimitPrice = Price.FromDouble(instrumentDetails, Convert.ToDouble(price), Rounding); if (!autoSpreader.ts.SendOrder(op)) { logger.Log("Send new order failed: " + op.RoutingStatus.Message); return false; } else { logger.Log("Send new order succeeded."); return true; } }