i am able to get mode "quote" (44 bytes) by default after subscription of each symbol, but when i try to change mode "full" or "ltp" cant see any changes on the incoming stream as it still shows 44 bytes
have used these JSON
To Subscribe : {"a": "subscribe", "v": [408065, 884737]} To change mode : {"a": "mode", "v": ["full", [408065]} and {"a": "mode", "v": ["ltp", [884737]}
please let me know what i am missing , do i need to pay additional for full stream ?
i have ignored websocket initiation codes as you can understand if i am getting 44 bytes and able to view quotes then rest all code portion should be ok,
i have tried several other instrument tokens and same output 44 bytes
@Shabeershah2002 I'm not sure what's happening here. What you're doing seems to be correct. Not sure of the nuances of C#/.Net. Have you tried the Python client?
i have not tried python yet but meantime would you mind to share the byte array you are getting for below JSON ? just to confirm my conversion and byte array is ok ! as i had seen we had to reverse received stream bytes field by field to get quote in c# !
"{"a" : "mode", "v": ["full",[1510401]}" - for this JSON i have below byte array from C# with the codes shared before :
@Shabeershah2002 Bytes won't match because ticks are transient. If you're having to reverse the order, it should be C# handling it with a different "endianness". Ideally the stream should be big endian.
I am still not able to get full mode!, as i am not familiar with Python not able to install and try as well, Is there anything you can do to find why it is not accepting ? the subscription JSON is accepting and the quotes getting properly but the same method used to send mode change message is not accepting makes me confused !,
Is the "quote" default for everyone ?, is it possible for you to change my default to "full" ?
i have tried all of these below format ; {"a" : "mode", "v": ["full", 1510401]} {"a" : "mode", "v": ["full , 1510401"]} {"a" : "mode", "v": ["full", "1510401"]} {"a" : "mode", "v": ["full" : [1510401]}
Hi @Shabeershah2002 You can inspect kite websocket connection in chrome, you can notice that we are sending {"a":"mode","v":["full",[53243399]]} when we set full mode.
There you go Vivek.......you are the saver for me today !! That sample JSON you posted really helped me that i can see end of the instrument you put two square brackets ]]} then closed JSON !! i was putting only ]} which is mentioned on your API Doc !!, now i am getting full mode just after putting that additional bracket . please correct your API Doc with "{"a":"mode","v":["full",[53243399]]}" which has two "square" closing bracket at the end before curly bracket close Here is your API Doc sample JSON which spoiled my days :
// Set INFY (408065) to 'full' mode to // receive market depth as well. message = {"a": "mode", "v": ["full", [408065]}; ws.send(JSON.dumps(message))
// Set TATAMOTORS (884737) to 'ltp' to only receive the LTP. message = {"a": "mode", "v": ["ltp", [884737]}; ws.send(JSON.dumps(message))
none of these worked just because a bracket and i was not expert JSON to spot that myself !
Please share the bits of your code that deal with subscription and mode change. Hard to guess what could be going wrong without seeing the code.
string data = {"a": "subscribe", "v": [408065, 884737]}
dynamic encoded = Encoding.UTF8.GetBytes(data);
dynamic buffer = new ArraySegment(encoded, 0, encoded.Length);
webSocket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken cancellation);
now below lines are for mode changing , this doesnt make any change on the stream , its streaming as it is 44 bytes !
string data = {"a": "mode", "v": ["full", [408065]}
dynamic encoded = Encoding.UTF8.GetBytes(data);
dynamic buffer = new ArraySegment(encoded, 0, encoded.Length);
webSocket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken cancellation);
i have ignored websocket initiation codes as you can understand if i am getting 44 bytes and able to view quotes then rest all code portion should be ok,
i have tried several other instrument tokens and same output 44 bytes
do let me know if you need further details
is there any response i will get whether the "mode" change message accepted or returned error ?
You'll have to install the library first with
pip install kiteconnect
(provided you have Python, pip etc. setup)No, WebSocket will not send an error response. You should just start getting ticks.
"{"a" : "mode", "v": ["full",[1510401]}" - for this JSON i have below byte array from C# with the codes shared before :
(0)123
(1)34
(2)97
(3)34
(4)32
(5)58
(6)32
(7)34
(8)109
(9)111
(10)100
(11)101
(12)34
(13)44
(14)32
(15)34
(16)118
(17)34
(18)58
(19)32
(20)91
(21)34
(22)102
(23)117
(24)108
(25)108
(26)34
(27)44
(28)32
(29)91
(30)49
(31)53
(32)49
(33)48
(34)52
(35)48
(36)49
(37)93
(38)125
Is there anything you can do to find why it is not accepting ?
the subscription JSON is accepting and the quotes getting properly but the same method used to send mode change message is not accepting makes me confused !,
Is the "quote" default for everyone ?, is it possible for you to change my default to "full" ?
i have tried all of these below format ;
{"a" : "mode", "v": ["full", 1510401]}
{"a" : "mode", "v": ["full , 1510401"]}
{"a" : "mode", "v": ["full", "1510401"]}
{"a" : "mode", "v": ["full" : [1510401]}
{"a":"mode","v":["full",[53243399]]}
when we set full mode.i was putting only ]} which is mentioned on your API Doc !!,
now i am getting full mode just after putting that additional bracket .
please correct your API Doc with "{"a":"mode","v":["full",[53243399]]}" which has two "square" closing bracket at the end before curly bracket close
Here is your API Doc sample JSON which spoiled my days :
// Set INFY (408065) to 'full' mode to
// receive market depth as well.
message = {"a": "mode", "v": ["full", [408065]};
ws.send(JSON.dumps(message))
// Set TATAMOTORS (884737) to 'ltp' to only receive the LTP.
message = {"a": "mode", "v": ["ltp", [884737]};
ws.send(JSON.dumps(message))
none of these worked just because a bracket and i was not expert JSON to spot that myself !
THANKS.