@Sandeep_Prakash Maybe the Zerodha team knows. Sometimes it is about cost benefit analysis. Do we really need so much Exception information ?
So long as you read the document and do it correct, you wouldn't need any Exception information
Best is to do real trading with very low position size. There are so many things that you would miss out on in simulated trading
1. Slippage
2. Spread loss
3. Taxes that ultimately reduce your real net profit
I have never heard of Black76
There is only Back-Scholes Option Pricing model.
Someone wrote it in C#
https://gist.github.com/achvaicer/598242286181f5c501498a645e96f8ac
and also one more guy
https://github.com/MichaelKono/BlackScholesOptionsCal…
Simple moving average is the simple average of the last 9 period Price
Exponential moving average different in that when your new value E
E_new = New_Data * factor + (1 - factor) * E_current
factor in your case would be 2 / (n + 1) means 2 / ( 9 +…
I wrote a program to connect to the SMPP server, which was sending sending data to me. So I used MSG_PEEK as the flag in recv to read the size of the incoming data, to malloc the buffer variable size exactly as much the incoming data
Unless am unde…
It sounds similar to C
In C programming if I have to optimally allocate memory to the data buffer, I must know the size of incoming data and for that MSG_PEEK flag is used with recv
Then with malloc exact size is allocated to the buffer. In next s…
@Gjain75
1. Remember no matter how much you disagree and avenge by taunting, what I said is the truth
2. Zerodha as well as you are using tech stack / language that is open source made by those who were never paid
@Rupali Yes, I was wondering why you are fetching via LTP
You can use web socket and write it to Redis and then any thread can read from there. This is best way
Note, don't do any computation inside
on_ticks
Just read and push it to a queue fro…
@Rupali
1. Install Redis or Memcache
2. Create an independent thread, whose task should be bulk batch polling for LTP of stocks you are looking for and it then updates a cache like Redis
3. Ensure this #1 thread internally honours the rate limit
…
@Gjain75 don't mind but I think you are learning python and Kite API together
Whereas you should learn python programming properly first and then get into kite api
You might disagree and I might be sounding discouraging but am telling you what is…
@Rupali
1. You can run as many threads as you want so long as you comply with rate limit. Read #3
2. How would upgrading hardware solve ? Putting a super computer at your side still won't permit you to hit millions requests per second. Your hardwa…
@durghy_trades
1. When you place the order, the function returns order id
2. Kite has on_update call back, which tells you order executed or not and how much filled
3. Also the same on_update call back will tell you if the order id is executed targ…
@Gjain75
I am not from Zerodha but with all the example and so much on youtube, every new joiner on forum cannot expect Zerodha team to handhold people on the very first step - token generation
Till date, I have not come across a single problem f…
@Gjain75
Could you share more part of your code to understand ? It seems you are trying to run something in thread and there is an uncaught error thrown in that thread and because of that the web socket connection is getting closed
While you are …
@damok If you requirement is just number of lots basis amount in your account then just
1. Find the margin for a single lot as per the API provided by Sujith
2. Let us say that comes to margin_required
then using python code, number of lots you can…
@chaklin
Now lets say for today i see holding based on BSE symbol and
i need to sell with NSE, how do i identify NSE symbol for the same either
using instrument list or API?
For this it means the instrument would have a name, but different tra…
I have never used Publisher based stuff you are mentioning. But am sure in that case you would have option to create your call back API and configure it in the Kite Trade Dashboard. Every time order gets executed, your API would be called with data
Those who know don't spend time in claiming that on YouTube. Those who know how to trade, spend time in learning instead of making YouTube videos on how they do things
Also 200 users simultaneously yes. Same price ? Depends if limit orders fill. Wi…
import pandas as pd
df = pd.read_csv('INSTRUMENT_FILE')
dataset = df[ df.exchange.isin( [ 'BSE' , 'NSE' ] ) ] [ [ 'exchange' , 'tradingsymbol' ] ]
Now, you know how you can use dataset data frame to find ?
@developer
I know on in python client, you have a call back function on_update and using that, you can get executed orders call back. In that JSON data you can get what you want
Am sure it would be applicable similarly in any other client that is…
@SelvaPK
You have to code this using Kite API and execute trade with limit order (entry and exit both) to ensure same returns. Also note that limit orders might not execute always as it depends on how much volume can be filled.
So it is not as st…
@tusharwagh10
I don't find your code complex, just saying approach is not optimal
Instead of all that data frame, you could simple create map of instrument token and trading symbol in the beginning of the program. Don't keep all instruments, just t…
Example below. You can explore more the kite.margins
kite = KiteConnect(api_key = api_key)
kite.set_access_token(access_token)
kite.margins("equity")["available"]["opening_balance"]
I went and before I can think of anything, my first reaction is - "Man what is this inside on_ticks ? "
Sorry, I got stuck looking at this piece of code itself. This snippet is a death nail to on_ticks
def on_ticks(ws, ticks):
#ticks=[dict[ …
@akhil811 because you pasted code and python is an indentation based language, it is not clear whether you have made indentation mistake or not. Please ensure there is no indentation mistake
if you think there is none, then please share exact inden…
@rsamikan actually you have to simulate it and say spread loss. Imagine when you scale this strategy, you would have massive spread loss. I would rather bucket orders and nullify the conjugate orders like these but internally assume them executed at…
@mlearner
create map for your comfort using the instruments files, which you can download at 8:45am
Like below
df = pd.read_csv("all_instruments", low_memory = False)
my_instrument_type = dict( zip( df.instrument_token, df.instrument_type ) )
my…
If you are having only one symbol then use
data = df['last_price'].resample("5T").ohlc()
If you have more than one symbol then you have to first group by symbols and then apply above
@nikaashpuri
This is error is thrown by the Proxy, mostly likely when the actual service behind it is down or latency is very high. Means Zerodha's API micro service behind the Proxy is down
@Akash_Lodha
Upside you are buying CE whereas downside you are selling CE. Fundamentally it should be
1. Buy ATM CE if Nifty Index crosses above RSI 60
2. Buy ATM PE if Nifty Index crosses below RSI 40
Just a thought for you and the one who is c…
@ravik93
I have MacBook with BigSur and have no issues with what you mentioned
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:12:38)
[Clang 11.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more informatio…
@kavanlimbasiya
Run 3 ticker programs, each fetching 900 and pushing it into a queue of a message
Then on the other side use a python program to consumer the queue data
@jijoycanto
Sorry am little late but unless you want to do extremely fast HFT, you don't have to get bothered with so much of latency comparison.
And the day you have to, you won't need Zerodha, you probably would go for direct to NSE connection …
I don't think there is any API route to fetch old orders. But you rather log your orders using
on_order_update
in a file that you can open using pandas or any other analytics tool. Use data filters to check your orders
I think the problem is that you are initialising the sl_factor every time and thus it is getting reset
Are you running this below code inside a quantity / PnL polling loop ? If yes then that is the cause. It should be outside
sl_factor=-1
in your
on_ticks
Whenever you receive a tick write into Redis with a key connection_alive with value 1 and TTL 1 second or whatever x seconds interval you want
SET connection_alive 1 x
At anytime, If you check this key in Redis and you find tha…
@ravimeetra
Simple answer - choose any of the two below
1. Postback
2. Call back to on_order_update
If you don't know these find someone to code this for you.
@ravimeetra I am assuming you are using Kite Tickers for fetching tick data to do programmatic trading and if that be the case then there is
on_order_update
this function receives a order related call back and you can use this
For Web Hook you have to create your application that would bind to a static iP on some Port
then your web hook link would be
http://your_static_ip:port/route
or https whatever you have set in place
@Bromine Pandas OHLC sampling is for offline work not for real time. For real time OHLC over any time frame that you desire, you have to write your own code that does sampling over that time period and saves it into the database
@devarajh Something is wrong with your code. If you are bucketing correctly the OHLC will match with the chart. I have never faced an issue even with 1 minute OHLC without even using sampling
@tusharsinghal309
By doing on command shell
grep BANKNIFTY all_instruments | grep 14000 | grep PE | grep MAR
10539522,41170,BANKNIFTY20MAR14000PE,"BANKNIFTY",0,2020-03-26,14000,0.05,20,PE,NFO-OPT,NFO
So why are you not able to find it ?
def function_to_read_queue():
# this function is run through a thread
# Read queue within endless while loop
# Do all the mess here
def on_ticks(ws, ticks):
# Push ticks in a Queue the ticks and that is it.
# Nothing else unl…
@rhnvrm
I don't get what you mean by below
If last_price is 600. When trigger_value > 650 it should place order.
If last_price is 700. When trigger_value < 650 it should place order.
@sujith thanks for reply. What am trying to understand is for GTT
Limit Price, Transaction Type, SL and TP does the entire work. Something like bracket order
What is the use of last_price ?
@themohammedfaisal thanks
In below I understand trigger values and in orders the price
What is the purpose of last_price if I give my Limit order price
Place GTT order
trigger_type The type of GTT order(single/two-leg).
tradingsymbol Trading sy…
@sujith Just a continuation to this question. If I place a 2000 shares bracket order of ACC, does it count as 1 trade or you count multiple legs as trades ?
1. Read Record and Push it to a Message Broker - preferably RabbitMQ
2. Use Logstash to read from Message Broker and send to SQLite
Only #1 is small bit of programming, #2 is not