Skip to content

The official PHP client library for the Kite Connect trading APIs

Notifications You must be signed in to change notification settings

kssujithcj/phpkiteconnect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

The Kite Connect API PHP client

The official PHP client for communicating with the Kite Connect API.

Kite Connect is a set of REST-like APIs that expose many capabilities required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (WebSockets), and more, with the simple HTTP API collection.

Rainmatter (c) 2016. Licensed under the MIT License.

Documentation

Installing

Download kiteconnect.php and include() it in your application.

Usage

<?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->requestAccessToken("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->positions());

	// Place order.
	$order_id = $kite->orderPlace([
		"tradingsymbol" => "INFY",
		"exchange" => "NSE",
		"quantity" => 1,
		"transaction_type" => "BUY",
		"order_type" => "MARKET",
		"product" => "NRML"
	], "regular");

	echo "Order id is ".$order_id;

Refer to the PHP client documentation for the complete list of supported methods.

Changelog

  • 2016-07-05 Added $parent_order_id to orderModify() and orderCancel() for multi-legged orders.

About

The official PHP client library for the Kite Connect trading APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%