Reputation:
I am using the coinbase pro API and when trying to place a market order, this does not execute, or return any text based on the docs.
# Modules
import env
import cbpro
# API Details
APIKey = env.APIKey
APISecret = env.APISecret
APIPass = env.APIPass
BTCID = env.BTCID
client = cbpro.AuthenticatedClient(APIKey, APISecret, APIPass)
def test1():
client.buy(product_id='BTC-GBP', order_type="market",funds=5.00)
test1()
def test2():
client.place_market_order(product_id='BTC-GBP',side='buy',funds=5.00)
test2()
I have tried 2 different methods - but still the same result. Does anybody have any experience with this module?
Source:
https://pypi.org/project/cbpro/
https://docs.pro.coinbase.com/#introduction
Upvotes: 0
Views: 524
Reputation: 36
The other commentor is correct. For whatever reason (likely due to the significance of decimal places in each idiosyncratic token/coin), possibly due to the fact that floats aren't exact which could create problems, or due to laziness in creating the python wrapper; the Coinbase Pro API in Python almost always takes what look like integers and floats as strings.
def test1():
client.buy(product_id='BTC-GBP', order_type="market",funds='5.00')
Upvotes: 0