-
Notifications
You must be signed in to change notification settings - Fork 516
feat(client): add updateOrder and futuresUpdateOrder #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f8797ac
89c5f12
95b2bab
2098c5e
81a6de8
a553eca
99d2fc5
19fdb53
7487f7c
8f18fd7
b978755
521dec7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -404,6 +404,27 @@ const orderOco = (privCall, payload = {}, url) => { | |
| ) | ||
| } | ||
|
|
||
| const updateOrder = (privCall, payload = {}, url) => { | ||
| const newPayload = { ...payload } | ||
|
|
||
| if (!newPayload.cancelReplaceMode) { | ||
| newPayload.cancelReplaceMode = 'STOP_ON_FAILURE' | ||
| } | ||
|
|
||
| if (!newPayload.timeInForce) { | ||
| newPayload.timeInForce = 'GTC' | ||
| } | ||
|
|
||
| if (!newPayload.newClientOrderId) { | ||
| newPayload.newClientOrderId = spotP() | ||
| } | ||
|
|
||
| return ( | ||
| checkParams('updateOrder', newPayload, ['symbol', 'side', 'type']) && | ||
| privCall(url, newPayload, 'POST') | ||
| ) | ||
| } | ||
|
|
||
| /** | ||
| * Zip asks and bids reponse from order book | ||
| */ | ||
|
|
@@ -486,6 +507,7 @@ export default opts => { | |
|
|
||
| // Order endpoints | ||
| order: payload => order(privCall, payload, '/api/v3/order'), | ||
| updateOrder: payload => updateOrder(privCall, payload, '/api/v3/order/cancelReplace'), | ||
| orderOco: payload => orderOco(privCall, payload, '/api/v3/order/oco'), | ||
| orderTest: payload => order(privCall, payload, '/api/v3/order/test'), | ||
| getOrder: payload => privCall('/api/v3/order', payload), | ||
|
|
@@ -598,6 +620,15 @@ export default opts => { | |
| // Use regular order endpoint | ||
| return order(privCall, payload, '/fapi/v1/order') | ||
| }, | ||
| futuresUpdateOrder: payload => { | ||
| if (payload && 'conditional' in payload) { | ||
| // for now it is not supported | ||
| // const payloadCopy = { ...payload } | ||
| // delete payloadCopy.conditional | ||
| // return privCall('/fapi/v1/algoOrder', payloadCopy, 'PUT') | ||
| } | ||
|
Comment on lines
+623
to
+629
|
||
| return privCall('/fapi/v1/order', payload, 'PUT') | ||
| }, | ||
|
Comment on lines
+623
to
+631
|
||
| futuresBatchOrders: payload => privCall('/fapi/v1/batchOrders', payload, 'POST'), | ||
| futuresGetOrder: payload => { | ||
| // Check if this is a request for a conditional/algo order | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out code should be removed. If this functionality is planned for future implementation, consider creating a TODO comment or GitHub issue instead of leaving commented code in the codebase.