public override void RequestModify(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            var headers = request.Headers;

            var prevData = ApiHelpers.DecodeUrlEncodedBody(request.Content.ReadAsStringAsync().Result).ToList();

            var postData = new List <KeyValuePair <string, string> >();

            postData.Add(new KeyValuePair <string, string>("nonce", GetNonce().ToString()));
            postData.AddRange(prevData);

            var bodyDataEnc = postData.Select(x => $"{x.Key}={x.Value}").ToArray();

            var message = string.Join("&", bodyDataEnc);
            var sign    = HashHMACSHA512Hex(message, ApiKey.Secret);

            request.Content = new FormUrlEncodedContent(postData);

            headers.Add("KEY", ApiKey.Key);
            headers.Add("Sign", sign);
        }
Esempio n. 2
0
 public static Task <ApiResponse <PublicVolumeResponse> > GetAggVolumeDataAsync(IAggVolumeDataProvider provider, AggVolumeDataContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.GetAggVolumeDataAsync(context), nameof(GetAggVolumeData), provider, context));
 }
Esempio n. 3
0
 public static Task <ApiResponse <List <AssetInfo> > > GetCoinInformationAsync(ICoinInformationProvider provider, NetworkProviderContext context = null)
 {
     context = context ?? new NetworkProviderContext();
     return(ApiHelpers.WrapExceptionAsync(() => provider.GetCoinInformationAsync(context), nameof(GetCoinInformation), provider, context));
 }
Esempio n. 4
0
 public static Task <ApiResponse <AggregatedAssetPairData> > GetCoinSnapshotAsync(ICoinSnapshotAggregationProvider provider, AssetPairDataContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.GetCoinSnapshotAsync(context), nameof(GetCoinSnapshot), provider, context));
 }
Esempio n. 5
0
 public static Task <ApiResponse <TransferSuspensions> > GetTransferSuspensionsAsync(IDepositProvider provider, NetworkProviderContext context = null)
 {
     context = context ?? new NetworkProviderContext();
     return(ApiHelpers.WrapExceptionAsync(() => provider.GetTransferSuspensionsAsync(context), nameof(GetTransferSuspensions), provider, context));
 }
Esempio n. 6
0
 public static Task <ApiResponse <BalanceResults> > GetBalancesAsync(IBalanceProvider provider, NetworkProviderPrivateContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => CheckedBalancesAsync(provider, context), nameof(GetBalances), provider, context));
 }
Esempio n. 7
0
 public static Task <ApiResponse <OhlcData> > GetOhlcAsync(IOhlcProvider provider, OhlcContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.GetOhlcAsync(context), nameof(GetOhlc), provider, context));
 }
Esempio n. 8
0
        public static Task <ApiResponse <AssetPairs> > GetAssetPairsAsync(IAssetPairsProvider provider, NetworkProviderContext context = null)
        {
            context = context ?? new NetworkProviderContext();

            return(AssetPairCache.I.TryAsync(provider, () => ApiHelpers.WrapExceptionAsync(() => provider.GetAssetPairsAsync(context), nameof(GetAssetPairs), provider, context)));
        }
Esempio n. 9
0
 public static Task <ApiResponse <bool> > TestApiAsync(INetworkProviderPrivate provider, ApiPrivateTestContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.TestPrivateApiAsync(context), nameof(TestApi), provider, context));
 }
Esempio n. 10
0
 public static Task <ApiResponse <MarketPrices> > GetPricingAsync(IPublicPricingProvider provider, PublicPricesContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.GetPricingAsync(context), nameof(GetPricing), provider, context));
 }
Esempio n. 11
0
 public static Task <ApiResponse <OrderBook> > GetOrderBookAsync(IOrderBookProvider provider, OrderBookContext context)
 {
     return(ApiHelpers.WrapExceptionAsync(() => provider.GetOrderBookAsync(context), nameof(GetOrderBook), provider, context));
 }