@Moderator_2 : Hi historical api for nifty50 doesn't work.
Please let me know which token should be used ? or the api is down?
i tried 2 and 26000 both , but doesn't work.
I will have to shift to another platform for algo trading if it doesn't work, since it is super important for me for options backtesting
coolankurmahe
@coolankurmahe
Best posts made by coolankurmahe
-
RE: How do I get historical Index Data for NIFTY/SENSEX?
-
OpenAPIScripMaster.json is down and shows null .Also at what rate it gets refreshed ?
Hi,
I wanted to let the team know that OpenAPIScripMaster.json is down and retuning null.
Also, wanted to know for much time I can cache the OpenAPIScripMaster.json in my local system ? I have seen generally tokens are not changing on daily basis.
I am mostly dealing with options. Nifty etc.
Latest posts made by coolankurmahe
-
"funds withdrawn" not visible in angel one website
I had noticed couple of times funds got withdrawn due to Sebi policy. But they appear with "funds withdrawn" for sometime and they vanish.
why in "fund transaction details" ,"funds withdrawn" not visible in angel one website ? -
"funds withdrawn" not visible in angel one website
I had noticed couple of times funds got withdrawn due to Sebi policy. But they appear with "funds withdrawn" for sometime and they vanish.
why in "fund transaction details" ,"funds withdrawn" not visible in angel one website ? -
RE: Can we modify partially filled order using smart api?
@Moderator_3 As stated above, I was asking if the order is already partially filled, then we can still modify the limit price ? Can you please confirm ? if yes, please share the client code ?
I had come across "Yes, you can modify or cancel a limit order before execution. You can adjust the limit price or quantity unless it’s already been partially or fully executed."
in https://www.angelone.in/knowledge-center/online-share-trading/what-is-limit-order-and-how-it-is-used
which states we can't is it is partially filled. -
Can we modify partially filled order using smart api?
If I place limit order with quantity 100, then it gets partially fulfilled example 50 out of 100 quantity got filled. Then if i use modifyOrder API to modify the limit price or quantity of order, is it possible ?
Or I need to cancel this order and place another order with new left out quantity ? -
getMarginApi Api returns wrong margin for Nifty futures ? [Urgent]
getMarginApi returns following normally response for June Nifty Futures:
{'status': True, 'message': 'SUCCESS', 'errorcode': '', 'data': {'totalMarginRequired': 65482.09, 'marginComponents': {'netPremium': 182130.0, 'spanMargin': 400425.5, 'marginBenefit': 84922.0, 'deliveryMargin': 0.0, 'nonNFOMargin': 0.0, 'totOptionsPremium': 0.0}, 'marginBreakup': [{'exchange': 'NFO', 'productType': 'CARRYFORWARD', 'totalMarginRequired': 65482.09}], 'optionsBuy': {'totOptionsPremium': 0.0, 'optionDetails': []}}}So as can be seen 65482.09 is the margin for 1 lot (25 quantity).
Today at 10:45 AM when this Api gets called , my code had also placed order for Nifty Call option as well and when checking margin using getMarginApi got following response:
{'status': True, 'message': 'SUCCESS', 'errorcode': '', 'data': {'totalMarginRequired': 11554.58, 'marginComponents': {'netPremium': 182130.0, 'spanMargin': 0.0, 'marginBenefit': 53927.5, 'deliveryMargin': 0.0, 'nonNFOMargin': 0.0, 'totOptionsPremium': 0.0}, 'marginBreakup': [{'exchange': 'NFO', 'productType': 'CARRYFORWARD', 'totalMarginRequired': 11554.58}], 'optionsBuy': {'totOptionsPremium': 0.0, 'optionDetails': []}}}I had kept the capital for futures to be 1 Lakh
Since the margin using above Api came out to be 11554.58, I calculate the actual future quantity to be placed for order as below:
actualFutureQuantity = (int)(capital/oneLotMargin)*futureLostSize
which in this case is (int)(100000/11554.58)*25 = 8So 8 lots(200 quantity) order was placed for Nifty futures.
But the problem is I can see 4.3 lakhs have been deducted from my account rather than anything near to 1 lakh.Below is Nifty future order response:
orderResponse : {'status': True, 'message': 'SUCCESS', 'errorcode': '', 'data': {'variety': 'NORMAL', 'ordertype': 'MARKET', 'producttype': 'CARRYFORWARD', 'duration': 'DAY', 'price': 0.0, 'triggerprice': 0.0, 'quantity': '200', 'disclosedquantity': '0', 'squareoff': 0.0, 'stoploss': 0.0, 'trailingstoploss': 0.0, 'tradingsymbol': 'NIFTY27JUN24FUT', 'transactiontype': 'BUY', 'exchange': 'NFO', 'symboltoken': '35004', 'instrumenttype': 'FUTIDX', 'strikeprice': -1.0, 'optiontype': 'XX', 'expirydate': '27JUN2024', 'lotsize': '25', 'cancelsize': '0', 'averageprice': 23152.78, 'filledshares': '200', 'unfilledshares': '0', 'orderid': '240527000529143', 'text': '', 'status': 'complete', 'orderstatus': 'complete', 'updatetime': '27-May-2024 10:45:03', 'exchtime': '27-May-2024 10:45:03', 'exchorderupdatetime': '27-May-2024 10:45:03', 'fillid': '', 'filltime': '', 'parentorderid': '', 'ordertag': '', 'uniqueorderid': 'c5acc46f-9919-4d3c-bd55-34afdf75cb5c'}}Please let me know the problem here ? Also, how should the margin just for futures should be calculated ? Why there is difference in one response to another of getMarginApi - 11554.58 rather than 65482.09 for one lot(25 qty).
Also, if 11554.58 is the right margin, it didn't deduct 1 lakh but 4.3 lakh from my account.Please let me know as it urgent.
-
Do the current month nifty future data/chart provide historical data for expired future contracts as well
I can see the data for NIFTY30MAY24FUT symboltoken = 46930 (which is future contract for current month).
But it also shows in charts and data pulled by getCandleData API the data for previous months, past years though the future contract lasts for only 3 months.Does this mean current month future contract data shows historical data of expired future contracts for each month ?
example: currently NIFTY30MAY24FUT (future contract for May expiry Nifty) shows data for :
May - current month expiry
April- April month expired future data
March - March month expired future data
etc etc ?
Is the above assessment correct ?
If yes, does this also hold for stock futures ? -
Do the current month nifty future data/chart provide historical data for expired future contracts as well
I can see the data for NIFTY30MAY24FUT symboltoken = 46930 (which is future contract for current month).
But it also shows in charts and data pulled by getCandleData API the data for previous months, past years though the future contract lasts for only 3 months.Does this mean current month future contract data shows historical data of expired future contracts for each month ?
example: currently NIFTY30MAY24FUT (future contract for May expiry Nifty) shows data for :
May - current month expiry
April- April month expired future data
March - March month expired future data
etc etc ?If yes, does this also hold for stock futures ?
-
RE: Option Actual Buy Price is not the same(way more than) as returned averageprice from individual_order_details API
@Moderator_1
Hi, But in my case it is reverse , right.
Can you go through above post carefully ?
Average price that was returned was 170.7 as shown in response also.
The buy price was at 183 . It should had never happened because even a lot of next minutes candles at and after 12:01 PM on 15th May, 2024 for above mentioned option never crossed 174 ish.
So, I am not sure where this 183 came from which shows in my order history as buy price on Angel One UI. -
Option Actual Buy Price is not the same(way more than) as returned averageprice from individual_order_details API
@administrators
Please reply this to the earliest as this is related to in-consistency of order's price.
Please take it is urgency as I won't trust if the reasoning of this is not known.The order was placed yesterday (15th May, 2024) through my algo at 12:30:01 for OptionSymbol NIFTY23MAY2422250CE OptionToken 38748
Soon after order was successfully placed, I am fetching order details through individual_order_details API and it returned as following .orderResponse : {'status': True, 'message': 'SUCCESS', 'errorcode': '', 'data': {'variety': 'NORMAL', 'ordertype': 'MARKET', 'producttype': 'CARRYFORWARD', 'duration': 'DAY', 'price': 0.0, 'triggerprice': 0.0, 'quantity': '50', 'disclosedquantity': '0', 'squareoff': 0.0, 'stoploss': 0.0, 'trailingstoploss': 0.0, 'tradingsymbol': 'NIFTY23MAY2422250CE', 'transactiontype': 'BUY', 'exchange': 'NFO', 'symboltoken': '38748', 'instrumenttype': 'OPTIDX', 'strikeprice': 22250.0, 'optiontype': 'CE', 'expirydate': '23MAY2024', 'lotsize': '25', 'cancelsize': '0', 'averageprice': 170.7, 'filledshares': '50', 'unfilledshares': '0', 'orderid': '240515000931623', 'text': '', 'status': 'complete', 'orderstatus': 'complete', 'updatetime': '15-May-2024 12:30:01', 'exchtime': '15-May-2024 12:30:01', 'exchorderupdatetime': '15-May-2024 12:30:01', 'fillid': '', 'filltime': '', 'parentorderid': '', 'ordertag': '', 'uniqueorderid': 'd482ecee-05ef-47c2-afcc-0795978a6bf6'}}
The averageprice is 170.7 in above response and also I can see max 172 in the many next few seconds candle(you can check the candles on angel one UI).
Then, why Angel One UI shows 183 as buy price in my order history and even the loss is also calculated based on that ?
How can this data be so in-consistent when it doesn't match with returned response and candle data of Angel One UI.
Do the return response of individual_order_details API don't give correct averageprice for the order ?
How to make sure we get right buy price ? limit order rather than market order ?
or any other solution you have ? -
RE: logzero not working with smartapi-python==1.4.8 and latest smartapi-python sdk
@Moderator_3 @astrokabir : I figured out the bug at https://github.com/angel-one/smartapi-python/blob/main/SmartApi/smartConnect.py#L131. This bug was introduced in this commit
The loglevel should be logging.INFO rather than logging.ERROR.
It works fine on Linux after making just above correction.
But it still doesn't work on Mac.
@Moderator_3 : Can you get it replicated on Mac and see if it works ?