spot buy order perplexity

Open
#5,410 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
18/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
java
Domain
api, fintech-quant

Research direction

This is an open design question about how spot buy order commissions should be reported, not a scoped change. Start by reading how the OKX and Bybit trade services currently populate the order quantity and fee fields, and how the shared trade/order DTOs express commission, to see what a consistent contract could look like. The author plans to finish the Gate and Binance integrations before deciding, so there is no defined done state for a contributor to aim at yet; wait for a decision on raw versus net amounts before touching code.

Written by the indexing model from the issue text.

Description

I’m currently adapting another exchange (OKX) to handle commission currencies.
It got me thinking...
For spot buy orders, the commission is deducted from the quantity of coins purchased—essentially, it’s taken out of the asset itself.

Option one: we could simply return the data as provided by the exchange—the total amount purchased and the commission. In this case, the actual net amount of coins acquired would be the total purchased minus the commission.

Option two: we could subtract the commission ourselves and return the final, net amount of coins received from the order execution, along with the commission—this is how I’ve set it up for Bybit. Another complication arises with "discount coins" (tokens used for fee discounts): if these are enabled, it might become impossible for us to calculate the exact balance unless the exchange explicitly provides that figure.
Correction regarding the second point: in the case of discount coins, we shouldn't subtract anything; we should simply pass back to the user whatever value the exchange provides.

I’m at a crossroads—not sure which path is best.

I think I’ll finish integrating the remaining exchanges—bringing the total to four: Binance, Bybit, OKX, and Gate (Gate, for instance, uses these discount coins). Once that’s done, I’ll make a final decision. But I’m leaning toward returning the raw data exactly as the exchange provides it, and leaving the actual calculations up to the user...

Dominant language
Java
Stars
4.1k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
21

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from knowm/XChange

All issues in knowm/XChange

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.