How can request more details about the existing positions?


How can request more details about the existing positions?
Atom
11/27/2017


Hello Mikhail and hi all!

This StockSharp project looks very-very exciting and I started to look through some source codes and I tried some examples.
Unfortunately I cannot find the way, how can I get details about the active (opened) positions?
For example I made a connection to FXCM (by the SampleFxcm project) and I subscribed to the NewPosition event with a new function: Trader_NewPosition(Position pos)
Code

Trader.NewPosition += position => Trader_NewPosition(position);
Trader.NewPosition += position => _portfoliosWindow.PortfolioGrid.Positions.Add(position);
...
        private void Trader_NewPosition(Position pos)
        {
            MessageBox.Show("cval: " + pos.CurrentValue.ToString() + " | desc: " + pos.Description + " | Currency: " + pos.Currency.ToString() + " | RealizedPnL: " + pos.RealizedPnL.ToString() + " | BlockedValue: " + pos.BlockedValue.ToString());
        }

Kind of every values in the Position object are null, so I could not get the entry price and the direction values.
Or this limited data problem is only related to the FXCM connections? ...because in fact I plan to use the CQG and/or the Rithmic connections.
Please help me, how can I get the existing positions details after a new connection?

Thanks in advance!
Jose

Tags:


Thanks:


< 1 2 3  >
Mikhail Sukhov

Avatar
Date: 12/4/2017
Reply


Jose Go to
so let’s deduct 49 USD from my current balance for the first month support, and I think during this month I will be able to decide how we can collaborate in a long time. Later we can talk about the remaining money refund or maybe I will send more and I will buy an education package or anything else. If it is okay for you then let’s start to work together!

Regards,
Jose


Thank you for your understanding.

We've provided full refund back (partial refunds are not allowed). Please check your bank account in next 2-3 business days.
Thanks: Jose

Jose

Avatar
Date: 12/19/2017
Reply


Thank you, the money has arrived back in time.
I took a short holiday and I have returned today so I bought a support package, please help me in my original question.
(ps. somehow I could not pay via PayPal this time as well)
Thanks:

Jose

Avatar
Date: 12/19/2017
Reply


Hi,
maybe I am tired the end of my day because in this moment I cannot find that button in the forum, where I can create another topic. So please forgive me but I will write another question here:
I didn't take any modification yet in "Rithmic sample application" and I would like to connect with it but I don't know what certificate file should I use!? I just have a username and password for my account and nowadays I use it with Ninjatrader well. I have found a certificate (*.pk12) file in NT's folder but then I got a "bad input" error message which is understandable :)
I should ask this certificate file from my futures broker or what file do I have to use there?
Thanks:

Support

Avatar
Date: 12/19/2017
Reply


Hello

Could you please output Position.ToString to some file and please send it to the thread.

To create a new topic you need to press big green button on the main page.
Thanks:

Jose

Avatar
Date: 12/19/2017
Reply


Support Go to
Could you please output Position.ToString to some file and please send it to the thread.


Yes!
Code

        private void Trader_NewPosition(Position pos)
        {
            System.IO.File.WriteAllText(@"t:\TEMP\fxcm-pos.txt", pos.ToString());
....


Text file content:
931651-EUR/USD@FXCM

I also checked with breakpoint in VS too and the "931651" is nothing more then just the Portfolio's name property value, so unfortunately the most objects seems almost totally empty too, except Security object.

Quote:
To create a new topic you need to press big green button on the main page.

Indeed :))))) Yesterday I was too tired :) and surprised because this form input and the topic input fields were filled by my older post texts and I didn't want to edit that (furthermore the url contained "edit" too, not for example "new") - but of course it was my browser or some cookie who made this joke with me :)
Thanks:

Support

Avatar
Date: 12/20/2017
Reply


FXCM connector fill Position.CurrentValue. Please check it. If the value is zero your position is closed.

Position object like other structures contains shared properties. It mean some of connection fill only subset of the properties. For example Position.Commission fills by small set connectors only.
Thanks:

Jose

Avatar
Date: 12/20/2017
Reply



I made a screenshot, so Position.CurrentValue is null as well (otherwise the text file should had to contain).
The position is not closed it is 100%! For example I think Trader_NewPosition would never be triggered if I don't have any opened position, so the position is exists it is for sure (another platform what I use too that displays the exists EURUSD position with all details under this same FXCM account).
Furthermore the Position object is not totally empty, so it has some values how I wrote above ("31651-EUR/USD@FXCM"), therefore this connector knows about the opened position just don't know any other details about that.
The Portfolios content can be another proof about that the position still exists:


In this moment I have opened a new position via StockSharp. ...but the result is the same:

The new Portfolios content:


So how can I get these exists positions details, for example direction, entry time and entry price, etc. parameters?

ps.: when I open a new position then the situation is the same with the Trader_NewOrder(Order obj) event, there the Order object didn't contain the details (for example entry price and etc.) about the new order

Thanks:

Support

Avatar
Date: 12/21/2017
Reply


Please use PositionChanged event and track changes until receive required values. SampleFXCM shows positions with filled current values. It mean all necessary data are received by connector.

NewPosition event triggers when created new object of Position class. It can be happen for first time connection or made some trades. NewPosition event DO not mean a position was opened.
Thanks:

Jose

Avatar
Date: 1/4/2018
Reply


Happy New Year!

I tried with the recommended PositionChanged event. It has been well triggered after the connection got established but this event still does not give back the necessary details about the existing positions [crying]
See below the Position's object values:

The "Commission" and "CurrentValue" values are valid, but where/how can I get/request the direction of this existing position, the entry time, the entry price and etc.?
Thanks:

Support

Avatar
Date: 1/6/2018
Reply


Jose Go to

The "Commission" and "CurrentValue" values are valid, but where/how can I get/request the direction of this existing position, the entry time, the entry price and etc.?


Direction points by sign. Negative current value means short. Positive - long.

We fill most of all values translated by FXCM.
Thanks:
< 1 2 3  >

Attach files by dragging & dropping, , or pasting from the clipboard.

loading
clippy