简体   繁体   中英

With the Python Coinbase API, how do I figure out my pricing tier (fees)?

I'm using the Python API for Coinbase Pro -- https://github.com/danpaquin/coinbasepro-python . Is there a programmatic way I can calculate what pricing tier I'm in prior to submitting an order? I would like to get an idea of the fees before I place the order. I notice the authenticated client provides a way to get accounts

accts = auth_client.get_accounts()

which returns accounts that look like the below

{'id': 'f3af2ff9-15a9-4b09-bdce-2136baf413e1', 'currency': 'USD', 'balance': '6637.7288007189954500', 'hold': '
2003.9996462765652000', 'available': '4633.72915444243025', 'profile_id': 'cc15c482-e394-40a9-b183-6f456a67b188
', 'trading_enabled': True}

However their documentation suggests pricing tiers/fees are calculated based on trading volume, and I'm not sure a good way to programmatically figure that out.

First, you may want to review the information you just posted as it seems there may be sensitive data contained within the post. I'm not certain because I'm not familiar with the coinbase api.

Second, I'm pretty sure you can find a chart with the price-fee pairs in it. See the link below.

https://help.coinbase.com/en/coinbase/trading-and-funding/pricing-and-fees/fees

I don't know about the python api specifically but the exchange api does have a fees end point which looks at the trailing 30 day trade volume.

if the python api doesn't have a hook for this, you can do it directly. You'll just have to understand how to sign the request (the value for "cb-access-sign": ) which is the bigger issue usually.

https://api.exchange.coinbase.com/fees

install requests

$python -m pip install requests

code sample

import requests
url = "https://api.exchange.coinbase.com/fees"
headers = {
 "Accept": "application/json",
 "cb-access-key": "<your key>",
 "cb-access-passphrase": "<your passphrase>",
 "cb-access-sign": "<your signing hash>",
 "cb-access-timestamp": "<timestamp used in signing hash>"
}
response = requests.request("GET", url, headers=headers)
print(response.text)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM