Unable to load existing position from storage


Unable to load existing position from storage
Atom
11/10/2017


Hi

Using my application I opened a position in SPXW call. My application uses CSV storage, so it should have been stored. If I open my application the existing position does not get loaded. I have attached a console application that loads and connects using the storage my own application created. I have included the csv store in the zip file. It is in the bin/debug/data directory. Please look at the store. Did the position save to the store? If so, why does it not load? I also included the connector log in the bin/debug/logs directory.

Regards
CreateStorage.zip 569 KB (305)

Tags:


Thanks: Support


Johan Kirsten

Avatar
Date: 11/10/2017
Reply


Hi

Is this problem related to not including this code:

Code

_entityRegistry.DelayAction.DefaultGroup.WaitFlush(true);


in the application that must save the position? What does this code do?
Thanks:

Support

Avatar
Date: 11/13/2017
Reply


Johan Kirsten Go to
Hi

Is this problem related to not including this code:

Code

_entityRegistry.DelayAction.DefaultGroup.WaitFlush(true);


in the application that must save the position? What does this code do?


We will investigate your archive later.

Yes, this line is necessary because saving process goes in parallel. You application can shut down before all changes will be flushed into disk.
Thanks:

Support

Avatar
Date: 11/15/2017
Reply


Please use the following lines in your code:

Code
_connector.NewPosition += _connector_NewPosition;
_connector.PositionChanged += _connector_PositionChanged;

private static void _connector_PositionChanged(StockSharp.BusinessEntities.Position obj)
{
    Console.WriteLine("_connector_PositionChanged:" + obj);
}

private static void _connector_NewPosition(StockSharp.BusinessEntities.Position obj)
{
    Console.WriteLine("_connector_NewPosition:" + obj);
}


After modification your sample with sent csv storage should display following output:



Portfolio - is only money position. To get position for security you should to use Position class instead.
Thanks:

Johan Kirsten

Avatar
Date: 11/16/2017
Reply


Hi

This will give me the position in the position collection of the _connector. But I need the mytrade loaded into the mytrade collection so that I can access the original user order id. Currently the mytrade collection does not load. How do I get it to load

Regards
Thanks:

Support

Avatar
Date: 11/21/2017
Reply


Thank you for more details. The answer was provided my colleague by email.
Thanks:


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

loading
clippy