vdemydiuk / mtapi

MetaTrader API (terminal bridge)
http://mtapi4.net/
MIT License
523 stars 282 forks source link

Exception in HistoryDeal methods (MT5) #83

Closed nzyatkov closed 6 years ago

nzyatkov commented 6 years ago

Hi, Do not work HistoryDeal methods in mt5 api client:

try
{
  var posId = Mt5ApiClient.PositionGetInteger(ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER); // posId = 7247951
  var history = Mt5ApiClient.HistorySelectByPosition(posId); // history = true
  var historyDealsTotal = Mt5ApiClient.HistoryDealsTotal(); // historyDealsCount  = 4
  var histDealTicket = Mt5ApiClient.HistoryDealGetTicket(0); //  histDealTicket = 6632442
  var histDealPrice = Mt5ApiClient.HistoryDealGetDouble(histDealTicket, ENUM_DEAL_PROPERTY_DOUBLE.DEAL_PRICE); // Exception
}
catch (Exception ex)
{
  // ex.Messsage = "Service connection failed! Ошибка сериализации параметра http://tempuri.org/:command. Сообщение InnerException было \"Тип \"MtApi5.ENUM_DEAL_PROPERTY_DOUBLE\" с именем контракта данных \"ENUM_DEAL_PROPERTY_DOUBLE:http://schemas.datacontract.org/2004/07/MtApi5\" не ожидается. Попробуйте использовать DataContractResolver, если вы используете DataContractSerializer, или добавьте любые статически неизвестные типы в список известных типов - например, используя атрибут KnownTypeAttribute или путем их добавления в список известных типов, передаваемый в сериализатор.\".  Подробнее см. InnerException."
}
vdemydiuk commented 6 years ago

I have investigated this problem on last source code and there is no exception. I have fixed this problem in version 1.0.14 What version are you using to make exception?

vdemydiuk commented 6 years ago

I think this issue is duplicate of Issue #72.

nzyatkov commented 6 years ago

I cloned 1.0.14 MT5 API version on January 10th., but used MtApi5 installation file from site: http://mtapi4.net/downloads/ Maybe this was the problem?

I'll try to update MT5 to 1.0.15 version and repeat the bug.

nzyatkov commented 6 years ago

Hi, In 1.0.15 version it is ok, so I think this issue can be closed. Thank you!

vdemydiuk commented 6 years ago

Thank you too for testing. I am closing this issue.