-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Rename OrderDuration to TimeInForce #1911
Rename OrderDuration to TimeInForce #1911
Conversation
"Time In Force" is the standard term used in trading platforms and APIs.
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 changes, I think especially the aliases will be nice for users.
Common/Orders/OrderTypes.cs
Outdated
/// </summary> | ||
GTC, | ||
GoodTilCancelled, |
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 think we can alias these, such that, GTC = GoodTilCancelled
-- support both the abbreviations as well as the full names.
Also, normally I would recommend that we 'phase out' the OrderDuration
type name and associated values, but i practice it's never really used and not well documented either, so I think these changes are safe.
@@ -192,7 +192,7 @@ public void WorksWithJsonConvert() | |||
'Time':'2010-03-04T14:31:00Z', | |||
'Quantity':999, | |||
'Status':3, | |||
'Duration':0, | |||
'TimeInForce':0, |
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.
Do we need to update OrderJsonConverter
to check for a Duration
property in case TimeInForce
does not exist?
@@ -654,7 +655,7 @@ private Order ConvertOrder(JToken order) | |||
var gtdTime = order["gtdTime"]; | |||
if (gtdTime != null) | |||
{ | |||
qcOrder.Duration = OrderDuration.Custom; | |||
qcOrder.TimeInForce = TimeInForce.Custom; |
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'll need to remember to come back here and properly set this to GTD when it gets added
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.
Correct, Custom
will be renamed to GoodTilDate
in the GTD PR
@@ -770,7 +770,7 @@ private Order ConvertOrder(RestV1.DataType.Order order) | |||
qcOrder.Id = orderByBrokerageId.Id; | |||
} | |||
|
|||
qcOrder.Duration = OrderDuration.Custom; | |||
qcOrder.TimeInForce = TimeInForce.Custom; |
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 think this will also become GTD when it gets added.
if (timeInForce == TimeInForceFactory.DAY) | ||
return (OrderDuration)1; //.Day; | ||
return (TimeInForce)1; //.Day; |
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.
Will also need to remember this and the equivalent in the tradier brokerage when we add day time in force.
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.
Working on the TimeInForce.Day
PR now :)
Both Duration (old) and TimeInForce (new) JSON keys are deserialized into the Order.TimeInForce property.
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.
Thanks @StefanoRaggi! Changes look great!
Description
This PR renames the following items:
OrderDuration
enum ->TimeInForce
Order.Duration
property ->Order.TimeInForce
Related Issue
QuantConnect/Lean.Brokerages.InteractiveBrokers#27
Motivation and Context
"Time In Force" is the standard term used in trading platforms and APIs:
https://www.investopedia.com/terms/t/timeinforce.asp
Requires Documentation Change
No.
Types of changes
Checklist:
bug-<issue#>-<description
orfeature-<issue#>-<description>