Skip to content

Issue getting Symbol in SubscribeData #10

@kunalbarchha

Description

@kunalbarchha

Logs:

WebSocket connection initiated for symbols: [NSE:NIFTY50-INDEX, NSE:NIFTYBANK-INDEX, BSE:SENSEX-INDEX]

OnMessage: {"msg":"Subscribe successful","code":200,"type":"sub","message":"Successfully subscribed"}

On Index: {"ch":"142.87","high_price":"82231.17","ltp":"82000.71","exch_feed_time":"1755770451","chp":"0.17","low_price":"81921.22","open_price":"82220.46","type":"if","prev_close_price":"81857.84"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770681","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770681","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770681","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770681","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770682","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770682","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770683","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770683","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770683","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770683","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770685","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770685","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770685","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770685","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770687","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770687","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770688","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770688","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770689","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770689","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}
On Index: {"ch":"33.2","high_price":"25153.65","ltp":"25083.75","exch_feed_time":"1755770691","chp":"0.13","low_price":"25054.9","open_price":"25142.0","type":"if","prev_close_price":"25050.55"}
On Index: {"ch":"56.95","high_price":"55993.65","ltp":"55755.45","exch_feed_time":"1755770691","chp":"0.1","low_price":"55708.2","open_price":"55972.05","type":"if","prev_close_price":"55698.5"}

Code:

private void connectSocket(){
    log.info("Connecting to Fyers WebSocket...");
    FyersSocket client = new FyersSocket();
    client.ReconnectAttemptsCount = 1;
    client.webSocketDelegate = this;

    client.Connect();
    client.ConnectHSM(ChannelModes.FULL);
    client.Subscribe(Arrays.stream(symbols).toList());
    client.SubscribeData(Arrays.stream(symbols).toList());
    log.info("WebSocket connection initiated for symbols: {}", Arrays.toString(symbols));
}

@Override
public void OnIndex(JSONObject index) {
    System.out.println("On Index: " + index.toString());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions