Ejemplo n.º 1
0
        internal CoinExClientSpotApi(Log log, CoinExClient baseClient, CoinExClientOptions options) :
            base(options, options.SpotApiOptions)
        {
            _baseClient = baseClient;
            _log        = log;
            _options    = options;

            Account      = new CoinExClientSpotApiAccount(this);
            ExchangeData = new CoinExClientSpotApiExchangeData(this);
            Trading      = new CoinExClientSpotApiTrading(this);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var            builder       = new ConfigurationBuilder().AddUserSecrets <CoinExKey>();
            IConfiguration Configuration = builder.Build();
            var            apiKey        = Configuration.GetSection("CoinExKey").Get <CoinExKey>();
            CoinExClient   client        = new CoinExClient();

            client.SetApiCredentials(apiKey.APIKey, apiKey.APISecret);
            var withdrawalHistory = client.GetWithdrawalHistory();
            var depositHistory    = client.GetDepositHistory();
            var marketInfo        = client.GetMarketInfo();

            Console.WriteLine("Hello World!");
        }
Ejemplo n.º 3
0
        static async Task Main(string[] args)
        {
            string[] marketList = new string[0];
            using (var client = new CoinExClient())
            {
                var listResult = await client.SpotApi.ExchangeData.GetSymbolsAsync();

                if (!listResult.Success)
                {
                    Console.WriteLine("Failed to get market list: " + listResult.Error);
                }
                else
                {
                    Console.WriteLine("Supported market list: " + string.Join(", ", listResult.Data));
                    marketList = listResult.Data.ToArray();
                }
            }

            Console.WriteLine();
            string market = null;

            while (true)
            {
                Console.WriteLine("Enter market name to subscribe to state updates");
                market = Console.ReadLine();
                if (!marketList.Contains(market.ToUpper()))
                {
                    Console.WriteLine("Unknown market, try again");
                }
                else
                {
                    break;
                }
            }

            var socketClient = new CoinExSocketClient(new Objects.CoinExSocketClientOptions()
            {
                LogLevel   = LogLevel.Information,
                LogWriters = new List <ILogger> {
                    new ConsoleLogger()
                }
            });
            await socketClient.SpotStreams.SubscribeToTickerUpdatesAsync(market, data =>
            {
                Console.WriteLine($"Last price of {market}: {data.Data.Close}");
            });

            Console.ReadLine();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            string[] marketList = new string[0];
            using (var client = new CoinExClient())
            {
                var listResult = client.GetMarketList();
                if (!listResult.Success)
                {
                    Console.WriteLine("Failed to get market list: " + listResult.Error);
                }
                else
                {
                    Console.WriteLine("Support market list: " + string.Join(", ", listResult.Data));
                    marketList = listResult.Data;
                }
            }

            Console.WriteLine();
            string market = null;

            while (true)
            {
                Console.WriteLine("Enter market name to subscribe to state updates");
                market = Console.ReadLine();
                if (!marketList.Contains(market.ToUpper()))
                {
                    Console.WriteLine("Unknown market, try again");
                }
                else
                {
                    break;
                }
            }

            var socketClient = new CoinExSocketClient(new Objects.CoinExSocketClientOptions()
            {
                LogVerbosity = LogVerbosity.Info,
                LogWriters   = new List <TextWriter> {
                    Console.Out
                }
            });

            socketClient.SubscribeToMarketStateUpdates(market, (marketName, data) =>
            {
                Console.WriteLine($"Last price of {market}: {data.Close}");
            });
            Console.ReadLine();
        }