Ejemplo n.º 1
0
        private static TSList <TradeData> DeserializeTrades(string[] lines)
        {
            if (lines == null)
            {
                return(null);
            }

            TSList <TradeData> tempTrades = new TSList <TradeData>();

            int cnt = int.Parse(lines[0]);

            for (int i = 0; i < cnt; i++)
            {
                string[] vars = new string[7];

                for (int j = 0; j < 7; j++)
                {
                    vars[j] = lines[i * 7 + 1 + j];
                }

                TradeData td = TradeData.Parse(vars);
                tempTrades.Add(td);
            }

            return(tempTrades);
        }
Ejemplo n.º 2
0
        public static void ReportApiCall()
        {
            double sum = 1;
            int    cnt = 1;

            for (int i = calls.Count - 1; i >= 0; i--)
            {
                sum += calls[i];
                cnt++;
            }

            calls.Add((float)(sum / cnt));
        }
Ejemplo n.º 3
0
        public static void ReportBuy(CurrencyPair pair, double amountQuote, double price, long timestamp)
        {
            if (Trades == null)
            {
                Trades = new TSList <TradeData>();
            }

            TradeData tempData = new TradeData(pair, amountQuote, price, timestamp);

            Trades.Add(tempData);

            UpdateTradesGUI();

            SaveData();
        }
Ejemplo n.º 4
0
        public static void ReportSell(CurrencyPair pair, double amountQuote, double price, long timestamp)
        {
            if (Trades == null)
            {
                return;
            }
            if (DoneTrades == null)
            {
                DoneTrades = new TSList <TradeData>();
            }

            for (int i = 0; i < Trades.Count; i++)
            {
                if (Trades[i].pair == pair)
                {
                    DoneTrades.Add(new TradeData(Trades[i], amountQuote, price, timestamp));
                    Trades.RemoveAt(i);
                    UpdateTradesGUI();
                    SaveData();
                    return;
                }
            }
        }