Idirect-Tech / Breeze-JS-SDK

The official Python client library for the ICICI Securities trading APIs
7 stars 6 forks source link

Market Data Received Out of Order (Timestamp Issue) in BreezeConnect #20

Open NavpreetDevpuri opened 1 month ago

NavpreetDevpuri commented 1 month ago

Issue Description

I'm encountering an issue where the data received via breeze.subscribeFeeds appears out of order based on the datetime field.

Code

const { BreezeConnect } = require("breezeconnect");
const config = require("./config");

const breeze = new BreezeConnect({
  appKey: config.breeze.apiKey,
});

async function main() {
  await breeze.generateSession(config.breeze.apiKey, config.breeze.sessionToken);
  await breeze.connect({});
  await breeze.subscribeFeeds({ exchangeCode: "NFO", stockCode: "NIFTY", productType: "Options", expiryDate: '26-Sep-2024', strikePrice: 25750, right: "Call", getExchangeQuotes: true, getMarketDepth: true, getOrderNotification: false, interval: "1second" });

  breeze.onTicks = (data) => {
    console.log(data);
  }

}

main().catch((err) => console.error(err));

Example Data

{
  interval: '1second',
  exchange_code: 'NFO',
  stock_code: 'NIFTY',
  expiry_date: '26-Sep-2024',
  strike_price: '25750.0',
  right_type: 'CE',
  low: '72.8',
  high: '72.8',
  open: '72.8',
  close: '72.8',
  volume: '0',
  oi: '1340525',
  datetime: '2024-09-20 13:41:17'
}
{
  interval: '1second',
  exchange_code: 'NFO',
  stock_code: 'NIFTY',
  expiry_date: '26-Sep-2024',
  strike_price: '25750.0',
  right_type: 'CE',
  low: '72.65',
  high: '72.65',
  open: '72.65',
  close: '72.65',
  volume: '5075',
  oi: '1340525',
  datetime: '2024-09-20 13:41:06'
}
{
  interval: '1second',
  exchange_code: 'NFO',
  stock_code: 'NIFTY',
  expiry_date: '26-Sep-2024',
  strike_price: '25750.0',
  right_type: 'CE',
  low: '71.75',
  high: '73.05',
  open: '73.05',
  close: '71.75',
  volume: '3375',
  oi: '1340525',
  datetime: '2024-09-20 13:41:09'
}
{
  interval: '1second',
  exchange_code: 'NFO',
  stock_code: 'NIFTY',
  expiry_date: '26-Sep-2024',
  strike_price: '25750.0',
  right_type: 'CE',
  low: '72.6',
  high: '72.6',
  open: '72.6',
  close: '72.6',
  volume: '0',
  oi: '1340525',
  datetime: '2024-09-20 13:41:05'
}

Issue

Expected Behavior

Environment Details

Steps to Reproduce

  1. Use the provided code to subscribe to a market feed.
  2. Observe the data being logged; some updates are out of order based on datetime.
Idirect-Tech commented 1 month ago

Dear Client,

Please refer below sample code to subscribe Live feeds, Ohlc feeds and order notifications.

Live Feeds

//subscribe stocks feeds breeze.subscribeFeeds( { exchangeCode:"NFO", stockCode:"ZEEENT", productType:"options", expiryDate:"31-Mar-2022", strikePrice:"350", right:"Call", getExchangeQuotes:true, getMarketDepth:false } ).then(function(resp){console.log(resp)});

OHLC Feeds

//subscribe to Real Time Streaming OHLCV Data of stocks breeze.subscribFeeds( { exchangeCode:"NFO", stockCode:"ZEEENT", productType:"options", expiryDate:"31-Mar-2022", strikePrice:"350", right:"Call", getExchangeQuotes:true, getMarketDepth:false, interval:"1minute" } ).then(function(resp){console.log(resp)});

Get_Order_Notification

//subscribe order notification feeds(it will connect to order streaming server) breeze.subscribeFeeds({getOrderNotification:true}).then( function(resp){ console.log(resp); } )

[E29CF836]

Thanks & Regards,

Hiten Solanki,

Team Breeze API,

ICICI Securities


From: Navpreet Singh Devpuri @.> Sent: Friday, September 20, 2024 2:11 PM To: Idirect-Tech/Breeze-JS-SDK @.> Cc: Subscribed @.***> Subject: [Idirect-Tech/Breeze-JS-SDK] Market Data Received Out of Order (Timestamp Issue) in BreezeConnect (Issue #20)

CAUTION: This email originated from outside the organization! Do not click links, open attachments or reply, unless you recognize the sender's email address! Use 'Report suspicious Email' button in the toolbar to report Phishing mails. Beware!

Issue Description

I'm encountering an issue where the data received via breeze.subscribeFeeds appears out of order based on the datetime field.

Code

const { BreezeConnect } = require("breezeconnect"); const config = require("./config");

const breeze = new BreezeConnect({ appKey: config.breeze.apiKey, });

async function main() { await breeze.generateSession(config.breeze.apiKey, config.breeze.sessionToken); await breeze.connect({}); await breeze.subscribeFeeds({ exchangeCode: "NFO", stockCode: "NIFTY", productType: "Options", expiryDate: '26-Sep-2024', strikePrice: 25750, right: "Call", getExchangeQuotes: true, getMarketDepth: true, getOrderNotification: false, interval: "1second" });

breeze.onTicks = (data) => { console.log(data); }

}

main().catch((err) => console.error(err));

Example Data

{ interval: '1second', exchange_code: 'NFO', stock_code: 'NIFTY', expiry_date: '26-Sep-2024', strike_price: '25750.0', right_type: 'CE', low: '72.8', high: '72.8', open: '72.8', close: '72.8', volume: '0', oi: '1340525', datetime: '2024-09-20 13:41:17' } { interval: '1second', exchange_code: 'NFO', stock_code: 'NIFTY', expiry_date: '26-Sep-2024', strike_price: '25750.0', right_type: 'CE', low: '72.65', high: '72.65', open: '72.65', close: '72.65', volume: '5075', oi: '1340525', datetime: '2024-09-20 13:41:06' } { interval: '1second', exchange_code: 'NFO', stock_code: 'NIFTY', expiry_date: '26-Sep-2024', strike_price: '25750.0', right_type: 'CE', low: '71.75', high: '73.05', open: '73.05', close: '71.75', volume: '3375', oi: '1340525', datetime: '2024-09-20 13:41:09' } { interval: '1second', exchange_code: 'NFO', stock_code: 'NIFTY', expiry_date: '26-Sep-2024', strike_price: '25750.0', right_type: 'CE', low: '72.6', high: '72.6', open: '72.6', close: '72.6', volume: '0', oi: '1340525', datetime: '2024-09-20 13:41:05' }

Issue

Expected Behavior

Environment Details

Steps to Reproduce

  1. Use the provided code to subscribe to a market feed.
  2. Observe the data being logged; some updates are out of order based on datetime.

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-JS-SDK/issues/20, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ44IFFNV2QMMF25WHBLZXPNVFAVCNFSM6AAAAABORR3VHOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUZTQMRTGUYTCOI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Print this mail only if absolutely necessary. Save Paper. Save Trees." "The information contained in this e-mail and any attachments to this message are intended for the exclusive use of the intended recipient and may contain proprietary, confidential or legally privileged information. If you are not the intended recipient, please note that you are not authorised to disseminate, distribute or copy this e-mail or any parts of it or act upon/rely on the contents of this e-mail in any manner. Please notify the sender immediately by e-mail and destroy all copies of this e-mail and any attachments. Please also note that ICICI Bank or its subsidiaries and associated companies, (collectively "ICICI Group"), are unable to exercise control or ensure the integrity of/over the contents of the information contained in e-mail transmissions and that any views expressed in this e-mail are not endorsed by/binding on the ICICI Group unless the sender does so expressly with due authority of ICICI Group. Before opening any attachments please check them for viruses and defects and please note that ICICI Group accepts no liability or responsibility for any damage caused by any virus that may be transmitted by this email. Any unauthorized use of this email or any attachment(s) may be treated as infringement of right(s) including right of privacy under the applicable laws of India including Information and Technology Act, 2000. Thank you for your cooperation. Regulatory Disclosures are available on https://www.icicisecurities.com (for institutional business) and www.icicidirect.com (for retail business).