Author |
Topic: GetInvalidParts always false when using allocationBlock (8 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
JBerrojalbiz381 Posts: 9 Joined: Apr 06, 2011 |
When i try to create an order using allocationblock instead of account, always receive an error when calling GetInvalidParts of the NewOrderDraft object, in my opinion is a generic problem because NewOrderDraft.CreateDraft sets OECClient to null and that implies that (!this.Client.Accounts.ContainsKey(allocationBlockItem.Account.ID)) this condition return an error.
could you please help me with this error Jon Berrojalbiz |
||||
VPfau Moderator Posts: 164 Joined: |
Jon,
It is hard to understand what happened based on your description. Can you please provide a code example? Vitaliy Pfau |
||||
VPfau Moderator Posts: 164 Joined: |
BW, we have a good OECAPI examples which could help you https://github.com/oecapi
See how we setup an allocation block in Advanced Example: https://github.com/oecapi/AdvancedExample/blob/master/Globals.cs#L49 Vitaliy Pfau |
||||
JBerrojalbiz381 Posts: 9 Joined: Apr 06, 2011 |
And the method GetInvalidParts gives this error: AllocationBlock I've decompiled the api and in this method in NewOrderDraft (derived from OrderDraft), i see this code in the api: public NewOrderDraft CreateDraft() internal NewOrderDraft(OECClient client = null) That´s why i think when in the method GetInvalidParts : if (this.AllocationBlock != null) give me this error : AllocationBlock, because the client is null. Jon Berrojalbiz |
||||
VPfau Moderator Posts: 164 Joined: |
Jon,
I see the issue now. This is not because we setup client to null but because we use OECClient.Global in Draft to check your allocation blocks. OECClient.Global holds the most recent instance of OECClient. Only a last created client will work with Allocation blocks; We will fix this in future releases So far here are two recommendations: use only one OECClient in your application OR OECClient which are going to send orders with allocation block should be created after all other instances. Thank you! Here is test which replicates an issue: https://gist.github.com/oecapi/e5c0f6f4bfd83f8613be Vitaliy Pfau |
||||
CMicciche902 Posts: 367 Joined: |
Jon,
We rolled out a fix this past weekend. Can you re-test? Chris M |
||||
JBerrojalbiz381 Posts: 9 Joined: Apr 06, 2011 |
Sorry Chris where could i find this new release? in nuget i don't see this new version.
thanks in advance Jon Berrojalbiz Edited by JBerrojalbiz381 on Nov 26, 2015 at 08:34:23 |
||||
VPfau Moderator Posts: 164 Joined: |
Jon,
you can update OECAPI from Trader application installation (dev environment) http://api.openecry.com/WebPrev/Sections/Misc/DownloadFile.aspx?ClientUpdate=0_0_1&NoCache=d6ff63c9-ed24-4508-8966-d28625e56541 Vitaliy Pfau |
||||