☰
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.2K
All Categories
0
Incidents
127
Node JS client
38
Go client
769
.Net API client
362
Kite Publisher
532
.Net / VBA / Excel (3rd party)
437
Algorithms and Strategies
967
Java client
1K
API clients
401
PHP client
3.8K
Python client
331
Mobile and Desktop apps
1.3K
Market data (WebSockets)
3.2K
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.