Skip to content

Commit c5eaa09

Browse files
authored
Merge pull request #24 from ranjanrak/add-ttl-iceberg
feat: add iceberg & TTL orders with phpUnit test run in github workflow
2 parents 58c9af5 + a7438c0 commit c5eaa09

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

.github/workflows/php-test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Tests
2+
3+
on: [push, pull_request]
4+
jobs:
5+
test:
6+
strategy:
7+
matrix:
8+
php-versions: ["8.0", "8.1"]
9+
os: ["ubuntu-latest", "macos-latest"]
10+
phpunit-versions: ["9.5.4"]
11+
12+
runs-on: ${{ matrix.os }}
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: ${{ matrix.php-versions }}
21+
22+
- name: Install composer dependencies
23+
run: composer install --no-scripts
24+
25+
- name: Install PHPUnit
26+
run: composer global require "phpunit/phpunit=${{ matrix.phpunit-versions }}"
27+
28+
- name: PHPUnit tests
29+
run: ~/.composer/vendor/bin/phpunit tests

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
# The Kite Connect API PHP client - v3
2+
23
The Official PHP client for communicating with the [Kite Connect API](https://kite.trade).<br />
34

4-
Note: For PHP version < 7.3. You can refer to our [previous version](https://github.com/zerodha/phpkiteconnect/releases/tag/v3.0.0).
5+
Note: For PHP version < 8.0. You can refer to our [previous version](https://github.com/zerodha/phpkiteconnect/releases/tag/v3.0.0).
56
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 and more, with the simple HTTP API collection.
67

78
[Zerodha Technology](http://zerodha.com) (c) 2021. Licensed under the MIT License.
89

910
## Documentation
11+
1012
- [PHP client documentation](https://kite.trade/docs/phpkiteconnect/v3)
1113
- [Kite Connect HTTP API documentation](https://kite.trade/docs/connect/v3)
1214

1315
## Installing
16+
1417
### Requirements
15-
1. Install [PHP](https://www.php.net/manual/en/install.php) version 7.3 or higher.
18+
19+
1. Install [PHP](https://www.php.net/manual/en/install.php) version 8.0 or higher.
1620
2. Install [Composer](https://getcomposer.org/download/), which is used to install PHP packages.
1721

1822
You can install the package via composer:
23+
1924
```bash
2025
composer require zerodha/phpkiteconnect
2126
```
22-
Note: You can refer to our previous version [here](https://github.com/zerodha/phpkiteconnect/releases/tag/v3.0.0) for PHP version < 7.3.
27+
28+
Note: You can refer to our previous version [here](https://github.com/zerodha/phpkiteconnect/releases/tag/v3.0.0) for PHP version < 8.0.
2329

2430
## Usage
31+
2532
```php
2633
<?php
2734
require_once __DIR__ . '/vendor/autoload.php';
28-
35+
2936
use KiteConnect\KiteConnect;
3037

3138
// Initialise.
@@ -71,9 +78,11 @@ Check [examples folder](https://github.com/zerodha/phpkiteconnect/tree/master/ex
7178
Refer to the [PHP client documentation](https://kite.trade/docs/phpkiteconnect/v3) for the complete list of supported methods.
7279

7380
## Run unit tests
81+
7482
```
7583
phpunit tests/KiteConnectTest.php
7684
```
7785

7886
## Changelog
79-
[Check CHANGELOG.md](CHANGELOG.md)
87+
88+
[Check CHANGELOG.md](CHANGELOG.md)

src/KiteConnect.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class KiteConnect
8585
public const VARIETY_BO = "bo";
8686
public const VARIETY_CO = "co";
8787
public const VARIETY_AMO = "amo";
88+
public const VARIETY_ICEBERG = "iceberg";
8889

8990
// Transaction type
9091
public const TRANSACTION_TYPE_BUY = "BUY";
@@ -93,6 +94,7 @@ class KiteConnect
9394
// Validity
9495
public const VALIDITY_DAY = "DAY";
9596
public const VALIDITY_IOC = "IOC";
97+
public const VALIDITY_TTL = "TTL";
9698

9799
// Margins segments
98100
public const MARGIN_EQUITY = "equity";
@@ -449,6 +451,9 @@ public function getMargins(?string $segment = null): mixed
449451
* $params float|null "squareoff" (Mandatory only for bracker orders) Square off value
450452
* $params float|null "stoploss" (Mandatory only for bracker orders) Stoploss value
451453
* $params float|null "trailing_stoploss" (Optional) Trailing stoploss value (only for bracket orders)
454+
* $params int|null "validity_ttl" Order validity in minutes for TTL validity orders
455+
* $params int|null "iceberg_legs" Total number of legs for iceberg order variety
456+
* $params int|null "iceberg_quantity" Split quantity for each iceberg leg order
452457
* $params float|null "tag" (Optional) Order tag
453458
* $params string|null "validity" (Optional) Order validity (DAY, IOC).
454459
* @return mixed|null

0 commit comments

Comments
 (0)