Skip to content

Fix KuCoin average price#823

Merged
vslee merged 1 commit intoDigitalRuby:mainfrom
v36u:fix-kucoin-average-price
Jan 11, 2024
Merged

Fix KuCoin average price#823
vslee merged 1 commit intoDigitalRuby:mainfrom
v36u:fix-kucoin-average-price

Conversation

@v36u
Copy link
Contributor

@v36u v36u commented Jan 10, 2024

When interacting with the KuCoin orders API, the price field is always returned with the value 0. Luckily, there are two other documented fields we can use to calculate the average price: dealFunds (the amount of base (e.g., USDT) spent/received) and dealSize (the amount of target (e.g., BLUR) spent/received).
Example responses:

{
    "code": "200000",
    "data": {
        "id": "<redacted>",
        "symbol": "BLUR-USDT",
        "opType": "DEAL",
        "type": "market",
        "side": "sell",
        "price": "0",
        "size": "25",
        "funds": "0",
        "dealFunds": "11.275",
        "dealSize": "25",
        "fee": "0.015785",
        "feeCurrency": "USDT",
        "stp": "",
        "stop": "",
        "stopTriggered": false,
        "stopPrice": "0",
        "timeInForce": "GTC",
        "postOnly": false,
        "hidden": false,
        "iceberg": false,
        "visibleSize": "0",
        "cancelAfter": 0,
        "channel": "API",
        "clientOid": "<redacted>",
        "remark": null,
        "tags": null,
        "isActive": false,
        "cancelExist": false,
        "createdAt": 1704809539502,
        "tradeType": "TRADE"
    }
}
{
    "code": "200000",
    "data": {
        "id": "<redacted>",
        "symbol": "BLUR-USDT",
        "opType": "DEAL",
        "type": "market",
        "side": "buy",
        "price": "0",
        "size": "0",
        "funds": "33.7429",
        "dealFunds": "33.74289428",
        "dealSize": "75.3526",
        "fee": "0.047240051992",
        "feeCurrency": "USDT",
        "stp": "",
        "stop": "",
        "stopTriggered": false,
        "stopPrice": "0",
        "timeInForce": "GTC",
        "postOnly": false,
        "hidden": false,
        "iceberg": false,
        "visibleSize": "0",
        "cancelAfter": 0,
        "channel": "WEB",
        "clientOid": null,
        "remark": null,
        "tags": null,
        "isActive": false,
        "cancelExist": false,
        "createdAt": 1704809877399,
        "tradeType": "TRADE"
    }
}

@vslee vslee merged commit ea0dc3b into DigitalRuby:main Jan 11, 2024
@v36u v36u deleted the fix-kucoin-average-price branch January 21, 2024 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants