-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Started #118
Comments
@GITMIKRO To start... you will have to new up a new gdax client with your credentials which can be found here for the live server https://www.gdax.com/settings/api or https://public.sandbox.gdax.com/settings/api for sandbox.
for getting the best bid/ask: if you want to go the REST route it looks like https://docs.gdax.com/#get-product-ticker is what you want. You can call that endpoint by using the Products service and
for placing a limit order, use the
let me know if you have any other questions. |
Doug, Thank you for your reply. I did see most of what you suggested in the documentation, but setting it all up with the correct functions and calls to have my form update with the events using websockets is where I get upside down. I'll keep trying different things until I get a simple test to work. I already have the api keys that I need, but I did not think these were necessary for the public data like tickers. I was able to get the REST api working directly with the GDAX api, but I prefer to get the websockets to work and skip the timers. Appreciative! |
@GITMIKRO no worries. please provide code and i would be happy to take a look and help |
@dougdellolio Here's where I am:
|
@GITMIKRO it looks like the channel you want to subscribe to is the ticker channel: https://docs.gdax.com/#the-code-classprettyprinttickercode-channel here is some code I threw together to print out the best bid and ask from the ticker channel. the event update happens when an order goes through
|
@dougdellolio That was exactly what I needed to get me going. I cannot thank you enough for helping me out. |
@dougdellolio Do I need to send webSocket.Stop(); on program close, or will it just die? Thx. |
Hi can you provide a sample of returning the data from the event subscribed as apposed to just writing it the console, what is the best method to do this |
@olegboksner im not sure I understand your question. The data is contained in the eventargs (the e in |
Hi Doug,
} I then call a method which checks for thread safety and invokes my output to text box, |
Hi Doug, im looking for this output ex: { |
@olegboksner it sounds like you are looking at the right channel.....level2 is what you want. The way this channel works is it will send a message with "snapshot" type and the corresponding bids and asks are returned. These are the bids and asks you are getting from max to 0. Anything after that will send you l2update type which has the side, price and size. The output you pasted is all deserialized for you in the Here is some code that may be helpful:
let me know if this still doesn't make sense |
OK thanks Doug, I'm basically doing same, and seeing same results looping through all the Bids and Asks, initially was not sure of the results or as to why I need all bids( to zero) and ask's from current to infinite . |
Hi Doug, sorry one more silly question.
|
to be more specific I subscribe to level2 which event handler will give me continuous stream showing top bid and ask these seem to be my choices |
would this be correct after subscribing to level2 webSocket.OnTickerReceived += (sender3, e3) =>
|
@olegboksner no worries. my comment above does exactly what you are looking for (the 6th comment down). it will print the best bid and ask continuously using the websocket feed after every trade is made. this is using the ticker channel. |
thanks again, I implemented that, how would I do the same for bids and asks (continuously) on open trades that have yet to have made a trade, say for instance I wanted to trade large volumes and needed open or available bid and ask before the trade |
@olegboksner I am not sure I understand what you're asking for. If you want a streaming view of all bids and asks you should subscribe to |
Hi Doug I can do the above and I am getting the OnLevel2UpdateReceived stream, but then I have to get the full order book snap shot each time, is there an easy way to just stream top 5 or 10 from the order book without having to request a snapshot of the entire order book, or am I already doing that with on level updated received and simply need to order that by price? I have seen many api's that have a simple I get this : via the rest api or how would I get the above streaming |
from what I can tell, there is no way to do what you are asking for based on their docs itself (as a specific request related to the websocket) when subscribing to the level2 channel it will send a message with the type "snapshot" which will return the entire book (only once). any response after that, from |
Hi Doug, I did the above where I get updates to the OnLevel2UpdateReceived, then I take that and drop it into a list and and group the last 10 updates received by size, the problem is I get updates from anywhere in the order book so the results are not the top 10 , but just last 10 updated in the order book, how to do I get OnLevel2UpdateReceived to return just the TOP 5 or 10 and not items from all over the order book. Essentially what I get is results sometimes matching the latest BID/ASK and sometimes updates to some where far from the the current price. |
@olegboksner according to the docs, there is no way to get just the top 5 or 10 that I can find. Although as I said, I don't believe its expensive to pull the entire book and update everything and just take top 5/10. wish I could provide more help |
I am wondering how does one track partial fills? What callback is trigger when a partial fill happened? |
More specifically does partial fills come through as "Done" type from websocket with remaining_size that is not zero? I can't seem to replicate it at all in sandbox exchange.. |
@guanm326 you can read about the Order Lifecycle here https://docs.pro.coinbase.com/#order-lifecycle. A |
I have been wondering how to get started. Do I need to make my own form or web project and use this api with it? sorry for the noob questions but once i understand more of what i need to do ill get started with it. |
@ExceedingLife it really depends on what you would like to do but I would recommend you start by creating a console app with the nuget package installed to get comfortable with the library. From there you can use the code snippets from either the readme or comments above to talk to coinbase pro. The full list of possible actions exists in the documentation here https://docs.pro.coinbase.com/ and they correspond to the services provided in this library https://github.com/dougdellolio/coinbasepro-csharp#what-services-are-provided. |
I want to have it so it can Sell x amount when it drops to a certain price and then if it goes back to a price to be able to buy it back. What do you have? I code in c# daily but i havent done much with APIs. Ill start with a console to learn it like you suggest. |
Hey man, I wanted to ask you this awhile ago, what are you currently using for a GUI with your project? do you have coinbase pro up to see the current data and then have a GUI you made to buy and sell. |
@ExceedingLife To be honest, I actually haven't built any front end for my purposes (just console apps), Although, I have talked to others that have built web apps (react/angular) that talk to web services using this library and others that have built full WPF desktop applications. Anything is really possible. I appreciate it and hope you are staying safe too! |
Oh wow lol, I feel like we could make alot of $ with your API. It would be like a limit buy or sell but more advanced. if bitcoin dropped to a certain price sell it (limit sell) but then if it were to raise back up to buy it back so if it goes up alot you dont lose much if any. and otherwise if it were to keep dropping to have it sold so you can buy it back later when its cheaper. basically a limit buy or sell with some if conditions. then when it drops those big amounts you didnt loose anything of if it goes up you have it held onto. I still gotta play with the console app to learn it then im gunna build prob a WPF app with that functionality. |
Wow, I finally took some time yesterday to take a look at this API. (I never used an API before). I built a Console App as you suggested., and wow it was so easy to use! I couldn't believe how easy it was to get going lol. I am going to build my GUI with WPF as I wanted. Maybe eventually ill make 1 on the web. |
So I have a question. I have everything working in a Console app. var response = await coinbaseProClient.OrdersService.PlaceStopOrderAsync |
@ExceedingLife for questions where you believe there may be an issue with the library, please add a new github issue so we can discuss on a different thread. I'd like to keep this one related to "Getting Started" only. I don't seem to have any issues placing stop orders on my end. Make sure you are updated to the latest version through Nuget (v1.0.36). You can also use the examples in the readme to help with placing orders. https://github.com/dougdellolio/coinbasepro-csharp#examples. Regarding your other question, please read Coinbase docs for a description on all endpoints (https://docs.pro.coinbase.com/). |
Ok, Sorry doug, I figured it out as well. I'm LOVING this API. |
Thank you for what I understand to be a fantastic resource.
I am struggling to just get off the ground here and hoping to get assistance with the most basic example for 2 tasks.
If I have this, I can run from there.
I very much appreciate a response, and I understand that this question may be a hassle, but I think it will help others to get started as well.
Thx!
The text was updated successfully, but these errors were encountered: