danpaquin / coinbasepro-python

The unofficial Python client for the Coinbase Pro API
MIT License
1.82k stars 738 forks source link

get_fills documentation out of date #358

Closed noah222 closed 5 years ago

noah222 commented 5 years ago

The example for paginated get fills using 'before' command does not work because it does not include the product type that is now required.

The following line in the example:

new_fills = auth_client.get_fills(before=recent_fills[0]['trade_id'])

Should be updated to:

new_fills = auth_client.get_fills(before=recent_fills[0]['trade_id'], product_id="***-USD")

This of course requires the use of the correct product_id to match up with the trade you are looking up ("ETH-USD", "BTC-USD" etc.)

nazariyv commented 5 years ago

Noah, looks like this library isn't maintained anymore. Would you be keen to fork it and me + my friend @TristanJM would be happy to help to maintain it, as we are using it too?

acontry commented 5 years ago

FYI I am developing a fork of this project at https://github.com/acontry/coinbasepro where this problem is already fixed.

nazariyv commented 5 years ago

@acontry I can't find websocket in there. And the last commit is from 6 months ago?

acontry commented 5 years ago

Initial focus was to build a clean, well-documented REST client which has been stable for a while. Privately I use my own websocket code and FIX client but I haven't cleaned those up for release like the REST stuff.

noah222 commented 5 years ago

@acontry Might I ask about the error handling of your code? I've got my own clunky error handling that works, but something occasionally slips through. Does it deal with null responses, and timeouts well? Thanks!

nazariyv commented 5 years ago

@acontry Would you be able to release the FIX stuff? That would be marvelous.

acontry commented 5 years ago

@noah222 The goal is to handle all exceptions with a consistent interface - Ideally any type of exception raises a CoinbaseAPIError (or a child of that exception type) with my approach. I just looked, and realized that a timeout will throw a separate exception so I can fix that. Regarding null responses, I do cover cases that I've encountered but of course it's hard to know if I've covered all of them (especially undocumented/off spec stuff).

@nazariyv There is work to be done before releasing FIX, but I'll keep this in mind!

nazariyv commented 5 years ago

Well... with the new coinbase fees we can all happily move to binance... šŸ˜ 

uclatommy commented 5 years ago

If anyone was able to outperform a buy and hold strategy in February, Iā€™d love to hear how you did it.

On Mar 19, 2019, at 3:58 AM, noah222 notifications@github.com wrote:

the game gets a little harder with these fees, but I've already invested so much time in developing a working strategy. So I'll be sticking with this for now. Now it's time to double down and make it even better, reduce my error rate from 8% to lower than that, if possible.

On Mon, Mar 18, 2019 at 6:02 PM Nazariy notifications@github.com wrote:

Well... with the new coinbase fees we can all happily move to binance... šŸ˜ 

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/danpaquin/coinbasepro-python/issues/358#issuecomment-474118848, or mute the thread https://github.com/notifications/unsubscribe-auth/An0aoZRyjkO-l1tw-91uLdc_6Zx9U2uNks5vYAz4gaJpZM4bXcCf .

ā€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

nazariyv commented 5 years ago

If anyone did, no one will tell ;)

nazariyv commented 5 years ago

What's a good way to get in touch with you Noah?

uclatommy commented 5 years ago

@noah222, so looks like you are using an ai approach since you mentioned back-propagation? I also have a robust backtesting system where I can swap out any algorithm I want to backtest. And just like you, I'm simulating the cbpro server for backtesting while using historical data to replay to my trading algo. Mine is also able to accommodate the changes to fee structure-- just a matter of changing the fee assumptions. However, unlike you, I'm taking a statistical approach. Namely, a seasonal autoregressive integrated moving average model. It works decently but still was not able to predict the flash crash at the end of February. I'm not yet familiar enough with neural networks to implement my own yet, but eventually, I'm thinking of building a network that can learn how to set the parameters of the seasonal arima model and keep it constantly training on new data. One thing that I have found to help my algo is to build my own type of stop-loss order that can follow prices up or down until it detects an inflection point so even if the algo is a bit early in creating the order, the stop loss can ratchet itself up or down until it finds the peak or trough. Despite all this, I still cannot consistently beat the HODLers.

acontry commented 5 years ago

FYI pushed some improvements over at my repo - also did some more thorough testing of error handling and it behaves quite nicely. See some examples in the readme!

nazariyv commented 5 years ago

Isn't that just overfitting? How can you tell it will work out-of-sample? Are you selecting combinations based on the best test MSE?

nazariyv commented 5 years ago

@noah222 we need to talk :) I will ping you at some point

uclatommy commented 5 years ago

Well, regardless of how everyone is doing with their chosen methodologies, if coinbase achieves their stated goal of increasing liquidity and decreasing volatility, it would change the behavior of the market. More than the addition of frictional costs on both the taker and maker side of transactions, I would worry about the possibility that new market dynamics invalidate most of our backtesting so far. For any currently successful bots, I would probably trade a smaller portfolio when the fee structure changes just to make sure the new dynamics don't suddenly make successful algos unsuccessful. On the bright side, now that the cost differential is smaller between limit and market orders, it might make sense to develop new strategies that can switch between the two types of orders depending on which is more advantageous at the moment. Good luck!