示例#1
0
    public static bool getCandles(string timeGraph = "5m", bool partial = false, bool initial = true)
    {
        try
        {
            if (!initial && useWebSockets)
            {
                Console.Title = DateTime.Now.ToString() + " - " + pair + " - $ " + arrayPriceClose[timeGraph][499].ToString() + " v" + version + " - " + bitmexDomain + " | " + tendencyMarket + "| operation " + operation;
                return(true);
            }

            arrayPriceClose[timeGraph] = new double[sizeArrayCandles];
            //arrayPriceClose = new double[sizeArrayCandles];
            arrayPriceHigh[timeGraph]   = new double[sizeArrayCandles];
            arrayPriceLow[timeGraph]    = new double[sizeArrayCandles];
            arrayPriceVolume[timeGraph] = new double[sizeArrayCandles];
            arrayPriceOpen[timeGraph]   = new double[sizeArrayCandles];
            arrayDate = new DateTime[sizeArrayCandles];
            List <BitMEX.Candle> lstCandle = bitMEXApi.GetCandleHistory(pair, sizeArrayCandles, timeGraph, partial);
            int i = 0;
            foreach (var candle in lstCandle)
            {
                arrayPriceClose[timeGraph][i]  = (double)candle.close;
                arrayPriceHigh[timeGraph][i]   = (double)candle.high;
                arrayPriceLow[timeGraph][i]    = (double)candle.low;
                arrayPriceVolume[timeGraph][i] = (double)candle.volume;
                arrayPriceOpen[timeGraph][i]   = (double)candle.open;
                arrayDate[i] = (DateTime)candle.TimeStamp;
                i++;
            }

            Array.Reverse(arrayPriceClose[timeGraph]);
            Array.Reverse(arrayPriceHigh[timeGraph]);
            Array.Reverse(arrayPriceLow[timeGraph]);
            Array.Reverse(arrayPriceVolume[timeGraph]);
            Array.Reverse(arrayPriceOpen[timeGraph]);
            Array.Reverse(arrayDate);


            Console.Title = DateTime.Now.ToString() + " - " + pair + " - $ " + arrayPriceClose[timeGraph][499].ToString() + " v" + version + " - " + bitmexDomain + " | " + tendencyMarket + "| operation " + operation;
            return(true);
        }
        catch (Exception ex)
        {
            log("GETCANDLES::" + ex.Message + ex.StackTrace, ConsoleColor.White, "error");
            //log("wait " + intervalOrder + "ms");
            //Thread.Sleep(intervalOrder);
            return(false);
        }
    }
示例#2
0
    static bool getCandles()
    {
        try
        {
            arrayPriceClose  = new double[sizeArrayCandles];
            arrayPriceHigh   = new double[sizeArrayCandles];
            arrayPriceLow    = new double[sizeArrayCandles];
            arrayPriceVolume = new double[sizeArrayCandles];
            arrayPriceOpen   = new double[sizeArrayCandles];
            arrayDate        = new DateTime[sizeArrayCandles];
            List <BitMEX.Candle> lstCandle = bitMEXApi.GetCandleHistory(pair, sizeArrayCandles, timeGraph);
            int i = 0;
            foreach (var candle in lstCandle)
            {
                arrayPriceClose[i]  = (double)candle.close;
                arrayPriceHigh[i]   = (double)candle.high;
                arrayPriceLow[i]    = (double)candle.low;
                arrayPriceVolume[i] = (double)candle.volume;
                arrayPriceOpen[i]   = (double)candle.open;
                arrayDate[i]        = (DateTime)candle.TimeStamp;
                i++;
            }

            Array.Reverse(arrayPriceClose);
            Array.Reverse(arrayPriceHigh);
            Array.Reverse(arrayPriceLow);
            Array.Reverse(arrayPriceVolume);
            Array.Reverse(arrayPriceOpen);
            Array.Reverse(arrayDate);


            Console.Title = DateTime.Now.ToString() + " - " + pair + " - $ " + arrayPriceClose[99].ToString() + " v" + version + " - " + bitmexDomain + " | " + tendencyMarket + "| operation " + operation;
            return(true);
        }
        catch (Exception ex)
        {
            log("GETCANDLES::" + ex.Message + ex.StackTrace);
            //log("wait " + intervalOrder + "ms");
            //Thread.Sleep(intervalOrder);
            return(false);
        }
    }
示例#3
0
    static bool getCandles()
    {
        try
        {
            arrayPriceClose  = new double[100];
            arrayPriceHigh   = new double[100];
            arrayPriceLow    = new double[100];
            arrayPriceVolume = new double[100];
            arrayPriceOpen   = new double[100];
            List <BitMEX.Candle> lstCandle = bitMEXApi.GetCandleHistory(pair, 100, timeGraph);
            int i = 0;
            foreach (var candle in lstCandle)
            {
                arrayPriceClose[i]  = (double)candle.Close;
                arrayPriceHigh[i]   = (double)candle.High;
                arrayPriceLow[i]    = (double)candle.Low;
                arrayPriceVolume[i] = (double)candle.Volume;
                arrayPriceOpen[i]   = (double)candle.Open;
                i++;
            }
            Array.Reverse(arrayPriceClose);
            Array.Reverse(arrayPriceHigh);
            Array.Reverse(arrayPriceLow);
            Array.Reverse(arrayPriceVolume);
            Array.Reverse(arrayPriceOpen);



            Console.Title = DateTime.Now.ToString() + " - " + pair + " - $ " + arrayPriceClose[99].ToString() + " v" + version + " - " + bitmexDomain + " | Price buy " + getPriceActual("Buy") + " | Price Sell " + getPriceActual("Sell") + " | " + tendencyMarket + "| Roe " + roe;
            return(true);
        }
        catch (Exception ex)
        {
            log("GETCANDLES::" + ex.Message + ex.StackTrace);
            //log("wait " + intervalOrder + "ms");
            //Thread.Sleep(intervalOrder);
            return(false);
        }
    }