2 registered members (Quad, aliswee),
835
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
NFA Accounts: Pending to Filled
#468807
10/21/17 03:23
10/21/17 03:23
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
OP
Serious User
|
OP
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
jcl, I have a broker plugin question regarding NFA accounts.
Zorro distinguishes between “orders” and “trades”. On NFA accounts, there technically are no trades, only orders and positions.
In the plugin, I get a BrokerBuy call. If the order is placed (instantly in pending mode), I return a trade ID from a counter. And normally, the order will eventually get filled, but not exactly at the most recently quoted price. As in: it might be a series of partial fills at different prices whose average will be close to but not equal to the most recently quoted price.
Is there a way to designate the order as: “pending, please confirm actual transaction later”? If not, I’d be interested in a new function such as “BrokerFill”, to verify fill status.
|
|
|
Re: NFA Accounts: Pending to Filled
[Re: jcl]
#468815
10/21/17 12:30
10/21/17 12:30
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
OP
Serious User
|
OP
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
Good! For context, I will note the different fill cases that are enumerated. In FIXML:
enum FixmlOrdStatus_enum_t
{
os_New = '0',
os_PartiallyFilled = '1',
os_Filled = '2',
os_DoneForDay = '3',
os_Canceled = '4',
os_PendingCancel = '6',
os_Stopped = '7',
os_Rejected = '8',
os_Suspended = '9',
os_PendingNew = 'A',
os_Calculated = 'B',
os_Expired = 'C',
os_AcceptedForBidding = 'D',
os_PendingReplace = 'E',
};
In Sierra Chart's DTC protocol:
enum OrderStatusEnum : int32_t
{ ORDER_STATUS_UNSPECIFIED = 0
, ORDER_STATUS_ORDER_SENT = 1
, ORDER_STATUS_PENDING_OPEN = 2
, ORDER_STATUS_PENDING_CHILD = 3
, ORDER_STATUS_OPEN = 4
, ORDER_STATUS_PENDING_CANCEL_REPLACE = 5
, ORDER_STATUS_PENDING_CANCEL = 6
, ORDER_STATUS_FILLED = 7
, ORDER_STATUS_CANCELED = 8
, ORDER_STATUS_REJECTED = 9
, ORDER_STATUS_PARTIALLY_FILLED = 10
};
I do not think **all** of these should be accounted for, just enough of them. Thanks! Andrew
|
|
|
Re: NFA Accounts: Pending to Filled
[Re: jcl]
#468825
10/22/17 13:01
10/22/17 13:01
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
OP
Serious User
|
OP
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
It normally would be the BrokerTrade function. You can use it for returning the fill price. But for some reason it currently works for non-NFA accounts only. I've noted to make it work also for NFA accounts in the next version. jcl, this solution would appear to confirm fill status for orders to open a position. Does it also confirm fill status for orders to close a position? This would also be useful.
|
|
|
Re: NFA Accounts: Pending to Filled
[Re: AndrewAMD]
#468844
10/23/17 14:29
10/23/17 14:29
|
Joined: Jul 2017
Posts: 783
Zheka
User
|
User
Joined: Jul 2017
Posts: 783
|
Hi, Andrew, In the plugin, I get a BrokerBuy call. If the order is placed (instantly in pending mode), I return a trade ID from a counter. And normally, the order will eventually get filled, but not exactly at the most recently quoted price. As in: it might be a series of partial fills at different prices whose average will be close to but not equal to the most recently quoted price. It would be useful to get the actual OrderId at the broker, rather then an artificial internal trade counter. Same for actual order fill prices (rather then the quoted ask/bid at the time of placing an order).
|
|
|
Re: NFA Accounts: Pending to Filled
[Re: AndrewAMD]
#468853
10/23/17 16:58
10/23/17 16:58
|
Joined: Jul 2017
Posts: 783
Zheka
User
|
User
Joined: Jul 2017
Posts: 783
|
Sadly, this is not always the case. Ally Invest gives me an order ID - it’s a string with two letters, a dash, and then a series of numbers. In case of SierraChart, it is quite safe to assume that OrderIDs reported via DTC would conform to the same convention. Most SC broker integrations are based on FIX.
|
|
|
Re: NFA Accounts: Pending to Filled
[Re: Zheka]
#468854
10/23/17 17:00
10/23/17 17:00
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
OP
Serious User
|
OP
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
In case of SierraChart, it is quite safe to assume that OrderIDs reported via DTC would conform to the same convention. Most SC broker integrations are based on FIX. Agreed
|
|
|
Re: NFA Accounts: Pending to Filled
[Re: jcl]
#469209
11/08/17 14:52
11/08/17 14:52
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
OP
Serious User
|
OP
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
For closing an order on an NFA account, the fill price is passed in the BrokerBuy function. If the position is not yet closed, return zero. Zorro will then repeat the close order until the fill price is known. The difference is not needed, since on NFA accounts it does not matter which order is closed. Only the close amount matters. When positions are not closed immediately, you need anyway a bookkeeping of the positions in your plugin. When a position closes, then return 1 and pass the fill price on the next close order of the same amount. If the close order has a different amount, just ignore it. Unlike open orders, close orders are repeated until the right amount is closed. jcl, this is very useful information. Perhaps this should be added to the manual?
|
|
|
|