question

Upvotes
Accepted
61 2 4 9

RediLib.Order.Submit returns False with null in the objErr

Trying out some of the Redi SendOrder test code. When I attempt to submit the order the function returns False and the (ref objErr) comes back as null. I was of the understanding that objErr should have info as to what's going wrong rather than returning null. The test code seems to be connected to RediPlus as events fire when orders are submitted via Redi Plus.

redi-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

13 Answers

Upvotes
Accepted
23k 22 9 14

Hello @tobermark,

We were able to confirm today that your user ID was not entitled for DDE usage.

You have been permissioned now, please try the request again.

Thanks for your patience and apologies for the delay in this step.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

Hello @tobermark,

Would you mind listing the complete details of what you are trying to do?

I.e. what order type (Complex Order Trader, Option Trader, Equity/Future Trader)

What selections you have chosen or typed before hitting "Submit"?

Maybe easier, if you print-screen, cut out the GUI rectangle, and attach to the question?

So we can try to reproduce what you see.

Thanks

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
61 2 4 9

Greetings,

For starters the code I'm using is the example code pulled off your FTP (sftp.redi.com) site. The name of the zip is CSharp SendOrder.zip or SendOrder.csproj inside.

I've made no adjustments to the code.

In the file MainWindow.xaml.cs in the RediLib.ORDER objOrder object I have the following values set.

RediLib.ORDER objOrder = new RediLib.ORDER();

objOrder.Side = "BUY"

objOrder.Quanty = "5"

objOrder.Symbol = "AAPL"

objOrder.Exchange = "*ticket"

objOrder.PriceType = "Market"

objOrder.TIF = "Day"

objOrder.Price = "0"

objOrder.Account = "DEMO"

objOrder.Ticket = "Stage" (I set it to "Bypass" here but the debug value remains "Stage").

objOrder.DNS = null (I set it to true but it remains null)

bool good = true;

object objErr = null;

good = objOrder.Submit(ref objErr);

I have tried submitting the order with my UserID and Password set in the order information but that did not have any affect.

Note, if I submit the order through the Redi Plus interface all the callbacks works as intended, its just orders originating from within the API are giving me trouble.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

Hello @tobermark,

From the first look, you are missing Exchange/Destination. Also account has to be valid, the exact account assigned to you, so it may be "DEMO XXX".

Can you try populating the last tab of the example, unmodified, "Equity/Future Trader"?

This helps to see which settings are mandatory.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
61 2 4 9

It appears that this post is appearing before your last reply with some failures in formatting as well.

For the given example code the Destination field goes into RediLib.ORDER.Exchange property. There is no property for a RediLib.ORDER called "Destination". For my inputs in the early test the destination was set to *ticket.

Trying again setting the destination in the example to "DEMO SHARES" which flows into the Exchange property the return on submit was false with an objErr = null.

Here's a code dump of what I have in my project with a few omissions for MBFieldCount.

private void Submit_Click(object sender, RoutedEventArgs e)
	{
            RediLib.ORDER objOrder = new RediLib.ORDER();
            objOrder.Side = Side.SelectedItem;
            objOrder.Quantity = Qty.Text;
            objOrder.Symbol = Sym.Text;
            objOrder.Exchange = Dest.SelectedItem;
            objOrder.PriceType = PrType.SelectedValue;
            objOrder.TIF = TIF.SelectedValue;
            objOrder.Price = Prc.Text;
            objOrder.Account = Acct.SelectedItem;
            objOrder.Ticket = "Bypass";
            objOrder.DNS = true;




	    bool good = true;
            object objErr = null;
            good = objOrder.Submit(ref objErr);
	}

For the example I'm using I don't have Equity/Future Trade as an option. I've included a copy of the input screen I have available.


screen.jpg (37.9 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

Hello @tobermark,

I have modified the original example to log the equity order to be submitted.

Please drop the attached two files into the original example, submit an order via Equity tab, and it should be logged into redi_test.log, likely in bin/Debug , share this output by attaching to the response or just pasting the content.

redi-test-2-files.zip


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
61 2 4 9

I don't believe we are using the same example as a starting point. I have been using CSharp SendOrder.zip where as the code you are referencing is in CSharp Sample Project.zip.

Regardless I've taken the supplied code and replaced the example code. Upon testing with the code you supplied your output statements during the initialize process was a bit premature as the majority of the fields had not yet been populated. A better time for execution of your code would be in public ICommand SubmitCommand and before this line of code "if (this._order.Submit(ref err))"

Before the changes made to the code the output would have been:

8/13/2018 3:11:11 PM

Order=Symbol=AAPL|Side=Invalid|Quontity=0|Exchange=Invalid|Account=

Upon implementing the changes the output is:

8/13/2018 3:11:33 PM

Order=Symbol=AAPL|Side=BUY|Quontity=7|Exchange=DEMO SHARES|Account=DEMO

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

Hello @tobermark,

At this point, what you populate before submit looks absolutely valid to me.

And I have this feeling we both know, if you are able to submit this order via REDIPLus GUI, you should be able to submit the same values via c# API.

So let me just double-check, are you able to submit an order, with all the same parameters, using REDIPLus GUI?

---

If that is confirmed, and as you are not able to submit, let's investigate further.

My minimal necessary input, for the example CSharp Sample Project (which I originally thought you were using) is

Order=Symbol=AAPL|Side=BUY|Quontity=71|Exchange=DEMOMY|TIF=Day|Account=ACCTMY

(I added TIF to output as I had it in input)

Let's try to pare down your submission to the same minimum to see if we can pinpoint the issue?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
61 2 4 9

Yes I am able to submit an order via the REDIPlus GUI. From within the sample code I have the same drop down choices as the REDIPlus GUI establishing that the sample code is talking to REDIPlus.

One item of note is that my Exchange is different than yours and my Account is different than yours. I'm assuming that the accounts DEMO SHARES and DEMO respectively are built for me specifically and should be different.

Is is possible at this point to assume the issue is more with the way my account is set up rather than a flaw within the code itself? By the Order.Submit function returning false and the errObj being NULL it seems like there's some base functionality that isn't turned on.

Another thought on this situation is whether the API based code uses any specific TCP/IP ports that REDIPlus does not. If it does contact a server outside our organization using a different port it is possible data is blocked at the firewall.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
23k 22 9 14

@tobermark

Thanks for the confirmation.

Very true. Yes, they are, they are setup exclusively for you and should match with your logged in REDIPlus user. REDIPlus should be running alongside and logged in.

Very perceptive of you. But no. The example does use the older Interop.RediLib.dll rather then including the latest tlb found in your REDIPlus installation. But as I do the same, I am able to submit. Therefore not the issue preventing submission.

Let me run another double-check. The example is selecting these values from the drop-down lists. You are not modifying to hard-code these values, making a misspelling possible, correct?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
61 2 4 9

All values submitted are the result of being selected from a drop down.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
61 2 4 9

REDIPlus was running and I was logged in.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
61 2 4 9

I was able to successfully submit an order. Thanks for your assistance!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea