コード例 #1
0
        static async Task FindTransactionByCryptoAddress()
        {
            var api = new BitfinexApiV1(Configuration["BitfinexApi_key"], Configuration["BitfinexApi_secret"]);

            string addressToLookFor = "<address>";

            var request = new HistoryRequest
            {
                Currency = "BTC",
                Method   = "bitcoin",
                Since    = DateTimeOffset.Now.AddDays(-3).ToUnixTimeSeconds().ToString(),
                Until    = DateTimeOffset.Now.AddDays(1).ToUnixTimeSeconds().ToString(),
                Limit    = 100,
            };

            LogRequest(request);

            var response = await api.HistoryAsync(request);

            LogResponse(response);

            var item = response.First(t => t.Address == addressToLookFor);

            double expectedAmount = 0.01851848;

            Console.WriteLine("################## Result ################");
            Console.WriteLine($"Expected: Address: {addressToLookFor}, Amount: {expectedAmount} BTC");
            Console.WriteLine($"Actual: Address: {item.Address}, Amount {item.Amount} {item.Currency}, Fee: {item.Fee}, type: {item.Type}");
        }
コード例 #2
0
        static async Task FindTransactionByTxnId()
        {
            var api = new BitfinexApiV1(Configuration["BitfinexApi_key"], Configuration["BitfinexApi_secret"]);

            string txnId = "<txnId>";

            var request = new HistoryRequest
            {
                Currency = "BTC",
                Method   = "bitcoin",
                Since    = DateTimeOffset.Now.AddDays(-30).ToUnixTimeSeconds().ToString(),
                Until    = DateTimeOffset.Now.AddDays(1).ToUnixTimeSeconds().ToString(),
                Limit    = 100,
            };

            LogRequest(request);

            var response = await api.HistoryAsync(request);

            LogResponse(response);

            var item = response.First(t => t.Txid == txnId);

            double expectedAmount = 0.0;

            Console.WriteLine("################## Result ################");
            Console.WriteLine($"Expected: TxnId: {txnId}, Amount: {expectedAmount} BTC");
            Console.WriteLine($"Actual: TxnId: {item.Txid}, Amount {item.Amount} {item.Currency}, Fee: {item.Fee}, type: {item.Type}");
        }
コード例 #3
0
        static async Task HistorySample(string currency, string method)
        {
            var api = new BitfinexApiV1(Configuration["BitfinexApi_key"], Configuration["BitfinexApi_secret"]);

            var request = new HistoryRequest
            {
                Currency = currency,
                Method   = method,
                Since    = DateTimeOffset.Now.AddDays(-3).ToUnixTimeSeconds().ToString(),
                Until    = DateTimeOffset.Now.AddDays(1).ToUnixTimeSeconds().ToString(),
                Limit    = 100,
            };

            LogRequest(request);

            var response = await api.HistoryAsync(request);

            foreach (var r in response)
            {
                r.Timestamp        = DateTimeOffset.FromUnixTimeSeconds(Convert.ToInt64(Convert.ToDouble(r.Timestamp))).ToString();
                r.TimestampCreated = DateTimeOffset.FromUnixTimeSeconds(Convert.ToInt64(Convert.ToDouble(r.TimestampCreated))).ToString();
            }

            LogResponse(response);
        }