/// <summary>
        /// Gets the new <see cref="IMarket"/> instance
        /// </summary>
        /// <param name="sportEvent">A <see cref="ISportEvent"/> representing the sport event associated with the generated message</param>
        /// <param name="market">The <see cref="market"/> instance used</param>
        /// <param name = "producerId" > A producerId of the<see cref="ISportEvent"/></param>
        /// <param name="sportId">A sportId of the <see cref="ISportEvent"/></param>
        /// <param name="cultures">The list of cultures that should be prefetched</param>
        /// <returns>Returns the new <see cref="IMarket"/> instance</returns>
        protected virtual IMarketCancel GetMarketCancel(ISportEvent sportEvent, market market, int producerId, URN sportId, IEnumerable <CultureInfo> cultures)
        {
            Contract.Requires(sportEvent != null);
            Contract.Requires(market != null);
            Contract.Ensures(Contract.Result <IMarket>() != null);


            var specifiers = string.IsNullOrEmpty(market.specifiers)
                ? null
                : FeedMapperHelper.GetSpecifiers(market.specifiers);

            var additionalInfo = string.IsNullOrEmpty(market.extended_specifiers)
                ? null
                : FeedMapperHelper.GetSpecifiers(market.extended_specifiers);

            var producer = _producerManager.Get(producerId);

            var cultureInfos = cultures.ToList();

            return(new MarketCancel(market.id,
                                    specifiers,
                                    additionalInfo,
                                    _nameProviderFactory.BuildNameProvider(sportEvent, market.id, specifiers),
                                    _mappingProviderFactory.BuildMarketMappingProvider(sportEvent, market.id, specifiers, _producerManager.Get(producerId), sportId),
                                    BuildMarketDefinition(market.id, sportId, producer, specifiers, cultureInfos),
                                    market.void_reasonSpecified ? market.void_reason : (int?)null,
                                    _voidReasonCache,
                                    cultureInfos));
        }
        /// <summary>
        /// Gets the new <see cref="IMarket"/> instance
        /// </summary>
        /// <param name="sportEvent">A <see cref="ISportEvent"/> representing the sport event associated with the generated message</param>
        /// <param name="market">The <see cref="market"/> instance used</param>
        /// <param name = "producerId" > A producerId of the<see cref="ISportEvent"/></param>
        /// <param name="sportId">A sportId of the <see cref="ISportEvent"/></param>
        /// <param name="cultures">The list of cultures that should be prefetched</param>
        /// <returns>Returns the new <see cref="IMarket"/> instance</returns>
        protected virtual IMarketCancel GetMarketCancel(ISportEvent sportEvent, market market, int producerId, URN sportId, IEnumerable <CultureInfo> cultures)
        {
            Guard.Argument(sportEvent, nameof(sportEvent)).NotNull();
            Guard.Argument(market, nameof(market)).NotNull();

            var cultureInfos = cultures.ToList();

            var specifiers = string.IsNullOrEmpty(market.specifiers)
                ? null
                : FeedMapperHelper.GetSpecifiers(market.specifiers);

            var additionalInfo = string.IsNullOrEmpty(market.extended_specifiers)
                ? null
                : FeedMapperHelper.GetSpecifiers(market.extended_specifiers);

            var marketDefinition = new MarketDefinition(market.id, _marketCacheProvider, sportId, producerId, specifiers, cultureInfos, _externalExceptionStrategy);

            return(new MarketCancel(market.id,
                                    specifiers,
                                    additionalInfo,
                                    _nameProviderFactory.BuildNameProvider(sportEvent, market.id, specifiers),
                                    _mappingProviderFactory.BuildMarketMappingProvider(sportEvent, market.id, specifiers, producerId, sportId),
                                    marketDefinition,
                                    market.void_reasonSpecified ? market.void_reason : (int?)null,
                                    _voidReasonCache,
                                    cultureInfos));
        }
示例#3
0
    // Update is called once per frame
    void FixedUpdate()
    {
        market marketsatinalma = GameObject.FindWithTag("market").GetComponent <market>();

        bag = GameObject.FindWithTag("poset");

        spawnlancakacid  = marketsatinalma.spawnolcakacid;
        spawnlancakpills = marketsatinalma.spawnolcakpills;

        if (acildi)
        {
            for (int x = 0; x < spawnlancakacid; x++)

            {
                Instantiate(acid, bag.transform.position, Quaternion.identity);
            }

            for (int x = 0; x < spawnlancakpills; x++)

            {
                Instantiate(pills, bag.transform.position, Quaternion.identity);
            }

            marketsatinalma.spawnolcakacid  = 0;
            marketsatinalma.spawnolcakpills = 0;

            GameObject.Destroy(bag);
        }
    }
示例#4
0
        public static List <hb_market> getSymbolsList(string type, string time)
        {
            using (huobiEntities hbdb = new huobiEntities())
            {
                DateTime time1 = DateTime.Parse(time);

                var st  = time1.Date;
                var st2 = st.AddDays(1);

                double rate = CommonData.getUSRMBrate();

                List <market> m_s = null;


                if (type == "all")
                {
                    var m = hbdb.market.Where(a => (a.last_time >= st && a.last_time < st2)).OrderByDescending(a => a.rose);

                    m_s = m.ToList();
                }
                else
                {
                    var m = hbdb.market.Where(a => (a.token_type == type && a.last_time >= st && a.last_time < st2)).OrderByDescending(a => a.rose);

                    m_s = m.ToList();
                }

                market m_btc = hbdb.market.FirstOrDefault(a => (a.coin_type == "btc" && a.token_type == "usdt" && a.last_time >= st && a.last_time < st2));

                market m_eth = hbdb.market.FirstOrDefault(a => (a.coin_type == "eth" && a.token_type == "usdt" && a.last_time >= st && a.last_time < st2));

                List <hb_market> markets = new List <hb_market>();

                //AutoMapper自动映射


                foreach (var item in m_s)
                {
                    hb_market hb_m = Mapper.Map <market, hb_market>(item);

                    if (item.token_type == "usdt")
                    {
                        hb_m.rate = rate;
                    }
                    else if (item.token_type == "btc")
                    {
                        hb_m.rate = m_btc.close_price * rate;
                    }
                    else if (item.token_type == "eth")
                    {
                        hb_m.rate = m_eth.close_price * rate;
                    }

                    markets.Add(hb_m);
                }

                return(markets);
            }
        }
        public void RunTest()
        {
            //var markets = _predictItContext.markets
            //                               .Include(m => m.contracts)
            //                               .ThenInclude(c => c.contract_prices).ToList();

            //foreach (var market in markets)
            //{
            //    Debug.WriteLine($"market:{market.name}");
            //    foreach (var contract in market.contracts)
            //    {
            //        Debug.WriteLine($"contract:{contract.name}");
            //        foreach (var price in contract.contract_prices)
            //        {
            //            Debug.WriteLine($"Price:{price.time_stamp} - {price.best_sell_yes_cost}");
            //        }
            //    }
            //}

            var myMarket = new market()
            {
                market_id   = 123,
                name        = "Who will win the presidency",
                url         = "www.yourmom.com",
                short_name  = "Who!?!",
                create_date = DateTime.Now,
                contracts   = new List <contract>
                {
                    new contract()
                    {
                        market_id       = 123,
                        contract_id     = 234,
                        name            = "Joe Biden",
                        short_name      = "Joe",
                        create_date     = DateTime.Now,
                        contract_prices = new List <contract_price>()
                        {
                            new contract_price()
                            {
                                contract_id      = 234,
                                time_stamp       = DateTime.Now,
                                last_trade_price = 0.4M,
                                best_buy_no_cost = 0.3M,
                            },
                        }
                    }
                },
            };

            _predictItContext.markets.Add(myMarket);
            var x = _predictItContext.SaveChanges();
        }
 public bool AddMarket(market market)
 {
     try
     {
         _logger.Information($"Adding new market:{market.name}-{market.market_id}");
         _predictItContext.markets.Add(market);
         return(_predictItContext.SaveChanges() > 0);
     }
     catch (Exception e)
     {
         _logger.Error(e, $"Error Adding new market:{market?.name}-{market?.market_id}");
         return(false);
     }
 }
示例#7
0
    void FixedUpdate()
    {
        playerCam = Camera.main;
        Ray        playerAim = playerCam.GetComponent <Camera>().ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hit;

        if (Physics.Raycast(playerAim, out hit, mesafe))
        {
            if (Input.GetMouseButton(0) && hit.collider.gameObject.tag != "tasinamayan" && beingCarried == false) // TERRAİNİ TAŞIYON DÜZELT
            {
                tekdondur = hit.collider.gameObject;                                                              // OBJELERİ AYRI AYRI TUTMA KODU


                tekdondur.GetComponent <Rigidbody>().isKinematic = true;
                tekdondur.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
                tekdondur.transform.parent = Kamera; //AYRI TUTMA KODUNA BUDA DAHİL
                                                     //tekdondur.transform.SetParent(Kamera);

                beingCarried = true;
            }


            if (Input.GetKeyDown(KeyCode.F) && hit.collider.transform == araba && aracsur == false)
            {
                Debug.Log("oldu");

                aracsur = true;
                player.transform.parent   = Seat;
                player.transform.position = Seat.transform.position;

                player.GetComponent <Rigidbody>().isKinematic = true;
                player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;

                araba.GetComponent <SimpleCarController>().enabled = true;
            }



            canta = GameObject.FindWithTag("poset");
            market marketsatinalma = GameObject.FindWithTag("market").GetComponent <market>();

            if (hit.collider.gameObject.tag == "acidmarket")
            {
                if (Input.GetKeyDown(KeyCode.F))
                {
                    Debug.Log("market calisiyor");



                    marketsatinalma.alincakacid    += 1;
                    marketsatinalma.spawnolcakacid += 1;
                    marketsatinalma.alisveristutar += 10;
                }
            }

            if (Input.GetKeyDown(KeyCode.F) && hit.collider.gameObject.tag == "pilsmarket")
            {
                Debug.Log("market calisiyor");



                marketsatinalma.alincakpills    += 1;
                marketsatinalma.spawnolcakpills += 1;
                marketsatinalma.alisveristutar  += 20;
            }

            if (Input.GetKeyDown(KeyCode.F) && hit.collider.gameObject.tag == "market")
            {
                Debug.Log("satin alindi");



                canparavb paraeksilt = GetComponent <canparavb>();



                paraeksilt.para -= marketsatinalma.alisveristutar;


                Instantiate(marketsatinalma.poset, posetyeri.transform.position, Quaternion.identity);



                marketsatinalma.alincakpills   = 0;
                marketsatinalma.alincakacid    = 0;
                marketsatinalma.alisveristutar = 0;
            }


            if (Input.GetKeyDown(KeyCode.F) && hit.collider.gameObject.tag == "poset")
            {
                poset deneme = GameObject.FindWithTag("poset").GetComponent <poset>();

                Debug.Log("poset acilimi gönderildi");


                deneme.acildi = true;
            }
        }

        if (aracsur)
        {
            if (Input.GetKeyDown(KeyCode.G))
            {
                araba.GetComponent <SimpleCarController>().enabled = false;

                aracsur = false;
                player.transform.parent   = null;
                player.transform.position = Unseat.transform.position;
                player.GetComponent <Rigidbody>().isKinematic = false;
                player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
            }
        }

        if (araba.GetComponent <SimpleCarController>().enabled == false)
        {
            araba.GetComponent <Rigidbody>().isKinematic = true;
            araba.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ;
        }

        if (araba.GetComponent <SimpleCarController>().enabled == true)
        {
            araba.GetComponent <Rigidbody>().isKinematic = false;
            araba.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
        }



        if (beingCarried)
        {
            //tekdondur = Kamera.transform.GetChild(0).gameObject;  //TEK DÖNDÜRMEYE KODU - GETCHİLD HATASI VEREN KOD

            if (tekdondur == null)
            {
                beingCarried = false;
            }



            if (Input.GetAxis("Mouse ScrollWheel") > 0f)
            {
                tekdondur.transform.Rotate(Camera.main.transform.right, smooth * Time.deltaTime, Space.World);
            }
            if (Input.GetAxis("Mouse ScrollWheel") < 0f)
            {
                tekdondur.transform.Rotate(-Camera.main.transform.right, smooth * Time.deltaTime, Space.World);
                //kameranın baktığı yönde döndürme tekdondur. olmadanki hali
            }

            if (Input.GetMouseButton(1))
            {
                beingCarried = false;

                tekdondur.GetComponent <Rigidbody>().isKinematic = false;
                tekdondur.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;

                tekdondur.transform.parent = null;

                tekdondur = null;
            }
        }



        //if (Input.GetMouseButtonDown(0))
        //{
        //  GetComponent<Rigidbody>().isKinematic = false;
        //transform.parent = null;
        //beingCarried = false;
        //GetComponent<Rigidbody>().AddForce(playerCam.forward * throwForce);
        //}
    }
示例#8
0
        private static void SendBackMsg()
        {
            //   huobiEntities hbdb = new huobiEntities();

            DateTime time1 = new DateTime();

            List <hb_symbols> symbols = null;

            int count = 150;

            Log.error("测试日志");

            while (true)
            {
                //半小时取一次所有交易对

                try
                {
                    DateTime time2 = DateTime.Now;

                    if ((time2 - time1).TotalMinutes > 30)
                    {
                        symbols = server.getAllSymbol();
                        time1   = time2;
                    }

                    if (symbols != null)
                    {
                        //去取数据
                        using (huobiEntities hbdb = new huobiEntities())
                        {
                            foreach (var item in symbols)
                            {
                                if (item.symbol_partition == "main" || item.symbol_partition == "innovation")
                                {
                                    string symbol = item.base_currency + item.quote_currency;

                                    List <hb_kline> data = server.getKLine(symbol, "1day", count);

                                    //存数据库....
                                    DateTime time3 = DateTime.Now;

                                    DateTime time4 = time3.Date.AddHours(23).AddMinutes(59);

                                    if (data != null && data.Count > 0)
                                    {
                                        for (var i = 0; i < data.Count; i++)
                                        {
                                            hb_kline linedata = data[i];

                                            DateTime temptime  = time4.AddDays(-i).Date;
                                            DateTime temptime2 = temptime.Date.AddDays(1);

                                            market m = hbdb.market.FirstOrDefault(a => (a.symbols == symbol && a.last_time >= temptime && a.last_time < temptime2));

                                            if (m == null)
                                            {
                                                m = new market();

                                                m.symbols     = symbol;
                                                m.coin_type   = item.base_currency;
                                                m.token_type  = item.quote_currency;
                                                m.open_price  = linedata.open;
                                                m.close_price = linedata.close;
                                                m.rose        = m.open_price != 0 ? (m.close_price - m.open_price) / m.open_price : 0;
                                                m.turnover    = 0;
                                                m.last_time   = i == 0 ? time3 : time4.AddDays(-i);

                                                hbdb.market.Add(m);
                                            }
                                            else
                                            {
                                                m.open_price  = linedata.open;
                                                m.close_price = linedata.close;
                                                m.rose        = m.open_price != 0 ? (m.close_price - m.open_price) / m.open_price : 0;
                                                m.turnover    = 0;
                                                m.last_time   = i == 0 ? time3 : time4.AddDays(-i);

                                                hbdb.Entry(m).State = EntityState.Modified;
                                            }
                                        }

                                        hbdb.SaveChanges();

                                        Thread.Sleep(100);
                                    }
                                }
                            }
                        }
                        count = 1;
                    }
                }
                catch (Exception ex)
                {
                    Log.error(ex);
                }

                Thread.Sleep(5000);
            }
        }