Exemplo n.º 1
0
        public static void Main()
        {
            Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");

            var cryptoApi = new CryptoApi();
            var pair      = "btcusd"; // string | Return the order book bids for the given Crypto Currency Pair. (optional)
            var exchange  = "gemini"; // string | Return the order book bids for a Crypto Currency on the given Crypto Exchange. (optional)
            var currency  = "BTC";    // string | Return the order book bids for the given Crypto Currency. (optional)

            try
            {
                ApiResponseCryptoBookBids result      = cryptoApi.GetCryptoBookBids(pair, exchange, currency);
                List <CryptoBookEntry>    crypto_bids = result.Bids;

                CryptoPairSummary crypto_pair = result.Pair;
                Console.WriteLine("Crypto Currency Pair: " + crypto_pair.Name);

                CryptoExchangeSummary crypto_exchange = result.Exchange;
                Console.WriteLine("Crypto Exchange: " + crypto_exchange.Name);

                Console.WriteLine();
                Console.WriteLine("----------------- BIDS -----------------");

                crypto_bids.ForEach(delegate(CryptoBookEntry bid)
                {
                    Console.WriteLine();
                    Console.WriteLine("Price: " + bid.Price);
                    Console.WriteLine("Size:  " + bid.Size);
                });
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CryptoApi.GetCryptoBookBids: " + e.Message);
            }
        }
        public static void Main()
        {
            Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");

            var cryptoApi = new CryptoApi();
            var levels    = 50;       // int? | The number of prices/levels to return on each side. For example, the max of 50 levels will return up to 50 bid prices and 50 ask prices. (optional)
            var pair      = "btcusd"; // string | Return the order book summary for the given Crypto Currency Pair. (optional)
            var exchange  = "gemini"; // string | Return the order book summary for a Crypto Currency on the given Crypto Exchange. (optional)
            var currency  = "BTC";    // string | Return the order book summary for the given Crypto Currency. (optional)

            try
            {
                ApiResponseCryptoBook  result      = cryptoApi.GetCryptoBookSummary(levels, pair, exchange, currency);
                List <CryptoBookEntry> crypto_bids = result.Bids;
                List <CryptoBookEntry> crypto_asks = result.Asks;

                CryptoPairSummary crypto_pair = result.Pair;
                Console.WriteLine("Crypto Currency Pair: " + crypto_pair.Name);

                CryptoExchangeSummary crypto_exchange = result.Exchange;
                Console.WriteLine("Crypto Exchange: " + crypto_exchange.Name);

                Console.WriteLine();
                Console.WriteLine("----------------- BIDS -----------------");

                crypto_bids.ForEach(delegate(CryptoBookEntry bid)
                {
                    Console.WriteLine();
                    Console.WriteLine("Price: " + bid.Price);
                    Console.WriteLine("Size:  " + bid.Size);
                });

                Console.WriteLine();
                Console.WriteLine("----------------- ASKS -----------------");

                crypto_asks.ForEach(delegate(CryptoBookEntry ask)
                {
                    Console.WriteLine();
                    Console.WriteLine("Price: " + ask.Price);
                    Console.WriteLine("Size:  " + ask.Size);
                });
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CryptoApi.GetCryptoBookSummary: " + e.Message);
            }
        }
        public static void Main()
        {
            Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");

            var cryptoApi = new CryptoApi();
            var timeframe = "h1";         // string | The time interval for the prices.
            var pair      = "btcusd";     // string | Return prices for the given Crypto Currency Pair. (optional)
            var exchange  = "gemini";     // string | Return prices for a Crypto Currency on the given Crypto Exchange. (optional)
            var currency  = "BTC";        // string | Return prices for the given Crypto Currency. (optional)
            var timezone  = "UTC";        // string | Return price date/times in this timezone, also interpret start/end date/time parameters in this timezone. (optional)  (default to UTC)
            var startDate = "2018-01-01"; // string | Return Crypto Prices on or after this date. (optional)
            var startTime = "14:20:00";   // string | Return Crypto Prices at or after this time (24-hour). (optional)
            var endDate   = "2019-01-01"; // string | Return Crypto Prices on or before this date. (optional)
            var endTime   = "21:01:21";   // string | Return Crypto Prices at or before this time (24-hour). (optional)
            var pageSize  = 100;          // int? | An integer greater than or equal to 1 for specifying the number of results on each page. (optional)  (default to 100)

            try
            {
                ApiResponseCryptoPrices result          = cryptoApi.GetCryptoPrices(timeframe, pair, exchange, currency, timezone, startDate, startTime, endDate, endTime, pageSize);
                List <CryptoPrice>      prices          = result.Prices;
                CryptoPairSummary       crypto_pair     = result.Pair;
                CryptoExchangeSummary   crypto_exchange = result.Exchange;

                Console.WriteLine(prices.Count + " prices found for " + crypto_pair.Name + " on " + crypto_exchange.Name + "!");
                Console.WriteLine();

                prices.ForEach(delegate(CryptoPrice price)
                {
                    Console.WriteLine("Time:   " + price.Time);
                    Console.WriteLine("Open:   " + price.Open);
                    Console.WriteLine("High:   " + price.High);
                    Console.WriteLine("Low:    " + price.Low);
                    Console.WriteLine("Close:  " + price.Close);
                    Console.WriteLine("Volume: " + price.Volume);
                    Console.WriteLine();
                });
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CryptoApi.GetCryptoPrices: " + e.Message);
            }
        }
        public static void Main()
        {
            Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY");

            var cryptoApi = new CryptoApi();
            var pair      = "btcusd"; // string | Return the snapshot for the given Crypto Currency Pair. (optional)
            var exchange  = "gemini"; // string | Return the snapshot for a Crypto Currency on the given Crypto Exchange. (optional)
            var currency  = "BTC";    // string | Return the snapshot for the given Crypto Currency. (optional)

            try
            {
                ApiResponseCryptoSnapshot result          = cryptoApi.GetCryptoSnapshot(pair, exchange, currency);
                CryptoPairSummary         crypto_pair     = result.Pair;
                CryptoExchangeSummary     crypto_exchange = result.Exchange;
                CryptoSnapshot            snapshot        = result.Snapshot;

                Console.WriteLine("Snapshot for " + crypto_pair.Name + " on " + crypto_exchange.Name + "!");
                Console.WriteLine();
                Console.WriteLine("Last updated:     " + snapshot.LastUpdated);
                Console.WriteLine("Bid:              " + snapshot.Bid);
                Console.WriteLine("Bid size:         " + snapshot.BidSize);
                Console.WriteLine("Ask:              " + snapshot.Ask);
                Console.WriteLine("Ask size:         " + snapshot.AskSize);
                Console.WriteLine("Change:           " + snapshot.Change);
                Console.WriteLine("Change percent:   " + snapshot.ChangePercent);
                Console.WriteLine("Volume:           " + snapshot.Volume);
                Console.WriteLine("Open:             " + snapshot.Open);
                Console.WriteLine("High:             " + snapshot.High);
                Console.WriteLine("Low:              " + snapshot.Low);
                Console.WriteLine("Last trade side:  " + snapshot.LastTradeSide);
                Console.WriteLine("Last trade time:  " + snapshot.LastTradeTime);
                Console.WriteLine("Last trade price: " + snapshot.LastTradePrice);
                Console.WriteLine("Last trade size:  " + snapshot.LastTradeSize);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CryptoApi.GetCryptoSnapshot: " + e.Message);
            }
        }