ccxt-net / ccxt.net

CCXT.NET – CryptoCurrency eXchange Trading Library for .NET
MIT License
196 stars 65 forks source link

How to create a limit buy order using ccxt.net for exchange kraken ? #35

Closed memoryfraction closed 1 year ago

memoryfraction commented 1 year ago

How to create a limit buy order using ccxt.net for exchange Kraken?

memoryfraction commented 1 year ago

and how to get the cash balance for exchange Kraken using ccxt.net?

lisa3907 commented 1 year ago

You can find in TradeApi, FetchOpenOrderAsync.

memoryfraction commented 1 year ago

any function such as fetchBalance(), create_market_buy_order()?

memoryfraction commented 1 year ago

found the solution for 2/3 of the questions. Here is the answer

[TestMethod]
        public async Task Gemini_LoadMarketAsync_Should_Work()
        {
            var _public_api = new CCXT.NET.Gemini.Public.PublicApi();
            var marketsRes = await _public_api.LoadMarketsAsync();
            foreach (var item in marketsRes.result)
            {
                if (item.Key.Contains("BTC") && item.Key.Contains("USD"))
                {
                    Console.WriteLine($"{item.Key}");
                }
            }
            Console.WriteLine("---------");
            foreach (var item in marketsRes.result)
            {
                if (item.Key.Contains("ETH") && item.Key.Contains("USD"))
                {
                    Console.WriteLine($"{item.Key}");
                }
            }
        }

        [TestMethod]
        public async Task Gemini_FetchTradesAsync_Should_Work()
        {
            var geminiApiKey = _configuration["Gemini:ApiKey"];
            var exchangeSecret = _configuration["Gemini:Secret"];
            var tradeApi = new CCXT.NET.Gemini.Trade.TradeApi(geminiApiKey, exchangeSecret);
            var mytradesResponse = await tradeApi.FetchMyTradesAsync("BTC", "USD");
            Assert.IsTrue(mytradesResponse.success == true);
        }

However, I am still stucked when I create a market order. I did wrap the option in a string array, but still got the notice "the options parameter must be an array." image

Can anyone help me out? Thanks