Unable to load existing position from storage
Atom
10.11.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)

Теги:


Спасибо: Support


Johan Kirsten

Фотография
Дата: 10.11.2017
Ответить


Hi

Is this problem related to not including this code:

Код

_entityRegistry.DelayAction.DefaultGroup.WaitFlush(true);


in the application that must save the position? What does this code do?
Спасибо:

Support

Фотография
Дата: 13.11.2017
Ответить


Johan Kirsten Перейти
Hi

Is this problem related to not including this 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.
Спасибо:

Support

Фотография
Дата: 15.11.2017
Ответить


Please use the following lines in your 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.
Спасибо:

Johan Kirsten

Фотография
Дата: 16.11.2017
Ответить


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
Спасибо:

Support

Фотография
Дата: 21.11.2017
Ответить


Thank you for more details. The answer was provided my colleague by email.
Спасибо:


Добавить файлы через драг-н-дроп, , или вставить из буфера обмена.

loading
clippy