blankly-finance / blankly

🚀 💸 Easily build, backtest and deploy your algo in just a few lines of code. Trade stocks, cryptos, and forex across exchanges w/ one package.
https://package.blankly.finance
GNU Lesser General Public License v3.0
2.09k stars 266 forks source link

market orders on coinbase #209

Closed nirno closed 1 year ago

nirno commented 1 year ago

On Coinbase, you don't have to specify size for market order. Instead, you can specify the total sum (fees included) for which you want to buy, and Coinbase calculates the appropriate size so that size * (market price at the moment) + fees == (total sum). (This is convenient because it precludes the possibility for the trade to fail because the price has increased so much that size * price > (available money).) I have not found a way to issue market orders in this way with Blankly. Is it possible or, if not, will it be possible any time soon?

EmersonDove commented 1 year ago

This is a good question. In our case we keep strictly to the base size for both buy and sell orders mainly because it maintains really high compatibility with other APIs like Binance or Alpaca. We generally went with this design decision because as you mentioned in your comment is very easy to convert between funds and size.