Пример #1
0
        public MarketMaker(string configFilename)
        {
            // Read config file
            try
            {
                using (StreamReader sr = new StreamReader(configFilename))
                {
                    config = JSON.Instance.ToObject <MarketMakerConfig>(sr.ReadToEnd());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while reading config file: " + e.ToString());
                return;
            }

            // Create ICBIT exchange object
            icbit = new Icbit(config.icbit.UserId, config.icbit.ApiKey, config.icbit.ApiSecret);
            icbit.OrdersChanged  += new EventHandler(IcbitOrdersChanged);
            icbit.BalanceChanged += new EventHandler(IcbitBalanceChanged);
            icbit.ConnectEvent   += new EventHandler(IcbitConnected);

            // Connect to the ICBIT exchange
            icbit.Connect();
        }
Пример #2
0
        public MarketMaker(string configFilename)
        {
            // Read config file
            try
            {
                using (StreamReader sr = new StreamReader(configFilename))
                {
                    config = JSON.Instance.ToObject<MarketMakerConfig>(sr.ReadToEnd());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while reading config file: " + e.ToString());
                return;
            }

            // Create ICBIT exchange object
            icbit = new Icbit(config.icbit.UserId, config.icbit.ApiKey);
            icbit.OrdersChanged += new EventHandler(IcbitOrdersChanged);
            icbit.BalanceChanged += new EventHandler(IcbitBalanceChanged);
            icbit.ConnectEvent += new EventHandler(IcbitConnected);

            // Connect to the ICBIT exchange
            icbit.Connect();
        }
Пример #3
0
        public MarketMaker(string configFilename)
        {
            // Read config file
            try
            {
                using (StreamReader sr = new StreamReader(configFilename))
                {
                    config = JsonConvert.DeserializeObject <MarketMakerConfig>(sr.ReadToEnd());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while reading config file: " + e.ToString());
                return;
            }

            okcoin = new OKCoin(config.okcoin.ApiKey, config.okcoin.ApiSecret);

            Pusher p = new Pusher();

            p.Open("ws://ws.pusherapp.com/app/de504dc5763aeef9ff52?protocol=5&client=pusher-dotnet-client&version=0.0.1");
            p.Subscribe("order_book");

            // Create ICBIT exchange object
            icbit = new Icbit(config.icbit.UserId, config.icbit.ApiKey, config.icbit.ApiSecret);
            icbit.OrdersChanged  += new EventHandler(IcbitOrdersChanged);
            icbit.BalanceChanged += new EventHandler(IcbitBalanceChanged);
            icbit.ConnectEvent   += new EventHandler(IcbitConnected);

            // Connect to the ICBIT exchange (synchronously)
            icbit.Connect(true);

            updatePricesTimer          = new Timer(1000 * 5); // every 10 seconds
            updatePricesTimer.Elapsed += new ElapsedEventHandler(OnPriceUpdateEvent);
            updatePricesTimer.Start();
        }
Пример #4
0
        public MarketMaker(string configFilename)
        {
            // Read config file
            try
            {
                using (StreamReader sr = new StreamReader(configFilename))
                {
                    config = JsonConvert.DeserializeObject<MarketMakerConfig>(sr.ReadToEnd());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception while reading config file: " + e.ToString());
                return;
            }

            okcoin = new OKCoin(config.okcoin.ApiKey, config.okcoin.ApiSecret);

            Pusher p = new Pusher();
            p.Open("ws://ws.pusherapp.com/app/de504dc5763aeef9ff52?protocol=5&client=pusher-dotnet-client&version=0.0.1");
            p.Subscribe("order_book");

            // Create ICBIT exchange object
            icbit = new Icbit(config.icbit.UserId, config.icbit.ApiKey, config.icbit.ApiSecret);
            icbit.OrdersChanged += new EventHandler(IcbitOrdersChanged);
            icbit.BalanceChanged += new EventHandler(IcbitBalanceChanged);
            icbit.ConnectEvent += new EventHandler(IcbitConnected);

            // Connect to the ICBIT exchange (synchronously)
            icbit.Connect(true);

            updatePricesTimer = new Timer(1000 * 5); // every 10 seconds
            updatePricesTimer.Elapsed += new ElapsedEventHandler(OnPriceUpdateEvent);
            updatePricesTimer.Start();
        }