python - Python Coinbase Pro API 如何计算限价订单的执行值(value)?

标签 python coinbase-api

我正在使用 Coinbase Pro API Python SDK。我像这样下限价买单...

import cbpro
...
self._get_auth_client(account).place_limit_order(product_id=formatted_name,
                              side='buy',
                              price=fiat_price,
                              size=amount)

填充后,我得到如下所示的结果

{
    'id': '1eaa9934-ccef-489d-80d7-540e0b9ef62a', 
    'price': '64262.83000000', 
    'size': '0.01556109', 
    'product_id': 'BTC-USD', 
    'profile_id': 'bb05c122-e394-40a9-b183-60456a67b188', 
    'side': 'buy', 
    'type': 'limit', 
    'time_in_force': 'GTC', 
    'post_only': False, 
    'created_at': '2021-11-14T19:55:03.791866Z', 
    'done_at': '2021-11-14T19:55:08.990951Z', 
    'done_reason': 'filled', 
    'fill_fees': '1.5639532769270500', 
    'filled_size': '0.01556109', 
    'executed_value': '999.8760512847000000', 
    'status': 'done', 
    'settled': True
}

我不明白的是他们如何计算“executed_value”?根据购买金额乘以价格减去费用,(64262.83000000 * 0.01556109 - 1.5639532769270500) 我认为执行值(value)将是 998.435728008,这比报告的要少。我错过了什么?

最佳答案

根据我对您的 Buy API 调用Coinbase 中的这句话的解释文档。

executed_value is the cumulative match size * price and is only present for orders placed after 2016-05-20.

看来 executed_value 对您的交易来说是正确的,因为 fill_fees 没有考虑到 executed_value 输出。

当您查询您的订单簿时,您应该会看到从您的购买订单中提取的fill_fees

引用:https://help.coinbase.com/en/pro/trading-and-funding/orders/overview-of-order-types-and-settings-stop-limit-market

关于python - Python Coinbase Pro API 如何计算限价订单的执行值(value)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69968194/

相关文章:

authentication - 在 Coinbase API 调用中不断收到时间戳错误

java - gdax-java 作为库的实现

python - 将 python 更改为 ruby​​,非常基本

python - 在 python 中使用 Seaborn 在对图中进行分布

python - Matplotlib注释更改字体

python - 使用 python 在列表中查找唯一的最大值

python - GDAX/Coinbase API认证流程 : Unicode-objects must be encoded before hashing

node.js - Coinbase API BTC 账户丢失

coinbase-api - 将定期付款(订阅)与 Coinbase 商务相结合

python - Databricks CLI : SSLError, 找不到本地颁发者证书