sefbkn / gdax.netcore Goto Github PK
View Code? Open in Web Editor NEWGDAX API Client Library (C# / .NET Core)
License: MIT License
GDAX API Client Library (C# / .NET Core)
License: MIT License
No support candles endpoint
This endpoint returns Array rather than JSON so requiring new methods. I am working on code to support this endpoint.
Curious about the usage of IRealtimeClient?
public AuthenticationToken GetAuthenticationToken(ApiRequest request)
in RequestAuthenticator.cs
public AuthenticationToken(string key, string passphrase, string signature, string timestamp)
call is:
return new AuthenticationToken(_apiKey, signature, timestamp, _passphrase);
Should be
return new AuthenticationToken(_apiKey, signature, timestamp, _passphrase);
RealtimeClient.ParseMessage should be public so you can parse the incoming feed (which comes in as strings to the callback action).
I implemented Snapshot message for realtime client and it is quite large (I guess around 100K) but EndOfMessage becomes true around 60-80K hence I get always a part of it. and there is no way around.
Any help will be appreciated
Hi, I'm experimenting with this in my project and trying to get the list of products I keep getting the same response from the Gdax api saying I should add a User-Agent header. The code seems to be doing this, but apparently something is going wrong. Am I the only one having this problem? Maybe someone could give me a hint as to why this is happening? Thanks a bunch.
Should "OrderClient" implement IOrderClient?
What is the best way to update this library. I am not familiar with github?
I have made some fixes locally on your lib for real time sockets and also your auth mechanism seemed to be incorrect (passphrase and signature was the wrong way around).
Should I fork or send a PR?
public AuthenticationToken GetAuthenticationToken(ApiRequest request)
{
var timestamp = (request.Timestamp).ToString(System.Globalization.CultureInfo.InvariantCulture);
var signature = ComputeSignature(request);
// the following construction has the parameters specified in an incorrect order
// return new AuthenticationToken(_apiKey, signature, timestamp, _passphrase);
// should be
return new AuthenticationToken(_apiKey, _passphrase, signature, timestamp);
}
Hello,
since I am not an advanced programmer, would you be so kind to share with me a short example of a code where you use HTTP request ?
for example GET/accounts
Thank you very much,
Robert
Here's the entire program:
using System;
using System.Net;
using Boukenken.Gdax;
namespace GDAXtest
{
class Program
{
static void Main(string[] args)
{
var baseUrl = "https://api.gdax.com/";
var apiKey = "";
var secret = "";
var passphrase = "";
var requestAuthenticator = new RequestAuthenticator(apiKey, passphrase, secret);
var productClient = new ProductClient(baseUrl, requestAuthenticator);
var productResponse = await productClient.GetProductTickerAsync("BTC-USD");
if (productResponse.StatusCode == HttpStatusCode.OK)
{
var ticker = productResponse.Value;
Console.WriteLine("Price: {0}", ticker.price);
}
}
}
}
Throws this compiler error:
Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
I'm boggled because I believe your library defines GetProductTickerAsync properly with the async modifier. Is there something I am missing in the usage of your example?
Thanks for responding to my async/await problem. It got me over the hump and request ticker is working as expected. I am encountering a new problem. I constructed an account client and am attempting to retrieve the list of accounts. The await command hangs and never returns with an answer. Here is the code:
public static bool AccountInfoAvailable = false;
public static async Task AccountMethodAsync()
{
var baseUrl = "https://api.gdax.com/";
var apiKey = "fffffffffffffffffffffffff";
var secret = "dddddddddddddddddddddddddddddddddd";
var passphrase = "eeeeeeeeeeeee";
var requestAuthenticator = new RequestAuthenticator(apiKey, passphrase, secret);
var accountClient = new AccountClient(baseUrl, requestAuthenticator);
var accountResponse = await accountClient.ListAccountsAsync();
break point never reached =>
the following code is never executed.
AccountInfoAvailable = true;
}
I am using the same key,secret,passphrase as ticker data request and it is running simultaneously as expected.
Do you have any suggestions?
Can someone please provide an example of how to use the RealtimeClient websocket?
I am learning how to code and can't figure this part out. I have gotten everything else in this library working except this part.
I started like this:
` string[] prods = {"BTC-USD"};
var realtimeClient = new RealtimeClient(new Uri("wss://ws-feed.gdax.com"), prods);`
I can't figure out where to go from here. realtimeClient.SubscribeAsync(messageRecieved)...?
what message goes in here?
Thanks in advance for any help.
var prehash = request.Timestamp + request.HttpMethod.ToString().ToUpper() + request.RequestUrl + request.RequestBody;
Should be
var prehash = request.Timestamp.ToString(System.Globalization.CultureInfo.InvariantCulture) + request.HttpMethod.ToString().ToUpper() + request.RequestUrl + request.RequestBody;
I am able to use all other API functions other than placing a new order.
I am passing parameters as following:
/orders?product_id=BTC-USD&size=1&price=1&side=buy
and every time i get error "Missing product_id"
Any help??
Following is my code (for placing a hard-coded test order)
public async Task<ApiResponse<Object>> PlaceOrder() {
var response = await this.GetResponseAsync<Object>(
new ApiRequest(HttpMethod.Post, $"/orders?product_id=BTC-USD&size=1&price=1&side=buy&","")
);
return response;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.