[英]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 .我正在为 Coinbase Pro 使用 Python API -- 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.
我不确定,因为我不熟悉 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 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.我不知道 python api 的具体情况,但交易所 api 确实有一个费用端点,它查看过去 30 天的交易量。
if the python api doesn't have a hook for this, you can do it directly.如果 python api 没有这个钩子,你可以直接做。 You'll just have to understand how to sign the request (the value for
"cb-access-sign":
) which is the bigger issue usually.您只需要了解如何签署请求(
"cb-access-sign":
的值:),这通常是更大的问题。
https://api.exchange.coinbase.com/fees 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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.