Esempio n. 1
0
        private async Task RunExample()
        {

            // Using the ApiCredentials Class
            // Client = new Api(new ApiCredentials(CexUsername, CexApiKey, CexApiSecret));
            // Or not
            // CexClient = new CexApi(CexUsername, CexApiKey, CexApiSecret);
            // ApiCredentials/(Username, ApiKey, ApiSecret) not needed for public functions
            CexClient = new CexApi();

            // Get Ticker Data
            Ticker tickerData = await CexClient.Ticker(SymbolPair.GHS_BTC);

            // Get Order Book
            OrderBook orderBook = await CexClient.OrderBook(SymbolPair.GHS_BTC);

            // Get Trade history
            IEnumerable<Trade> tradeHistory = await CexClient.TradeHistory(SymbolPair.NMC_BTC);

            // ApiCredentials required for user specific calls or "Private Functions"
            CexClient = new CexApi(CexUsername, CexApiKey, CexApiSecret);

            // Get Account Balance
            Balance accountBalance = await CexClient.AccountBalance();

            // Get Open Orders
            IEnumerable<OpenOrder> openOrders = await CexClient.OpenOrders(SymbolPair.LTC_BTC);

            // Place an order
            OpenOrder openOrder = await CexClient.PlaceOrder(
                SymbolPair.GHS_BTC,
                new Order
                {
                    Amount = 1.00m,
                    Price = 0.04644000m,
                    Type = OrderType.Buy
                });

            // Cancel an order
            bool didSucceed = await CexClient.CancelOrder(openOrder.Id);

            // GHash.IO Example
            GhashClient = new GhashApi(new ApiCredentials(CexUsername, CexApiKey, CexApiSecret));

            // Get Hash Rate
            Hashrate hashrate = await GhashClient.Hashrate();

            // Get Workers Hash Rate
            IEnumerable<KeyValuePair<string, WorkerHashrate>> workerHashRate = await GhashClient.WorkersHashRate();
        }
Esempio n. 2
0
		private void Form1_Load(object sender, EventArgs e)
		{
			LoadSettings();
			_firstRun = true;
			//_cexApiKey = "o3qCw0mySJkWNisqP6di8t9Dk";
			//_cexApiSecret = "SMtI8IFsb2TbPfz9yTJlHNPhK2s";
			//_cexUserName = "******";
			_apiCallCount = 0;
			_cexApiCredentials = new ApiCredentials(_cexUserName, _cexApiKey, _cexApiSecret);
			_cexClient = new CexApi(_cexApiCredentials);

			richTextBox1.Text = @"Started @ " + DateTime.Now + Environment.NewLine;
			_stopwatch = new Stopwatch();
			_stopwatch.Start();
			_balance = new Balance();

			

			button1_Click(null, null);
		}