Closed DevonJSmith closed 7 years ago
Hi @DevonJSmith ,
Per the XML parameter doc:
You are using options
as the parameter for the body
of a GET
post. Hmm. I think what's happening is since GET
requests don't have a body, the options
object is ignored. You need to make your code look something more like:
var api = new CoinbaseApi(ApiKey, ApiSecretKey, useSandbox: false, proxy: null, useTimeApi: false);
var response = api.SendRequest("exchange-rates?currency=BTC", null, Method.GET);
var rates = response.Data;
Hope that helps. Feel free to reopen the issue if you can spot a problem or bug with the source code in the repository.
Thanks, Brian
:briefcase: :necktie: "Taking care of business every day... Taking care of business every way..."
According to the Coinbase API, the call for current exchange rates
GET https://api.coinbase.com/v2/exchange-rates
allows an optional parameter to specify the base currency. If this parameter is not provided, the default isUSD
.However when using this library to make such a call, any supplied "currency" value is ignored.
Here is example code using this Coinbase library (based on a similar example found in the README):
This returns a JSON object (in the
data
field of theresponse
object) in this format:As you can see, the
currency
value of this response specifiesUSD
, even thoughBTC
was passed as a parameter.Contrasting this with a request made using
HttpWebRequest
:The value of
returnText
:As you can see, the
currency
value isBTC
, as specified in the request URL and all exchange rates useBTC
as a base.Am I mistaken or using this library incorrectly? I would expect the first method using this library to produce the results the second method did.