public override IDictionary<long, Dictionary<string, string>> Export(IList<Trade> inTrades, Filter inFilter, Stream stream, Market market, IList<Exception> exceps) { var task = _task; var filter = task.Filter; var date = market.Date(_effectiveTime); var trades = Env.Current.Trade.GetTrades2(filter, date, _effectiveTime); using (var writer = new StreamWriter(stream)) { WriteHeader(writer); foreach (var trade in trades) { if (trade.Product == null) { exceps.Add(new ApplicationException(String.Format("Trade {0} is invalid. Missing product.", trade.Id))); continue; } if(trade.TradeTime > _effectiveTime) { continue; } string line = WriteTrade(trade, date, _effectiveTime, exceps); if (!Utilities.IsNullOrEmpty(line)) { writer.WriteLine(line); } } } return null; }
public void ShouldExecuteInstructionWhenThereIsEnoughLiquidityOnOneMarket() { // Given market A: 150 @ $100, market B: 55 @ $101 // When Investor wants to buy 125 stocks @ $100 Then SOR can execute at the requested price var marketA = new Market { SellQuantity = 150, SellPrice = 100M }; var marketB = new Market { SellQuantity = 55, SellPrice = 101M }; var marketsInvolved = new[] { marketA, marketB }; ICanRouteOrders canRouteOrders = null;//new OrderRoutingService(marketsInvolved); ICanReceiveMarketData canReceiveMarketData = new MarketDataProvider(marketsInvolved); IProvideMarkets provideMarkets = new MarketProvider(marketsInvolved); var sor = new SmartOrderRoutingEngine(provideMarkets, canRouteOrders, canReceiveMarketData); var investorInstructionDto = new InvestorInstructionDto(new InvestorInstructionIdentifierDto(), Way.Buy, quantity: 125, price: 100M); OrderExecutedEventArgs orderExecutedEventArgs = null; sor.Subscribe(investorInstructionDto.UniqueIdentifier, (args) => { orderExecutedEventArgs = args; }, null); //investorInstruction.Executed += (sender, args) => { orderExecutedEventArgs = args; }; // orderRequest.Route(); ? sor.Route(investorInstructionDto); // TODO :introduce autoreset event instead Check.That(orderExecutedEventArgs).HasFieldsWithSameValues(new { Way = Way.Buy, Quantity = 125, Price = 100M }); }
public static void resetReferencesForNewLevel() { // Managers manager = GameObject.FindGameObjectWithTag("Manager"); stateManager = manager.GetComponent<StateManager>(); stateTiming = manager.GetComponent<StateTiming>(); // Game stats and information gameStats = manager.GetComponent<GameStats>(); itemDatabase = manager.GetComponent<Item_Database>(); inventory = manager.GetComponent<Inventory>(); market = manager.GetComponent<Market>(); marketArrays = manager.GetComponent<MarketArrays>(); soundEffects = GameObject.FindObjectOfType<SoundEffectsDatabase>().GetComponent<SoundEffectsDatabase>(); // Cameras realtimeCamera = GameObject.FindGameObjectWithTag("Camera_Realtime").GetComponent<Camera>(); strategicCamera = GameObject.FindGameObjectWithTag("Camera_Strategic").GetComponent<Camera>(); // Game entities player = GameObject.FindGameObjectWithTag("Player"); castle = GameObject.FindGameObjectWithTag("Castle"); soundEffect = (GameObject)Resources.Load("OneTimeSoundEffect", typeof(GameObject)); // Data lastLevelIndex = Application.loadedLevel; currentLevel = 1; }
// Use this for initialization void Start() { animator = GetComponent<Animator>(); //mainGame = GameLogicGameObject.GetComponent<WeedGame>(); market = GameLogicGameObject.GetComponent<Market>(); }
public static int Save(Market m) { var ctx = new AutoNewsEntities(); if (m.Id == 0) { if (ctx.Markets.Count(o => (o.Name == m.Name && o.MarketTypeId == m.MarketTypeId) || o.MarketCrmId == m.MarketCrmId) > 0) { throw new Exception("名称或CRM ID已存在!"); } ctx.Markets.Add(m); return 1; } //id != 0 if (ctx.Markets.Count(o => ((o.Name == m.Name && o.MarketTypeId == m.MarketTypeId) || o.MarketCrmId == m.MarketCrmId) && o.Id != m.Id) > 0) { throw new Exception("名称或CRM ID已存在!"); } var market = ctx.Markets.Single(o => o.Id == m.Id); market.Auto = m.Auto; market.EndTime = m.EndTime; market.MarketCrmId = m.MarketCrmId; market.Name = m.Name; market.StartTime = m.StartTime; ctx.SaveChanges(); return 2; }
public MockTradeFinderFactory(Map map, Market market, string logFilePath, Parameters parameters) : base("") { this.map = map; this.market = market; this.logFilePath = logFilePath; this.parameters = parameters; }
private void Awake() { //clone configs on startup so we don't modify the global assets questBoard = QuestBoard.Create(questBoard); crewConfig = CrewConfiguration.Create(crewConfig); cargoConfig = Instantiate(cargoConfig); missionsConfig = Instantiate(missionsConfig); market = Instantiate(market); fleetManager = Instantiate(fleetManager); Debug.Assert(worldMap); SceneManager.activeSceneChanged += (oldScene, newScene) => { PlayerNotifications.Clear(); }; FindObjectOfType<MissionManager>().OnMissionChanged += mission => { if (mission) { LocalPlayer = null; } else { LocalPlayer = FindObjectOfType<PlayerShip>(); } }; //apply initial settings ReloadPrefs(); }
public void ShouldFaileWhenOrderExceedsAllMarketCapacityAndPartialExecutionNotAllowed() { // Given market A: 150 @ $100, market B: 55 @ $101 // When Investor wants to buy 125 stocks @ $100 Then SOR can execute at the requested price var marketA = new Market { SellQuantity = 15, SellPrice = 100M }; var marketB = new Market { SellQuantity = 55, SellPrice = 101M }; var sor = CreateSmartOrderRoutingEngine(new[] { marketA, marketB }); var investorInstruction = new InvestorInstructionDto(new InvestorInstructionIdentifierDto(), Way.Buy, quantity: 125, price: 100M, allowPartialExecution: false); // Subscribes to the instruction's events OrderExecutedEventArgs orderExecutedEventArgs = null; string failureReason = null; sor.Subscribe(investorInstruction.UniqueIdentifier, (args) => { orderExecutedEventArgs = args; }, (args) => { failureReason = args; }); // orderRequest.Route(); ? sor.Route(investorInstruction); // Couldn't execute because order with excessive quantity Check.That(failureReason).IsNotNull().And.IsEqualIgnoringCase("Excessive quantity!"); Check.That(orderExecutedEventArgs).IsNull(); }
static bool HandleLines(IList<string> lines, Market market, char[] seps, StringBuilder sb) { //Read First Line to fin Vol Surface and if its Rho or Nu bool isRho = true; InterestVolatility vol = null; var firstLine = lines.FirstOrDefault(); if (string.IsNullOrEmpty(firstLine)) { sb.Append("Cannot parse first line"); return false; } var ss = firstLine.Split(seps); var sdate = ss[2]; var stype = ss[3]; var ticker = ss[4]; var date = SimpleDate.Parse(sdate); isRho = stype.ToUpper().Contains("RHO"); var isBeta = stype.ToUpper().Contains("BETA"); ss = ticker.Split('.'); var name = ss[0]; var ccy = ss[1]; var time = date.ToDateTime(23, 59, 59); market.Time = time; market.ClearMarketDatas(); var vols = market.GetAll(true, false, false, true, false, false, false, false, false, false, false, false, false); foreach (var im in vols) { var ivol = im as InterestVolatility; if (ivol != null && ivol.Currency.Equals(ccy)) { vol = ivol; break; } } if (vol == null) { sb.Append("Cannot Find Any Vol for " + ticker); return false; } var output = vol.Output as InterestVolatilityOutput; if (output == null) { sb.Append("Invalid Vol not built " + vol); return false; } var data = new List<SabrData>(); foreach (var line in lines) { var d = new SabrData(); ss = line.Split(seps); var tick = ss[4]; d.Date = SimpleDate.Parse(ss[2]).ToDateTime(); d.ComponentTicker = tick; d.InstrumentType = ss[3]; d.Value = Convert.ToDouble(ss[5]); data.Add(d); } return HandleData(vol, isRho, isBeta, data, market, sb); }
public object Value(string columnName, Market market, PLItem item, PLReport report) { if (mColumns.ContainsKey(columnName)) { return mColumns[columnName].Value(market, item, report); } return null; }
public object Value(string columnName, Market market, PLEntry entry, PlBlotter blotter) { if (mColumns.ContainsKey(columnName)) { return mColumns[columnName].Value(market, entry, blotter); } return null; }
public object Value(Market market, PLEntry entry, PlBlotter blotter) { if (entry != null) { return entry.EndNominal - entry.StartNominal; } return null; }
public void TestFixtureSetUp() { itemDatabase = TestObjectFactory.CreateItemDatabase(); map = TestObjectFactory.CreateMap(); market = TestObjectFactory.CreateMarket(itemDatabase, map); kernite = itemDatabase.GetItemType("Kernite"); navitas = itemDatabase.GetItemType("Navitas"); }
public Market AddTopMarket(int marketId) { var market = new Market() { Id = marketId }; return _marketDataStore.TopMarketSave(market); }
public object Value(Market market, PLEntry entry, PlBlotter blotter) { if(entry != null && entry.Trade != null && entry.Trade.InitialPartyId != 0) { var party = Env.Current.StaticData.GetPartyById(entry.Trade.InitialPartyId); return party.Code; } return null; }
public void MarketOrderShouldDecreaseAvailableQuantity() { var market = new Market { SellPrice = 100M, SellQuantity = 50 }; var order = market.CreateMarketOrder(Way.Buy, quantity: 10); market.Send(order); Check.That(market.SellQuantity).IsEqualTo(40); }
public RequestAccess( Market market, Product product, RequestStatus status, ControllerStatus cstatus, string description, int submittedByID) { this.Status = status; this.ControllerStatus = cstatus; this.Description = description; this.SubmittedByUserId = submittedByID; this.MarketAccess = market; this.ProductAccess = product; }
public void TestFixtureSetUp() { testLogPath = TestObjectFactory.TestDirectory + "Logs"; testNoLogPath = TestObjectFactory.TestDirectory + "NoLogs"; archiveBasePath = TestObjectFactory.TestDirectory + "Logs" + "\\Temp"; map = TestObjectFactory.CreateMap(); database = TestObjectFactory.CreateItemDatabase(); market = TestObjectFactory.CreateMarket(database, map); parameters = new Parameters(1000.0f, 100.0f, "Sol", TripType.SingleTrip); }
public override bool IsExcluded(ProductEvent pevent, Trade trade, Market market) { var isExcluded = base.IsExcluded(pevent, trade, market); if (isExcluded) return true; if (trade.Product is Swap) { var swap = trade.Product as Swap; if (swap.PayLeg.IsFixedRate && swap.ReceiveLeg.IsFixedRate) return true; } return false; }
public Ukraine(Market m = Market.USE ) { // all calendar instances on the same market share the same implementation instance switch ( m ) { case Market.USE: calendar_ = Impl.Singleton; break; default: throw new ApplicationException( "unknown market" ); } }
public object Value(Market market, PLEntry entry, PlBlotter blotter) { if (entry != null && entry.Trade != null) { var swaption = entry.Trade.Product as Swaption; if (swaption != null && swaption.Swap != null) { return swaption.Swap.EndDate; } } return null; }
public void LimitOrderShouldCaptureExec() { var market = new Market { SellPrice = 100M, SellQuantity = 50 }; var executed = false; var order = market.CreateLimitOrder(Way.Buy, price: 100M, quantity: 10, allowPartialExecution: false); market.OrderExecuted += (s, a) => executed = true; market.Send(order); Check.That(executed).IsTrue(); Check.That(market.SellQuantity).IsEqualTo(40); }
public override bool Reconcile(Trade otTrade, Trade externalTrade, Market market, bool fullMatch, DateTime reconciliationDate, IList<Exception> exceps) { var unmatchReason = string.Empty; var ref1 = otTrade.GetProperty(ReconcileTaskExecutor.Reconciled); if (ref1 != null && ref1.ToLowerInvariant().Equals("true")) return false; var ref2 = externalTrade.GetProperty(ReconcileTaskExecutor.Reconciled); if (ref2 != null && ref2.ToLowerInvariant().Equals("true")) return false; if (!(otTrade.Product.GetType() == externalTrade.Product.GetType())) return false; if (otTrade.BookId != externalTrade.BookId) return false; if (otTrade.PrimeBrokerId != externalTrade.PrimeBrokerId && otTrade.ClearerId != externalTrade.ClearerId) { if (fullMatch) return false; unmatchReason += "Account "; } var prod1 = otTrade.Product; var prod2 = externalTrade.Product; var fut1 = prod1 as Future; var fut2 = prod2 as Future; if (fut1 != null && fut2 != null) { var ticker1 = fut1.Ticker; var ticker2 = fut2.Ticker; if (!string.IsNullOrEmpty(ticker1) && !string.IsNullOrEmpty(ticker2)) { if (!ticker1.Equals(ticker2)) return false; } } var fx1 = prod1 as FX; var fx2 = prod2 as FX; if (fx1 != null && fx2 != null) { if (!fx1.CurrencyPair.Equals(fx2.CurrencyPair)) return false; if (fullMatch) { if (Math.Abs(fx1.PrimaryAmount - fx2.PrimaryAmount) > Utilities.Epsilon) return false; if (Math.Abs(fx1.QuotingAmount - fx2.QuotingAmount) > Utilities.Epsilon) return false; } return true; } if (prod1 is Bond || prod1 is Equity) { if (prod1.Id != prod2.Id) return false; } if (fullMatch) { if (Math.Abs(otTrade.Quantity - externalTrade.Quantity) > Utilities.Epsilon) return false; } return true; }
public Brazil(Market market) { // all calendar instances on the same market share the same implementation instance switch (market) { case Market.Settlement: calendar_ = SettlementImpl.Singleton; break; case Market.Exchange: calendar_ = ExchangeImpl.Singleton; break; default: throw new ApplicationException("unknown market"); } }
public Indonesia(Market m) : base() { // all calendar instances on the same market share the same // implementation instance switch (m) { case Market.BEJ: case Market.JSX: case Market.IDX: calendar_ = BEJ.Singleton; break; default: throw new ArgumentException("Unknown market: " + m); ; } }
public SouthKorea(Market m) : base() { // all calendar instances on the same market share the same // implementation instance switch (m) { case Market.Settlement: calendar_ = Settlement.Singleton; break; case Market.KRX: calendar_ = KRX.Singleton; break; default: throw new ArgumentException("Unknown market: " + m); ; } }
public China( Market market = Market.SSE ) { // all calendar instances on the same market share the same implementation instance switch ( market ) { case Market.SSE: calendar_ = SseImpl.Singleton; break; case Market.IB: calendar_ = IbImpl.Singleton; break; default: Utils.QL_FAIL( "unknown market" ); break; } }
// Use this for initialization void Start() { market = GameObject.FindGameObjectWithTag("GameLogic").GetComponent<Market>(); mainGame = GameObject.FindGameObjectWithTag("GameLogic").GetComponent<WeedGame>(); if(createdFromLoad) { } else { weedPerUpdate = weedPerUpdateDefault; totalWeedFarmed = 0; } market.modifyResiduleIncome(weedPerUpdate); }
public Italy(Market m) : base() { // all calendar instances on the same market share the same // implementation instance switch (m) { case Market.Settlement: calendar = Settlement.Singleton; break; case Market.Exchange: calendar = Exchange.Singleton; break; default: throw new ArgumentException("Unknown market: " + m); ; } }
// Use this for initialization void Start() { market = GameObject.FindGameObjectWithTag("GameLogic").GetComponent<Market>(); //animator = GetComponent<Animator>(); if(loaded) { if(carryingCurrently > 0) { waitingForLoad = false; currentWaypoint = GameObject.FindGameObjectWithTag("BoatStart").GetComponent<Waypoint>().nextWaypoint; } } else { } }
public void SendMarkets(Dictionary <int, List <Market> > periodMarketsDictionary, Guid gameId, string match, Dictionary <string, double> gameState) { // todo divide into smaller functions if (periodMarketsDictionary.Count == 0) { return; } if (periodMarketsDictionary[1].Count == 0) { return; } const string eventName = "MLB"; List <Markets> formattedMarketList = new List <Markets>(); foreach (KeyValuePair <int, List <Market> > keyValuePair in periodMarketsDictionary) { int key = keyValuePair.Key; List <Market> marketList = keyValuePair.Value; string period = _periods[key]; //------------------------------------------------------------------------ //center handicap exists if false send takedown bool cHandicap = false; bool cTotal = false; bool cHomeTotal = false; bool cAwayTotal = false; int id = _altRunLines[key]; Markets handicapAlts = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(m => SelectInsideLimitsWithNonZeroTarget(m, "SP")) }; if (handicapAlts.MarketList.Count > 0) { Markets handicapAltsSet = SetMarketActiveNew(handicapAlts, true, gameState); SendOddsMessage(handicapAltsSet, gameId, formattedMarketList, eventName); // center line fix to create 1.5 run line standard for full game List <Market> marketListRunLine = handicapAlts.MarketList.FindAll(v => Math.Abs(v.Target).IsEqualTo(1.5)); if (marketListRunLine.Count > 0 && key == 4 && gameState["I"] < 2) { Market market = marketListRunLine.OrderBy(v => v.Weight).First(); if (market != null) { cHandicap = true; int id2 = _periodRunLines[key]; market.Active = CheckActive(period, gameState, true); Markets handicap = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; handicap.MarketList.Add(market); SendOddsMessage(handicap, gameId, formattedMarketList, eventName); } } else { Market market = handicapAlts.MarketList.OrderBy(v => v.Weight).First(); if (market != null) { cHandicap = true; int id2 = _periodRunLines[key]; market.Active = CheckActive(period, gameState, true); Markets handicap = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; handicap.MarketList.Add(market); SendOddsMessage(handicap, gameId, formattedMarketList, eventName); } } } Markets handicapAltsInactive = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(m => SelectOutsideLimitsWithNonZeroTarget(m, "SP")) }; if (handicapAltsInactive.MarketList.Count > 0 && handicapAlts.MarketList.Count == 0) { SendOddsMessage2(SetMarketInactive(handicapAltsInactive), gameId, eventName); if (handicapAltsInactive.MarketList.Count == 0) { Market market = new Market { Active = false, Tp = "SP", Target = 0 }; int id2 = _periodRunLines[key]; Markets handicap = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; handicap.MarketList.Add(market); if (!cHandicap) { SendOddsMessage2(handicap, gameId, eventName); } } } //------------------------------------------------------------------------ id = _periodMoneyLines[key]; Markets moneyline = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id] }; Market market1 = marketList.Find(s => SelectInsideLimitsWithZeroTarget(s, "SP")); if (market1 != null) { market1.Active = CheckActive(period, gameState, true); market1.Tp = "ML"; moneyline.MarketList.Add(market1); SendOddsMessage(moneyline, gameId, formattedMarketList, eventName); } else { Market market = new Market { Active = false, Tp = "ML", Target = 0 }; moneyline.MarketList.Add(market); SendOddsMessage2(moneyline, gameId, eventName); } //------------------------------------------------------------------------ id = _altTotalLines[key]; Markets totallineAlt = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectInsideLimitsWithNonZeroTarget(s, "TL")) }; Markets totallineAltInactive = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectOutsideLimitsWithNonZeroTarget(s, "TL")) }; if (totallineAlt.MarketList.Count > 0) { Markets activeMarkets = SetMarketActiveNew(totallineAlt, true, gameState); SendOddsMessage(activeMarkets, gameId, formattedMarketList, eventName); Market market2 = totallineAlt.MarketList.OrderBy(v => v.Weight).First(); if (market2 != null) { cTotal = true; int id2 = _totalLines[key]; market2.Active = CheckActive(period, gameState, true); Markets totalline = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; totalline.MarketList.Add(market2); SendOddsMessage(totalline, gameId, formattedMarketList, eventName); } } if (totallineAltInactive.MarketList.Count > 0 && totallineAlt.MarketList.Count == 0) { SendOddsMessage2(SetMarketInactive(totallineAltInactive), gameId, eventName); Market market2 = totallineAltInactive.MarketList.OrderBy(v => v.Weight).First(); if (market2 != null) { int id2 = _totalLines[key]; market2.Active = false; Markets totalline = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; totalline.MarketList.Add(market2); if (!cTotal) { SendOddsMessage2(totalline, gameId, eventName); } } } //------------------------------------------------------------------------ id = _altATeamTotalLines[key]; Markets awayTotallineAlt = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectInsideLimitsWithNonZeroTarget(s, "ATTL")) }; if (awayTotallineAlt.MarketList.Count > 0) { Markets activeMarkets = SetMarketActiveNew(awayTotallineAlt, true, gameState); SendOddsMessage(activeMarkets, gameId, formattedMarketList, eventName); Market market3 = awayTotallineAlt.MarketList.OrderBy(v => v.Weight).First(); if (market3 != null) { cAwayTotal = true; int id2 = _aTeamTotalLines[key]; market3.Active = CheckActive(period, gameState, true); Markets awayTotalline = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; awayTotalline.MarketList.Add(market3); SendOddsMessage(awayTotalline, gameId, formattedMarketList, eventName); } } Markets awayTotallineAltInactive = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectOutsideLimitsWithNonZeroTarget(s, "ATTL")) }; if (awayTotallineAltInactive.MarketList.Count > 0 && awayTotallineAlt.MarketList.Count == 0) { SendOddsMessage2(SetMarketInactive(awayTotallineAltInactive), gameId, eventName); Market market3 = awayTotallineAltInactive.MarketList.OrderBy(v => v.Weight).First(); if (market3 != null) { int id2 = _aTeamTotalLines[key]; market3.Active = false; Markets awayTotalline = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; awayTotalline.MarketList.Add(market3); if (!cAwayTotal) { SendOddsMessage2(awayTotalline, gameId, eventName); } } } //------------------------------------------------------------------------ id = _altHTeamTotalLines[key]; Markets homeTotallineAlt = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectInsideLimitsWithNonZeroTarget(s, "HTTL")) }; if (homeTotallineAlt.MarketList.Count > 0) { Markets activeMarkets = SetMarketActiveNew(homeTotallineAlt, true, gameState); SendOddsMessage(activeMarkets, gameId, formattedMarketList, eventName); Market market4 = homeTotallineAlt.MarketList.OrderBy(v => v.Weight).First(); if (market4 != null) { cHomeTotal = true; int id2 = _hTeamTotalLines[key]; market4.Active = CheckActive(period, gameState, true); Markets homeTotalline = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; homeTotalline.MarketList.Add(market4); SendOddsMessage(homeTotalline, gameId, formattedMarketList, eventName); } } //inactive Markets homeTotallineAltInactive = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectOutsideLimitsWithNonZeroTarget(s, "HTTL")) }; if (homeTotallineAltInactive.MarketList.Count > 0 && homeTotallineAlt.MarketList.Count == 0) { SendOddsMessage2(SetMarketInactive(homeTotallineAltInactive), gameId, eventName); Market market4 = homeTotallineAltInactive.MarketList.OrderBy(v => v.Weight).First(); if (market4 != null) { int id2 = _hTeamTotalLines[key]; market4.Active = false; Markets homeTotalline = new Markets { Game = gameId.ToString(), Period = period, Id = id2, Name = _marketList[id2] }; homeTotalline.MarketList.Add(market4); if (!cHomeTotal) { SendOddsMessage2(homeTotalline, gameId, eventName); } } } //------------------------to do send center line----------------------------------------------- id = _totalLines3W[key]; Markets totalline3W = new Markets { Game = gameId.ToString(), Period = period, Id = _totalLines3W[key], Name = _marketList[id], MarketList = marketList.FindAll(s => SelectInsideLimitsWithNonZeroTarget(s, "TL3W")) }; if (totalline3W.MarketList.Count > 0) { Markets activeMarkets = SetMarketActiveNew(totalline3W, true, gameState); SendOddsMessage(activeMarkets, gameId, formattedMarketList, eventName); } Markets totalline3WInactive = new Markets { Game = gameId.ToString(), Period = period, Id = _totalLines3W[key], Name = _marketList[id], MarketList = marketList.FindAll(s => SelectOutsideLimitsWithNonZeroTarget(s, "TL3W")) }; if (totalline3WInactive.MarketList.Count > 0) { SendOddsMessage2(SetMarketInactive(totalline3WInactive), gameId, eventName); } //------------------------------------------------------------------------ id = _altRunLines3W[key]; Markets handicap3W = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectInsideLimitsWithoutTarget(s, "SP3W")) }; if (handicap3W.MarketList.Count > 0) { Markets activeMarkets = SetMarketActiveNew(handicap3W, true, gameState); SendOddsMessage(activeMarkets, gameId, formattedMarketList, eventName); } Markets handicap3WInactive = new Markets { Game = gameId.ToString(), Period = period, Id = id, Name = _marketList[id], MarketList = marketList.FindAll(s => SelectOutsideLimitsWithoutTarget(s, "SP3W")) }; if (handicap3WInactive.MarketList.Count > 0 && handicap3W.MarketList.Count == 0) { SendOddsMessage2(SetMarketInactive(handicap3WInactive), gameId, eventName); } } FormattedGame formattedGame = new FormattedGame { Id = gameId.ToString(), Match = match, MarketList = formattedMarketList }; string formattedGameJsonString = JsonConvert.SerializeObject(formattedGame); _datastore.AddFinishedOdds(gameId, formattedGameJsonString); }
public async Task <RateResponse> GetRate([Required] Market market, [Required] Pair pair, [Required] DateTime dateTimeUtc) { return(await GetRateResponse(pair, Market.Lykke, dateTimeUtc)); }
public async Task <HaasonlineClientResponse <JObject> > NewBot(EnumCustomBotType botType, string name, string accountGuid, Market market) { return(await NewBot <JObject>(botType, name, accountGuid, market.PrimaryCurrency, market.SecondaryCurrency, market.ContractName)); }
public void Setup() { GameObject gameGameObject = Object.Instantiate(UnityEngine.Resources.Load <GameObject>("Prefabs/Market")); marketscript = gameGameObject.GetComponent <Market>(); }
public static void Example() { Market a = new Market { ElasticityOfDemand = -1.0, ElasticityOfSubstitution = 4.0, ElasticityOfSupply = 5.0, InitialMarketShare = 1.0, MarketShare = 1.0, InitialPrice = 1.0, Shock = 0.0, }; Market b = new Market { ElasticityOfDemand = -1.0, ElasticityOfSubstitution = 4.0, ElasticityOfSupply = 5.0, InitialMarketShare = 0.5, MarketShare = 0.5, InitialPrice = 1.0, Shock = 0.05, DownstreamMarkets = new Market[] { a } }; Market c = new Market { ElasticityOfDemand = -1.0, ElasticityOfSubstitution = 4.0, ElasticityOfSupply = 5.0, InitialMarketShare = 0.5, MarketShare = 0.5, InitialPrice = 1.0, Shock = 0.05, DownstreamMarkets = new Market[] { a } }; a.UpstreamMarkets = new Market[] { b, c }; // Create the objective function. double ObjectiveFunction(double[] x) { a.SetConsumerPrice(x); a.CalculateMarketShares(); a.CalculateMarketEquilibrium(); return(a.SumOfSquaresMinimizer); } // Set up the simplex solver. Simplex simplex = new Simplex( objectiveFunction: ObjectiveFunction, lowerBound: 0, upperBound: 10, dimensions: 2, iterations: 50000, seed: 0, textWriter: Console.Out ); // Find the minimum solution. Solution solution = simplex.Minimize(); a.SetConsumerPrice(solution.Vector); a.CalculateMarketShares(); a.CalculateMarketEquilibrium(); // Print the results PrintResults(a, solution); }
/// <summary> /// Default constructor for Serialization purposes /// </summary> public SimplePropertyRateCurve(Market mkt) { _wrapped = mkt; }