/// <summary> /// [Private API]約定履歴を取得します。 /// </summary> /// <param name="pair">通貨ペア</param> /// <param name="count">取得する注文数</param> /// <param name="orderId">注文ID</param> /// <param name="since">開始時間</param> /// <param name="end">終了時間</param> /// <param name="sort">順序</param> /// <returns>約定履歴</returns> /// <exception cref="BitbankDotNetException">APIリクエストでエラーが発生しました。</exception> public async Task <Trade[]> GetTradeHistoryAsync(CurrencyPair pair, long?count, long?orderId, DateTimeOffset?since, DateTimeOffset?end, SortOrder?sort) { var query = HttpUtility.ParseQueryString(string.Empty); query["pair"] = pair.GetEnumMemberValue(); if (count is { } nonNullCount) { query["count"] = nonNullCount.ToString(); } if (orderId is { } nonNullOrderId) { query["order_id"] = nonNullOrderId.ToString(); } if (since is { } nonNullSince) { query["since"] = nonNullSince.ToUnixTimeMilliseconds().ToString(); } if (end is { } nonNullEnd) { query["end"] = nonNullEnd.ToUnixTimeMilliseconds().ToString(); } if (sort is { } nonNullSort) { query["order"] = nonNullSort.GetEnumMemberValue(); } var result = await GetTradeHistoryAsync(query.ToString()).ConfigureAwait(false); return(result.Trades); }
/// <summary> /// [Private API]アクティブな注文を取得します。 /// </summary> /// <param name="pair">通貨ペア</param> /// <param name="count">取得する注文数</param> /// <param name="fromId">取得開始注文ID</param> /// <param name="endId">取得終了注文ID</param> /// <param name="since">開始時間</param> /// <param name="end">終了時間</param> /// <returns>注文情報</returns> /// <exception cref="BitbankDotNetException">APIリクエストでエラーが発生しました。</exception> public async Task <Order[]> GetActiveOrdersAsync(CurrencyPair pair, long?count, long?fromId, long?endId, DateTimeOffset?since, DateTimeOffset?end) { var query = HttpUtility.ParseQueryString(string.Empty); query["pair"] = pair.GetEnumMemberValue(); if (count is { } nonNullCount) { query["count"] = nonNullCount.ToString(); } if (fromId is { } nonNullFromId) { query["from_id"] = nonNullFromId.ToString(); } if (endId is { } nonNullEndId) { query["end_id"] = nonNullEndId.ToString(); } if (since is { } nonNullSince) { query["since"] = nonNullSince.ToUnixTimeMilliseconds().ToString(); } if (end is { } nonNullEnd) { query["end"] = nonNullEnd.ToUnixTimeMilliseconds().ToString(); } var result = await GetActiveOrdersAsync(query.ToString()).ConfigureAwait(false); return(result.Orders); }
/// <summary> /// [Private API]約定履歴を取得します。 /// </summary> /// <param name="pair">通貨ペア</param> /// <returns>約定履歴</returns> /// <exception cref="BitbankDotNetException">APIリクエストでエラーが発生しました。</exception> public async Task <Trade[]> GetTradeHistoryAsync(CurrencyPair pair) { var query = HttpUtility.ParseQueryString(string.Empty); query["pair"] = pair.GetEnumMemberValue(); var result = await GetTradeHistoryAsync(query.ToString()).ConfigureAwait(false); return(result.Trades); }
/// <summary> /// [Private API]注文情報を取得します。 /// </summary> /// <param name="pair">通貨ペア</param> /// <param name="orderId">注文ID</param> /// <returns>注文情報</returns> /// <exception cref="BitbankDotNetException">APIリクエストでエラーが発生しました。</exception> public Task <Order> GetOrderAsync(CurrencyPair pair, long orderId) { var query = HttpUtility.ParseQueryString(string.Empty); query["pair"] = pair.GetEnumMemberValue(); query["order_id"] = orderId.ToString(); var utf16Query = query.ToString(); Span <byte> buffer = stackalloc byte[OrderInfoPathLength + utf16Query.Length]; ref var bufferStart = ref MemoryMarshal.GetReference(buffer);