Websocket how? - page 22

 
Алексей Барбашин:

To consolidate the material, let's go from the beginning. Create a new project (Console Application), name it BinaryTicks

Shall we continue there?

we can delete unnecessary

Probably better to pass the candlestick symbol, period and time to the library, and the library will return prices and make a separate function for ticks
 
Fedor Arkhipov:

Can we continue in this?

you can delete unnecessary ones

I'll write from scratch, you can continue in that.

In the global class I write new methods


 

Created

Shouldn't you make them boolean? to get the result that the connection is established.

 
Fedor Arkhipov:

Shall we continue in this?

you can delete unnecessary data

Perhaps, it is better to pass the symbol, the candlestick period and time to the library, and the library will return the price and make a separate function for ticks

This is not correct. Before you start, you need to collect the history from the server and write it to the symbol file, build a chart based on this data, and then you can get any candle on the chart itself and build any indicators as on a normal symbol.

 
Fedor Arkhipov:

Created

Shouldn't we make them boolean? to get a result that the connection is established.

It's pointless to make them boolean, they won't return a result immediately, the socket works asynchronously. You can only add a function to check the connection.

 
Алексей Барбашин:

This is not correct. Before you start, you need to collect the history from the server and write it to the symbol file, build a chart based on this data, and then use the chart itself to get any candle and build any indicators as on a normal symbol.

OK, I thought we would implement it differently
 
Алексей Барбашин:

It's pointless to make them boolean, they won't return a result immediately, the socket works asynchronously. You can only add a function to check the connection.

Yes, this is a must.
 

I add a Service folder to the project, it will contain service classes, including a socket class.


I add WSSocket class to the folder, make it public

 

is it possible to intervene ?

Does nobody want to do a class/interface on the MT side beforehand ?

i.e. give a specific ToR that is discussed and enforceable.

let's get started:


class Hibou {

Hidou(string url=HIBOU_WS_URL);  // думаю почти бесспорно

~Hibou();

void DoEvent(); // веб-сокеты асинхронны, а может в тредах реализуем, будем дёргать при первой возможности

int State(); // некое текущее состояние

/// хенды по событиям протокола, вызываемые из DoEvevnt

virtual void OnConnect();  //  соеденились - зашибись

virtual void OnMessage(string json); // получили внятный Event

/// и так далее - заказчик представляет как он намерен использовать интерфейс.

/// если он этого не знает, мы за него ничего придумать не можем, клиника в руках пациентов

}

 
Fedor Arkhipov:
OK, I thought we were going to do it differently

So you express how you would like to be able to enjoy the process yourself. Just understand: the server cannot be asked for a specific candlestick, only a range of candlesticks for selected dates. So think in that direction.