-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
715 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
New features | ||
============= | ||
- method: `getProfile` | ||
- method: `getOHLC` | ||
- method: `getLTP` | ||
- method: `getMFOrders` | ||
- method: `getMFHoldings` | ||
- method: `placeMFOrder` | ||
- method: `cancelMFOrder` | ||
- method: `getMFSIPS` | ||
- method: `placeMFSIP` | ||
- method: `modifyMFSIP` | ||
- method: `cancelMFSIP` | ||
- method: `getMFInstruments` | ||
- method: `exitOrder` | ||
- method: `renewAccessToken` | ||
- method: `invalidateRefreshToken` | ||
|
||
API method name changes | ||
======================= | ||
|
||
| v2 | v3 | | ||
| ------------------------- | ------------------------- | | ||
| requestAccessToken | generateSession | | ||
| invalidateToken | invalidateAccessToken | | ||
| setSessionHook | setSessionExpiryHook | | ||
| loginUrl | getLoginURL | | ||
| margins | getMargins | | ||
| orderPlace | placeOrder | | ||
| orderModify | modifyOrder | | ||
| orderCancel | cancelOrder | | ||
| orders | getOrders | | ||
| orders(order_id) | getOrderHistory | | ||
| trades | getTrades | | ||
| trades(order_id) | getOrderTrades | | ||
| holdings | getHoldings | | ||
| positions | getPositions | | ||
| productModify | convertPosition | | ||
| instruments | getInstruments | | ||
| historical | getHistoricalData | | ||
| triggerRange | getTriggerRange | | ||
|
||
Params and other changes | ||
======================== | ||
- `convertPosition` method takes all the params as array | ||
- `getHistoricalData` method takes all the params as array | ||
- [Changes in `generateSession` response structure](https://kite.trade/docs/connect/v3/user/#response-attributes) | ||
- [Changes in `getPositions` response structure](https://kite.trade/docs/connect/v3/portfolio/#response-attributes_1) | ||
- [Changes in `getQuote` response structure](https://kite.trade/docs/connect/v3/market-quotes/#retrieving-full-market-quotes) | ||
- [Changes in `placeOrder` params](https://kite.trade/docs/connect/v3/orders/#bracket-order-bo-parameters) | ||
- Changes in `getHistoricalData` params | ||
- All datetime string fields has been converted to `Date` object. | ||
- `getOrders`, `getOrderHistory`, `getTrades`, `getOrderTrades`, `getMFOrders` responses fields `order_timestamp`, `exchange_timestamp`, `fill_timestamp` | ||
- `getMFSIPS` fields `created`, `last_instalment` | ||
- `generateSession` field `login_time` | ||
- `getQuote` fields `timestamp`, `last_trade_time` | ||
- `getInstruments` field `expiry` | ||
- `getMFInstruments` field `last_price_date` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
include dirname(__FILE__)."/kiteconnect.php"; | ||
|
||
// Initialise. | ||
$kite = new KiteConnect("your_api_key"); | ||
|
||
// Assuming you have obtained the `request_token` | ||
// after the auth flow redirect by redirecting the | ||
// user to $kite->login_url() | ||
try { | ||
$user = $kite->generateSession("request_token_obtained", "your_api_secret"); | ||
|
||
echo "Authentication successful. \n"; | ||
print_r($user); | ||
|
||
$kite->setAccessToken($user->access_token); | ||
} catch(Exception $e) { | ||
echo "Authentication failed: ".$e->getMessage(); | ||
throw $e; | ||
} | ||
|
||
echo $user->user_id." has logged in"; | ||
|
||
// Get the list of positions. | ||
echo "Positions: \n"; | ||
print_r($kite->getPositions()); | ||
|
||
// Get the list of holdings. | ||
echo "Holdings: \n"; | ||
print_r($kite->getHoldings()); | ||
|
||
// Retrieve quote and market depth for list of instruments. | ||
echo "Quote: \n"; | ||
print_r($kite->getQuote(["NSE:INFY", "NSE:SBIN"])); | ||
|
||
// Place order. | ||
$order_id = $kite->placeOrder("regular", [ | ||
"tradingsymbol" => "INFY", | ||
"exchange" => "NSE", | ||
"quantity" => 1, | ||
"transaction_type" => "BUY", | ||
"order_type" => "MARKET", | ||
"product" => "NRML" | ||
])["order_id"]; | ||
|
||
echo "Order id is ".$order_id; | ||
?> |
Oops, something went wrong.