Closed ozum closed 1 month ago
@tiagosiebler, I will surely increase the version number.
I will try to find a way to implement the generic type to the sumbitNewOrder()
. It is tricky.
MARKET and LIMIT order types default to FULL, all other orders default to ACK.
@tiagosiebler. I also made sumbitNewOrder()
and replaceOrder()
generic.
const responseA = await client.submitNewOrder({ ...args, type: "MARKET" }); // FULL
const responseB = await client.submitNewOrder({ ...args, type: "MARKET", newOrderRespType: "ACK" }); // ACK
const responseC = await client.submitNewOrder({ ...args, type: "STOP_LOSS" }); // ACK
const responseD = await client.submitNewOrder({ ...args, type: "STOP_LOSS", newOrderRespType: "FULL" }); // FULL
@tiagosiebler, I'm updating the first message in this PR when I update the PR, so you can use it for documentation purposes when you merge it.
@tiagosiebler, could you please review the PR? It's getting bigger. I want to continue adding further fixes in separate PRs, but they may depend on this PR.
@tiagosiebler, could you please review the PR? It's getting bigger. I want to continue adding further fixes in separate PRs, but they may depend on this PR.
Hey, I will need some time to review (currently travelling). Will review it soon. In the meantime, I suggest making another branch in your fork based on the branch you're currently working on. This way you're building on top of this PR without directly adding more commits to this PR/branch.
Hey, I will need some time to review (currently travelling). Will review it soon.
I wish you a nice trip. FYI, I'm using the version with PR applied in a small personal project, no problem so far.
Amazing work, looks great to me! Thanks for all the time you spent in improving this!
Happy to contribute, and thank you for publishing this great library.
Summary
submitNewOrderList()
becauseNew OCO
is deprecated on Binance API.sumbitNewOrder()
andreplaceOrder()
generic to have correct report type for the response.workingTime
,selfTradePreventionMode
andtransactTime
.W
andV
to theexecutionReport
.OrderResponse
type for convenience.OrderResponseTypeFor<T>
for a better developer experience. Please take a look at the example below.any
.baseUrl
to theWSClientConfigurableOptions
, so it can be used to subscribe to SpotUserDataStream on Testnet. Closes #414CancelRestrictions
,CancelReplaceMode
SelfTradePreventionMode
Example
Thanks to the new generic type, the new
submitNewOrderList
method returns a response with the exact TypeScript type based on thenewOrderRespType
parameter. IfnewOrderRespType
is not provided, it defaults to the minimumACK
, not to mislead the developer.NOTE: I could have divided the features into multiple PRs, but since some of the changes modified the same files, I didn't want to mess with Git conflicts, so I divided them into multiple commits.