-
Notifications
You must be signed in to change notification settings - Fork 40
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
Feature: Order creates OcO 2.0.6 #23
Conversation
lib/ococo/meta/process_params.js
Outdated
} | ||
|
||
if (!params.submitDelay) { | ||
params.submitDelay = 5000 |
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.
Why so high? Ping pongs default is only 2000:
if (!_isFinite(params.cancelDelay)) {
params.cancelDelay = 1000
}
if (!_isFinite(params.submitDelay)) {
params.submitDelay = 2000
}
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.
Fixed; copy-paste mistake, it was also accessing the wrong key for the parameter. Nice catch 🙇♂️
const { h = {} } = instance | ||
const { declareEvent } = h | ||
|
||
declareEvent(instance, host, 'self:submit_initial_order', 'submit_initial_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.
Nice, didnt realize you could create custom events
} | ||
|
||
if (!_isFinite(limitPrice)) return 'Invalid OCO limit price' | ||
if (!_isFinite(stopPrice)) return 'Invalid OCO stop price' |
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.
We could also check that OCO amount < original order amount otherwise it might be rejected for insufficient balance
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.
I wouldn't restrict it; if the order fails due to insufficient balance it automatically cancels, and it should be up to the user.
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.
Few minors
Description:
Adds a new order type that submits an OCO order after an initial LIMIT/MARKET order fills.
Pending documentation, feature-complete
New features:
PR status: