static void Main(string[] args) { // The pair we will work on string pair = "XXBTZEUR"; SendingRateManager SRM = new SendingRateManager(); KrakenClient.KrakenClient client = new KrakenClient.KrakenClient(); //string result = client.CancelOrder("O3V2NP-DTB7Z-EEKGIC").ToString(); //Console.WriteLine(result); //Console.ReadKey(); KrakenService.Recorder rec1 = new KrakenService.Recorder(pair,SRM); KrakenService.Analysier ana1 = new KrakenService.Analysier(rec1); KrakenService.Player play1 = new Player(ana1, rec1.Pair,SRM); int i = 0; while(i < 40) { Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; HTMLUpdate("DateTime", unixTimestamp.ToString()); HTMLUpdate("LastPrice", ana1.LastPrice.ToString()); HTMLUpdate("LastMiddleQuote", ana1.LastMiddleQuote.ToString()); HTMLUpdate("LastLowerAsk", ana1.LastLowerAsk.ToString()); HTMLUpdate("LastHigherBid", ana1.LastHigherBid.ToString()); Thread.Sleep(1000); Console.WriteLine("--------------------------------------"); Console.WriteLine("Last Middle Quote:" + ana1.LastMiddleQuote); Console.WriteLine("Last Trade price:" + ana1.LastPrice); Console.WriteLine("Opened order exist : " + ana1.OpenedOrdersExist()); Console.WriteLine("Average : " + ana1.WeightedAverage); Console.WriteLine("Ecart Type : " + ana1.WeightedStandardDeviation); Console.WriteLine("BTC : " + rec1.CurrentBalance.BTC + "; EURO : " + rec1.CurrentBalance.EUR); Console.WriteLine("Sell or buy :" + ana1.SellorBuy().ToString() + " ; Potential Earning: " + ana1.PotentialPercentageOfEarning + " ; minimal earning required: " + ana1.MinimalPercentageOfEarning); i++; } Console.WriteLine("--------------------------------------"); Console.ReadKey(); while(true) { Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; HTMLUpdate("DateTime", unixTimestamp.ToString()); play1.Play(); Console.WriteLine("--------------------------------------"); Console.WriteLine("Player Status :" + play1.playerState); Console.WriteLine("Last Middle Quote:" + ana1.LastMiddleQuote); Console.WriteLine("Last Trade price:" + ana1.LastPrice); Console.WriteLine("Opened order exist : " + ana1.OpenedOrdersExist()); Console.WriteLine("Average : " + ana1.WeightedAverage); Console.WriteLine("Ecart Type : " + ana1.WeightedStandardDeviation); Console.WriteLine("BTC : " + rec1.CurrentBalance.BTC + "; EURO : " + rec1.CurrentBalance.EUR); Console.WriteLine("Sell or buy :" + ana1.SellorBuy().ToString() + " ; Potential Earning: " + ana1.PotentialPercentageOfEarning + " ; minimal earning required: " + ana1.MinimalPercentageOfEarning); Thread.Sleep(1000); } }
public Player(Analysier i_analysier, string i_pair, SendingRateManager srm) { NumberProvider = new NumberFormatInfo(); NumberProvider.CurrencyDecimalSeparator = "."; SRM = srm; analysier = i_analysier; client = new KrakenClient.KrakenClient(); MyOpenedOrders = analysier.MyOpenedOrders; playerState = PlayerState.Pending; }
public Recorder(string i_pair, SendingRateManager srm) { NumberProvider = new NumberFormatInfo(); NumberProvider.CurrencyDecimalSeparator = "."; SRM = srm; CurrentBalance = new Balance(); client = new KrakenClient.KrakenClient(); ListOftradingDatas = new List<TradingData>(); ListOfCurrentOrder = new List<CurrentOrder>(); ListOfOHLCData = new List<OHLCData>(); Pair = i_pair; IntervalInSecond = Convert.ToDouble(ConfigurationManager.AppSettings["IntervalStoredInMemoryInSecond"]); // it is to keep the data in memory from X (inetrval) to now. OrderBookCount = Convert.ToInt16(ConfigurationManager.AppSettings["OrderBookCount"]); OpenedOrders = new List<CurrentOrder>(); // Start recording GetOpenOrders(); RecordBalance(); Task.Run(() => RecordRecentTradeData()); Task.Run(() => RecordOrderBook()); Task.Run(() => RecordOHLCData()); }