Ejemplo n.º 1
0
 public override void OnInit(ChartRoot chart, ChartNote note)
 {
     base.OnInit(chart, note);
     Fill.sortingOrder            = Ring.sortingOrder + 1;
     SpriteMask.frontSortingOrder = note.id + 1;
     SpriteMask.backSortingOrder  = note.id - 2;
 }
Ejemplo n.º 2
0
        /****
        * Calls the IEX stock API to get 1 year's chart for the supplied symbol.
        ****/
        public List <Equity> GetChart(string symbol)
        {
            //Using the format method.
            //string IEXTrading_API_PATH = BASE_URL + "stock/{0}/batch?types=chart&range=1y";
            //IEXTrading_API_PATH = string.Format(IEXTrading_API_PATH, symbol);

            string IEXTrading_API_PATH = BASE_URL + "stock/" + symbol + "/batch?types=chart&range=1y";

            string        charts   = "";
            List <Equity> Equities = new List <Equity>();

            httpClient.BaseAddress = new Uri(IEXTrading_API_PATH);
            HttpResponseMessage response = httpClient.GetAsync(IEXTrading_API_PATH).GetAwaiter().GetResult();

            if (response.IsSuccessStatusCode)
            {
                charts = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            }
            if (!charts.Equals(""))
            {
                ChartRoot root = JsonConvert.DeserializeObject <ChartRoot>(charts, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                Equities = root.chart.ToList();
            }
            //make sure to add the symbol the chart
            foreach (Equity Equity in Equities)
            {
                Equity.symbol = symbol;
            }

            return(Equities);
        }
        /****
        * Calls the IEX stock API to get one year's chart for the supplied symbol.
        ****/
        public List <Equity> GetList(string symbol)
        {
            string APIPath = url + "stock/" + symbol + "/batch?types=chart&range=1y";

            string        list     = "";
            List <Equity> Equities = new List <Equity>();

            client.BaseAddress = new Uri(APIPath);
            HttpResponseMessage ResponseMsg = client.GetAsync(APIPath).GetAwaiter().GetResult();

            if (ResponseMsg.IsSuccessStatusCode)
            {
                list = ResponseMsg.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            }
            if (!list.Equals(""))
            {
                ChartRoot root = JsonConvert.DeserializeObject <ChartRoot>(list, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                Equities = root.chart.ToList();
            }
            foreach (Equity Equity in Equities)
            {
                Equity.symbol = symbol;
            }

            return(Equities);
        }
Ejemplo n.º 4
0
        /****
        * Calls the IEX stock API to get 1 year's chart for the supplied symbol.
        ****/
        public List <Stock> GetChart(string symbol, string range)
        {
            // Using the format method.
            // string TradingApp_API_PATH = BASE_URL + "stock/{0}/batch?types=chart&range=1y";
            // TradingApp_API_PATH = string.Format(TradingApp_API_PATH, symbol);

            string TradingApp_API_PATH = BASE_URL + "stock/" + Uri.EscapeDataString(symbol) + "/batch?types=chart&range=" + Uri.EscapeDataString(range);

            string       charts = "";
            List <Stock> Stocks = new List <Stock>();

            httpClient.BaseAddress = new Uri(TradingApp_API_PATH);
            HttpResponseMessage response = httpClient.GetAsync(TradingApp_API_PATH).GetAwaiter().GetResult();

            if (response.IsSuccessStatusCode)
            {
                charts = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            }
            if (!charts.Equals(""))
            {
                ChartRoot root = JsonConvert.DeserializeObject <ChartRoot>(charts, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                Stocks = root.chart.ToList();
            }
            //make sure to add the symbol the chart
            foreach (Stock Stock in Stocks)
            {
                Stock.symbol = symbol;
            }

            return(Stocks);
        }
Ejemplo n.º 5
0
        public List <Stock> GetTimeSeries(string symbol)
        {
            string TradingApp_API_PATH = BASE_URL + "stock/" + symbol + "/batch?types=chart&range=1m";

            string       charts = "";
            List <Stock> Stocks = new List <Stock>();

            httpClient.BaseAddress = new Uri(TradingApp_API_PATH);
            HttpResponseMessage response = httpClient.GetAsync(TradingApp_API_PATH).GetAwaiter().GetResult();

            if (response.IsSuccessStatusCode)
            {
                charts = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            }
            if (!charts.Equals(""))
            {
                ChartRoot root = JsonConvert.DeserializeObject <ChartRoot>(charts, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                Stocks = root.chart.TakeLast(5).ToList();
            }
            //make sure to add the symbol the chart
            foreach (Stock Stock in Stocks)
            {
                Stock.symbol = symbol;
            }
            return(Stocks);
        }
Ejemplo n.º 6
0
        public override void OnInit(ChartRoot chart, ChartNote note)
        {
            Size = SimpleVisualOptions.Instance.GetSize(this);

            Ring.sortingOrder = (chart.note_list.Count - note.id) * 3;
            Fill.sortingOrder = Ring.sortingOrder - 1;
        }
Ejemplo n.º 7
0
        GreatGradeWeight; // For ranked mode: weighted difference between the current timing and the perfect timing

    public void Init(ChartRoot chart, ChartNote note)
    {
        Chart = chart;
        Note  = note;

        Page             = Chart.page_list[Note.page_index];
        TimeUntilStart   = Note.start_time;
        TimeUntilEnd     = Note.end_time;
        MaxMissThreshold = Mathf.Max(0.300f, 0.300f); // TODO: 0.300f?
        View.OnInit(chart, note);
        gameObject.transform.position = Note.position;

        if (Game.Play.IsRanked)
        {
            RankData    = new RankedPlayData.Note();
            RankData.id = note.id;
            // Game.RankedPlayData.notes.Add(RankData); // Removed in 1.5
        }
    }
Ejemplo n.º 8
0
        public List <Equity> GetChart2(string symbol) //this method is used to handle two simultaneous requests for a same API End Point
        {
            // string to specify information to be retrieved from the API
            string IEXTrading_API_PATH2 = BASE_URL + "stock/" + symbol + "/batch?types=chart&range=3m";

            // initialize objects needed to gather data
            string        charts   = "";
            List <Equity> Equities = new List <Equity>();

            httpClient2.BaseAddress = new Uri(IEXTrading_API_PATH2);

            // connect to the API and obtain the response
            HttpResponseMessage response = httpClient.GetAsync(IEXTrading_API_PATH2).GetAwaiter().GetResult();

            // now, obtain the Json objects in the response as a string
            if (response.IsSuccessStatusCode)
            {
                charts = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                //charts.GetType();
            }

            // parse the string into appropriate objects
            if (!charts.Equals(""))
            {
                ChartRoot root = JsonConvert.DeserializeObject <ChartRoot>(charts,
                                                                           new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                Equities = root.chart.ToList();
            }

            // fix the relations. By default the quotes do not have the company symbol
            //  this symbol serves as the foreign key in the database and connects the quote to the company
            foreach (Equity Equity in Equities)
            {
                Equity.symbol = symbol;
            }

            return(Equities);
        }
Ejemplo n.º 9
0
        public List <Equity> GetChart(string symbol)
        {
            string IEXTrading_API_PATH = BASE_URL + "stock/" + symbol + "/batch?types=chart&range=1y";


            string        charts   = "";
            List <Equity> Equities = new List <Equity>();

            httpClient.BaseAddress = new Uri(IEXTrading_API_PATH);

            // connect to the API and obtain the response
            HttpResponseMessage response = httpClient.GetAsync(IEXTrading_API_PATH).GetAwaiter().GetResult();

            // now, obtain the Json objects in the response as a string
            if (response.IsSuccessStatusCode)
            {
                charts = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            }

            // parse the string into appropriate objects
            if (!charts.Equals(""))
            {
                ChartRoot root = JsonConvert.DeserializeObject <ChartRoot>(charts,
                                                                           new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
                Equities = root.chart.ToList();
            }

            // fix the relations. By default the quotes do not have the company symbol
            //  this symbol serves as the foreign key in the database and connects the quote to the company
            foreach (Equity Equity in Equities)
            {
                Equity.symbol = symbol;
            }

            return(Equities);
        }
Ejemplo n.º 10
0
 public virtual void OnInit(ChartRoot chart, ChartNote note)
 {
 }
Ejemplo n.º 11
0
 public override void OnInit(ChartRoot chart, ChartNote note)
 {
     base.OnInit(chart, note);
     Triangle.Note    = note;
     TicksUntilHoldFx = MaxTicksBetweenHoldFx;
 }