coinbasepro-python
coinbasepro-python copied to clipboard
Strange behavior on place_order
Hello, first off thanks for the work you have put into this tool!
I am getting my feet wet and have tried the following:
cbpro_client = cbpro.AuthenticatedClient(CB_KEY, CB_SECRET, CB_PASSPHRASE, api_url=CB_URL)
test1 = cbpro_client.place_order(product_id='BTC-USD',
side='buy',
price='5.00',
size='0.01',
order_type='limit')
print(test1)
test2 = cbpro_client.place_order(product_id='BTC-USD',
side='buy',
price='5.00',
size='0.01',
order_type='limit')
print(test2)
The first place_order fails, the second works fine. See output:
{'message': 'invalid signature'}
{'id': '7d0c6569-a97d-4ee8-a0e8-b95ea10321e7', 'price': '5.00', 'size': '0.01', 'product_id': 'BTC-USD', 'side': 'buy', 'stp': 'dc', 'type': 'limit', 'time_in_force': 'GTC', 'post_only': False, 'created_at': '2021-02-16T04:17:37.164732Z', 'fill_fee
s': '0', 'filled_size': '0', 'executed_value': '0', 'status': 'pending', 'settled': False}
Any idea why this is the case? Any guidance would be much appreciated!
I get a different error on this, it says 'notional is too small. Minimum is 1' yet buying the same amount in the web console is fine.
I changed it to market type order and it gives me "invalid price"
@sephethus, sorry, old question, but I'm investigating the cause of the "notional is too small" message that I've received from Coinbase too. I have only seen it a couple of times.
This article helped me understand Notional Value: https://www.investopedia.com/terms/n/notionalvalue.asp
Having read that, it seems that the "Notional is too small" message is generated when the Order's Price * Size is smaller than the MinMarketFunds property of the Product in question, but there may be other market factors that trigger it such as the number of orders on the OrderBook.
Come to think of it, I've only ever encountered this message when using the Coinbase sandbox. Were you connected to the Sandbox at the time?
PS: You can't submit "price" with a market order; only "funds" or "size".