File tree Expand file tree Collapse file tree 4 files changed +46
-1
lines changed
Expand file tree Collapse file tree 4 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 22
33All notable changes to ` phpkiteconnect ` will be documented in this file.
44
5+ ## 5.1.0 - 2026-03-27
6+ - Added ` MARKET_PROTECTION_AUTO ` constant (` -1 ` ) for system-default market protection
7+ - Added ` market_protection ` parameter support for ` placeOrder ` and ` modifyOrder `
8+ - Added tests for ` placeOrder ` and ` modifyOrder ` with ` market_protection `
9+
510## 4.0.0 - 2021-04-06
611- Major refactor to project structure and code
712- PHP support 7.3+
Original file line number Diff line number Diff line change @@ -121,7 +121,10 @@ class KiteConnect
121121 public const POSITION_TYPE_DAY = "day " ;
122122 public const POSITION_TYPE_OVERNIGHT = "overnight " ;
123123
124- public const VERSION = "3.2.0 " ;
124+ // Market protection
125+ public const MARKET_PROTECTION_AUTO = -1 ;
126+
127+ public const VERSION = "5.1.0 " ;
125128
126129 // Kite connect header version
127130 private $ kiteVersion = "3 " ;
@@ -465,6 +468,7 @@ public function getMargins(?string $segment = null): mixed
465468 * $params int|null "auction_number" A unique identifier for a particular auction
466469 * $params float|null "tag" (Optional) Order tag
467470 * $params string|null "validity" (Optional) Order validity (DAY, IOC).
471+ * $params float "market_protection" Set to -1 for system-default market protection, or a percentage value greater than 0 up to 100
468472 * @return mixed|null
469473 * @throws DataException
470474 * @throws GeneralException
@@ -494,6 +498,7 @@ public function placeOrder(string $variety, array $params)
494498 * $params float|null "price" (Optional) Order Price
495499 * $params float|null "trigger_price" (Optional) Trigger price
496500 * $params string|null "validity" (Optional) Order validity (DAY, IOC).
501+ * $params float|null "market_protection" (Optional) Set to -1 for system-default market protection, or a percentage value greater than 0 up to 100
497502 *
498503 * @return mixed
499504 * @throws DataException
Original file line number Diff line number Diff line change @@ -204,6 +204,39 @@ public function placeOrderTest($kiteConnect): void
204204
205205 }
206206
207+ /**
208+ * @depends initializeMock
209+ * @test placeOrder with market_protection
210+ */
211+ public function placeOrderWithMarketProtectionTest ($ kiteConnect ): void
212+ {
213+ $ response = $ kiteConnect ->placeOrder ("regular " , [
214+ "tradingsymbol " => "INFY " ,
215+ "exchange " => "NSE " ,
216+ "quantity " => 1 ,
217+ "transaction_type " => "BUY " ,
218+ "order_type " => "MARKET " ,
219+ "product " => "NRML " ,
220+ "market_protection " => KiteConnect::MARKET_PROTECTION_AUTO
221+ ]);
222+
223+ $ this ->assertObjectHasProperty ('order_id ' , $ response );
224+ }
225+
226+ /**
227+ * @depends initializeMock
228+ * @test modifyOrder with market_protection
229+ */
230+ public function modifyOrderWithMarketProtectionTest ($ kiteConnect ): void
231+ {
232+ $ response = $ kiteConnect ->modifyOrder ("regular " , "123456789 " , [
233+ "price " => 10 ,
234+ "market_protection " => KiteConnect::MARKET_PROTECTION_AUTO
235+ ]);
236+
237+ $ this ->assertObjectHasProperty ('order_id ' , $ response );
238+ }
239+
207240 /**
208241 * @depends initializeMock
209242 * @test getOrders
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ public function generateMock()
2626 $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("holdings.json " ));
2727 $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("positions.json " ));
2828 $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("order_response.json " ));
29+ $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("order_response.json " ));
30+ $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("order_modify.json " ));
2931 $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("orders.json " ));
3032 $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("order_info.json " ));
3133 $ response_array [] = new Response ($ status_code , $ header_content , $ this ->fetchMock ("order_trades.json " ));
You can’t perform that action at this time.
0 commit comments