Open NavpreetDevpuri opened 1 month ago
Same 2-5 seconds delay when using the breeze_connect
library
from time import sleep
from breeze_connect import BreezeConnect
# Initialize SDK
breeze = BreezeConnect(api_key="")
# Obtain your session key from https://api.icicidirect.com/apiuser/login?api_key=YOUR_API_KEY
# Incase your api-key has special characters(like +,=,!) then encode the api key before using in the url as shown below.
import urllib
print("https://api.icicidirect.com/apiuser/login?api_key="+urllib.parse.quote_plus(""))
# Generate Session
breeze.generate_session(api_secret="",
session_token="")
# Connect to websocket(it will connect to tick-by-tick data server)
breeze.ws_connect()
# Callback to receive ticks.
def on_ticks(ticks):
print("Ticks: {}".format(ticks))
# Assign the callbacks.
breeze.on_ticks = on_ticks
# subscribe to Real Time Streaming OHLCV Data of stocks by stock-token
breeze.subscribe_feeds(stock_token="4.1!NIFTY 50",interval="1second")
sleep(10000000)
OHLCV Stream Delay, Short Selling Premium, and Charges Overview
Dear BreezeAPI Team,
I am currently using your API to obtain OHLCV data with a 1-second interval. However, the values are delayed by 2-5 seconds, which significantly affects live trading performance. Could you please address this delay issue?
Additionally, I have two more requests:
1. Short Selling Premium Calculation
Could you provide detailed guidance on calculating the short selling premium for backtesting using historical data? A code-based example with Nifty 50 data would be highly appreciated. Currently, I am unable to calculate the accurate premium because it is based on the historical options premium, which I am having trouble obtaining.
2. Charges Breakdown
Please provide a detailed breakdown of all charges involved in short selling, including the charges when hedging by buying next week's expiry to reduce the short selling premium of this week's expiry. An example using code would be very helpful. Note that the example provided below for Groww's platform is for a normal buy and sell scenario, not short selling:
Socket Connection Code for Streaming Data
Below is a sample of the socket connection code used for streaming data (priceTracker.js):
Thank you for your assistance.
Best regards, Navpreet Singh