☰
Login
Signup
Home
›
Python client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.9K
All Categories
0
Incidents
156
Node JS client
40
Go client
793
.Net API client
380
Kite Publisher
537
.Net / VBA / Excel (3rd party)
458
Algorithms and Strategies
998
Java client
1.1K
API clients
404
PHP client
4K
Python client
348
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
December 2019
rakeshr
Bracket Order with Product Type MIS got rejected
Vishy
December 2019
in
Python client
Hi,
I have a python client which places buy/Sell orders based on certain conditions.
Following is the python code that places Sell Order.
A Sell order as placed in Ultratech cement and it got rejected even though there was enough cash in account.
Could anyone help me understand the mistake in code? Folloing is the code
def PlaceSellOrder(trade,trading_symbol,low,high,price):
entry_price = price
exit_price = trade['stoploss'] # OR sell level + ATR
# profit_price = trade['Sell Price'] - (trade['stoploss'] - trade['Sell Price'])/2
# quantity = round(GetProfitLimit()/(trade['stoploss'] - trade['Sell Price']))
quantity = round(getNetWworthPerTrade()/trade['Sell Price'])
profit_price = trade['Sell Price'] - GetProfitLimit()/quantity
# quantity = 1 # for testing purpose
kite.place_order(variety = kite.VARIETY_BO,
exchange = kite.EXCHANGE_NSE,
tradingsymbol = trading_symbol,
transaction_type = kite.TRANSACTION_TYPE_SELL,
quantity = quantity,
product = kite.PRODUCT_MIS,
order_type = kite.ORDER_TYPE_LIMIT,
price = entry_price,
squareoff=profit_price,
stoploss=exit_price)
image.png
108.6K
rakeshr
December 2019
@Vishy
As the error states, there is insufficient margin availability.You can check both the available margin and required margin in the above rejection statement.
Sign In
or
Register
to comment.
As the error states, there is insufficient margin availability.You can check both the available margin and required margin in the above rejection statement.