PHPackages                             upstox/upstox-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. upstox/upstox-php-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

upstox/upstox-php-sdk
=====================

The official PHP client for communicating with the Upstox API

v1.22.0(1mo ago)51.1k4[1 PRs](https://github.com/upstox/upstox-php/pulls)MITPHPPHP ^7.4 || ^8.0

Since Jul 12Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/upstox/upstox-php)[ Packagist](https://packagist.org/packages/upstox/upstox-php-sdk)[ Docs](https://github.com/upstox/upstox-php)[ RSS](/packages/upstox-upstox-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (37)Used By (0)

Upstox PHP SDK for API v2
=========================

[](#upstox-php-sdk-for-api-v2)

[![Latest Stable Version](https://camo.githubusercontent.com/2b108b4fbe1a68a5403072a27951a051e216d9eaeadd9442a7b897e6f2c691b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f757073746f782f757073746f782d7068702d73646b2e7376673f6c6162656c3d757073746f782d7068702d73646b)](https://packagist.org/packages/upstox/upstox-php-sdk)

Introduction
------------

[](#introduction)

The official PHP client for communicating with the [Upstox API](https://upstox.com/uplink/).

Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection.

- API version: v2
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

Documentation.
--------------

[](#documentation)

[Upstox API Documentation](https://upstox.com/developer/api-documentation)

Requirements
------------

[](#requirements)

PHP 7.4 and later

Installation &amp; Usage
------------------------

[](#installation--usage)

### Composer

[](#composer)

Run `composer require upstox/upstox-php-sdk` to install the SDK from Packagist.

### Github

[](#github)

#### Composer Installation

[](#composer-installation)

Download the latest release and run `composer install`

#### Manual Installation

[](#manual-installation)

Download the files and include `autoload.php`:

```
    require_once('/path/to/UpstoxClient/vendor/autoload.php');
```

Sandbox Mode
------------

[](#sandbox-mode)

We recommend using the sandbox environment for testing purposes. To enable sandbox mode, set the `sandbox` flag to `true` in the configuration object.

```
$config = Upstox\Client\Configuration::getDefaultConfiguration(sandbox:true)->setAccessToken("SANDBOX_ACCESS_TOKEN");

$apiInstance = new Upstox\Client\Api\OrderApi(
    new GuzzleHttp\Client(),
    $config
);

$body = new \Upstox\Client\Model\PlaceOrderRequest();
$body->setQuantity(1);
$body->setProduct("D");
$body->setValidity("DAY");
$body->setPrice(0);
$body->setTag("string");
$body->setInstrumentToken("NSE_EQ|INE669E01016");
$body->setOrderType("MARKET");
$body->setTransactionType("BUY");
$body->setDisclosedQuantity(0);
$body->setTriggerPrice(0);
$body->setIsAmo(false);
try {
    $result = $apiInstance->placeOrder($body,"2.0");
    print($result);
} catch (Exception $e) {
    print($e->getMessage());
}
```

To learn more about the sandbox environment and the available sandbox APIs, please visit the [Upstox API documentation - Sandbox](https://upstox.com/developer/api-documentation/sandbox).

Algo Name Support
-----------------

[](#algo-name-support)

The SDK supports passing an algorithm name for order tracking and management. When provided, the SDK will pass the algo name as `X-Algo-Name` header.

```
use Upstox\Client\Configuration;
use Upstox\Client\Api\OrderApiV3;
use Upstox\Client\Model\PlaceOrderV3Request;

$config = Configuration::getDefaultConfiguration()->setAccessToken('ACCESS_TOKEN');

$apiInstance = new OrderApiV3(new GuzzleHttp\Client(), $config);
$body = new PlaceOrderV3Request();
$body->setQuantity(1);
$body->setProduct("D");
$body->setValidity("DAY");
$body->setPrice(0);
$body->setInstrumentToken("NSE_EQ|INE528G01035");
$body->setOrderType("MARKET");
$body->setTransactionType("BUY");
$body->setDisclosedQuantity(0);
$body->setTriggerPrice(0);
$body->setIsAmo(false);
$body->setSlice(true);

try {
    $result = $apiInstance->placeOrder($body, "web", "your-algo-name");
    print($result);
} catch (Exception $e) {
    echo "Exception when calling OrderApiV3->placeOrder: " . $e->getMessage() . "\n";
}
```

Other order methods (modify, cancel, etc.) follow the same pattern by accepting an optional `algo_name` as the last parameter.

Example Scripts
---------------

[](#example-scripts)

The [`examples/`](examples/) folder contains ready-to-run scripts covering common API use cases:

FolderDescription[`examples/login/`](examples/login/)OAuth2 authorization flow and access token generation[`examples/orders/`](examples/orders/)Place, modify, cancel, and retrieve orders[`examples/market-quote/`](examples/market-quote/)Fetch live quotes, OHLC, and market depth[`examples/portfolio/`](examples/portfolio/)View holdings, positions, and P&amp;L[`examples/strategies/`](examples/strategies/)33 options trading strategies across four categories### Options Strategy Examples

[](#options-strategy-examples)

The [`examples/strategies/`](examples/strategies/) folder is organized by market outlook:

CategoryStrategies[Bullish](examples/strategies/bullish/)Buy Call, Sell Put, Bull Call Spread, Bull Put Spread, Bull Butterfly, Bull Condor, Long Calendar with Calls, Long Synthetic Future, Call Ratio Back Spread, Range Forward[Bearish](examples/strategies/bearish/)Buy Put, Sell Call, Bear Call Spread, Bear Put Spread, Bear Butterfly, Bear Condor, Long Calendar with Puts, Short Synthetic Future, Put Ratio Back Spread, Risk Reversal[Neutral](examples/strategies/neutral/)Short Straddle, Short Strangle, Iron Butterfly, Batman, Short Iron Condor[Others](examples/strategies/others/)Long Straddle, Long Strangle, Call Ratio Spread, Put Ratio Spread, Long Iron Butterfly, Long Iron Condor, Strip, StrapEach strategy script automatically selects the correct Nifty 50 strikes using `InstrumentsApi::searchInstrument()` and places orders via `OrderApiV3`. Just set your `ACCESS_TOKEN` and run.

Documentation for Feeder Functions
----------------------------------

[](#documentation-for-feeder-functions)

Connecting to the WebSocket for market and portfolio updates is streamlined through two primary Feeder functions:

1. **MarketDataStreamer**: Offers real-time market updates, providing a seamless way to receive instantaneous information on various market instruments.
2. **PortfolioDataStreamer**: Delivers updates related to the user's orders, enhancing the ability to track order status and portfolio changes effectively.

Both functions are designed to simplify the process of subscribing to essential data streams, ensuring users have quick and easy access to the information they need.

### Detailed Explanation of Feeder Interface

[](#detailed-explanation-of-feeder-interface)

### MarketDataStreamer

[](#marketdatastreamer)

The `MarketDataStreamerV3` interface is designed for effortless connection to the market WebSocket, enabling users to receive instantaneous updates on various instruments. The following example demonstrates how to quickly set up and start receiving market updates for selected instrument keys:

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamerV3;
use Revolt\EventLoop;

function on_message($streamer, $data)
{
    print($data);
}

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new MarketDataStreamerV3($config, ["NSE_INDEX|Nifty 50", "NSE_INDEX|Nifty Bank"], "full");

$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();
```

In this example, you first authenticate using an access token, then instantiate MarketDataStreamerV3 with specific instrument keys and a subscription mode. Upon connecting, the streamer listens for market updates, which are logged to the console as they arrive.

Feel free to adjust the access token placeholder and any other specifics to better fit your actual implementation or usage scenario.

### Exploring the MarketDataStreamerV3 Functionality

[](#exploring-the-marketdatastreamerv3-functionality)

#### Modes

[](#modes)

- **ltpc**: ltpc provides information solely about the most recent trade, encompassing details such as the last trade price, time of the last trade, quantity traded, and the closing price from the previous day.
- **full**: The full option offers comprehensive information, including the latest trade prices, D5 depth, 1-minute, 30-minute, and daily candlestick data, along with some additional details.
- **full\_d30**: full\_d30 includes Full mode data plus 30 market level quotes.
- **option\_greeks**: Contains only option greeks.

#### Functions

[](#functions)

1. **constructor MarketDataStreamerV3(apiClient, instrumentKeys, mode)**: Initializes the streamer with optional instrument keys and mode (`full`, `ltpc`, `full_d30` or `option_greeks`).
2. **connect()**: Establishes the WebSocket connection.
3. **subscribe(instrumentKeys, mode)**: Subscribes to updates for given instrument keys in the specified mode. Both parameters are mandatory.
4. **unsubscribe(instrumentKeys)**: Stops updates for the specified instrument keys.
5. **changeMode(instrumentKeys, mode)**: Switches the mode for already subscribed instrument keys.
6. **disconnect()**: Ends the active WebSocket connection.
7. **autoReconnect(enable, interval, retryCount)**: Customizes auto-reconnect functionality. Parameters include a flag to enable/disable it, the interval(in seconds) between attempts, and the maximum number of retries.

#### Events

[](#events)

- **open**: Emitted upon successful connection establishment.
- **close**: Indicates the WebSocket connection has been closed.
- **message**: Delivers market updates.
- **error**: Signals an error has occurred.
- **reconnecting**: Announced when a reconnect attempt is initiated.
- **autoReconnectStopped**: Informs when auto-reconnect efforts have ceased after exhausting the retry count.

The following documentation includes examples to illustrate the usage of these functions and events, providing a practical understanding of how to interact with the MarketDataStreamerV3 effectively.

1. Subscribing to Market Data on Connection Open with MarketDataStreamerV3

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamerV3;
use Revolt\EventLoop;

function on_open($streamer)
{
    print("Connection Established");
    $streamer->subscribe(["NSE_INDEX|Nifty 50", "NSE_INDEX|Nifty Bank"], "full");
}

function on_message($streamer, $data)
{
    print($data);
}

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new MarketDataStreamerV3($config);

$streamer->on("open", 'on_open');
$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();
```

2. Subscribing to Instruments with Delays

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamerV3;
use Revolt\EventLoop;
use function Amp\delay;

function on_open($streamer)
{
    print("Connection Established");
    $streamer->subscribe(["NSE_INDEX|Nifty 50"], "full");
    delay(5);
    $streamer->subscribe(["NSE_INDEX|Nifty Bank"], "full");
}

function on_message($streamer, $data)
{
    print($data);
}

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new MarketDataStreamerV3($config);

$streamer->on("open", 'on_open');
$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();
```

3. Subscribing and Unsubscribing to Instruments

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamerV3;
use Revolt\EventLoop;
use function Amp\delay;

function on_open($streamer)
{
    print("Connection Established");
    $streamer->subscribe(["NSE_EQ|INE020B01018", "NSE_EQ|INE467B01029"], "full_d30");
    delay(5);
    $streamer->unsubscribe(["NSE_EQ|INE020B01018", "NSE_EQ|INE467B01029"]);
}

function on_message($streamer, $data)
{
    print($data);
}

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new MarketDataStreamerV3($config);

$streamer->on("open", 'on_open');
$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();
```

4. Subscribe, Change Mode and Unsubscribe

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamerV3;
use Revolt\EventLoop;
use function Amp\delay;

function on_open($streamer)
{
    print("Connection Established");
    $streamer->subscribe(["NSE_EQ|INE020B01018", "NSE_EQ|INE467B01029"], "full_d30");
    delay(5);
    $streamer->changeMode(
        ["NSE_EQ|INE020B01018", "NSE_EQ|INE467B01029"], "ltpc");
}

function on_message($streamer, $data)
{
    print($data);
}

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new MarketDataStreamerV3($config);

$streamer->on("open", 'on_open');
$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();
```

5. Disable Auto-Reconnect

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamerV3;
use Revolt\EventLoop;

function on_reconnectstopped($streamer, $data)
{
    print($data);
}

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new MarketDataStreamerV3($config);

$streamer->on("autoReconnectStopped", 'on_reconnectstopped');

$streamer->autoReconnect(false);
$streamer->connect();

EventLoop::run();
```

6. Modify Auto-Reconnect parameters

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\MarketDataStreamerV3;
use Revolt\EventLoop;

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new MarketDataStreamerV3($config);

$streamer->autoReconnect(true, 10, 3);
$streamer->connect();

EventLoop::run();
```

### PortfolioDataStreamer

[](#portfoliodatastreamer)

Connecting to the Portfolio WebSocket for real-time order updates is straightforward with the PortfolioDataStreamer function. Below is a concise guide to get you started on receiving updates:

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\PortfolioDataStreamer;
use Revolt\EventLoop;

function on_message($streamer, $data)
{
    print($data);
}

$config = Configuration::getDefaultConfiguration()->setAccessToken();

$streamer = new PortfolioDataStreamer($config);

$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();
```

Position, holding, and GTT order updates can be enabled by setting the corresponding flag to `true` in the constructor of the `PortfolioDataStreamer` class.

```
use Upstox\Client\Configuration;
use Upstox\Client\Feeder\PortfolioDataStreamer;
use Revolt\EventLoop;

function on_message($streamer,$data)
{
    print("on_message= " . ($data) . "\n");
}

$config = Upstox\Client\Configuration::getDefaultConfiguration()->setAccessToken();
$streamer = new PortfolioDataStreamer(
    $config,
    orderUpdate: true,
    holdingUpdate: true,
    positionUpdate: true,
    gttUpdate: true
);

$streamer->on("message", 'on_message');
$streamer->connect();

EventLoop::run();
```

This example demonstrates initializing the PortfolioDataStreamer, connecting it to the WebSocket, and setting up an event listener to receive and print order updates. Replace &lt;ACCESS\_TOKEN&gt; with your valid access token to authenticate the session.

### Exploring the PortfolioDataStreamer Functionality

[](#exploring-the-portfoliodatastreamer-functionality)

#### Functions

[](#functions-1)

1. **constructor PortfolioDataStreamer(config, orderUpdate, holdingUpdate, positionUpdate, gttUpdate)**: Initializes the streamer with options to receive different types of updates.
2. **connect()**: Establishes the WebSocket connection.
3. **disconnect()**: Ends the active WebSocket connection.
4. **autoReconnect(enable, interval, retryCount)**: Customizes auto-reconnect functionality. Parameters include a flag to enable/disable it, the interval(in seconds) between attempts, and the maximum number of retries.

#### Events

[](#events-1)

- **open**: Emitted upon successful connection establishment.
- **close**: Indicates the WebSocket connection has been closed.
- **message**: Delivers market updates.
- **error**: Signals an error has occurred.
- **reconnecting**: Announced when a reconnect attempt is initiated.
- **autoReconnectStopped**: Informs when auto-reconnect efforts have ceased after exhausting the retry count.

Documentation For Models
------------------------

[](#documentation-for-models)

- [AnalyticsData](docs/Model/AnalyticsData.md)
- [ApiGatewayErrorResponse](docs/Model/ApiGatewayErrorResponse.md)
- [BatchExecutionSummary](docs/Model/BatchExecutionSummary.md)
- [BrokerageData](docs/Model/BrokerageData.md)
- [BrokerageTaxes](docs/Model/BrokerageTaxes.md)
- [BrokerageWrapperData](docs/Model/BrokerageWrapperData.md)
- [CancelOrExitMultiOrderData](docs/Model/CancelOrExitMultiOrderData.md)
- [CancelOrExitMultiOrderResponse](docs/Model/CancelOrExitMultiOrderResponse.md)
- [CancelOrExitOrderErrorData](docs/Model/CancelOrExitOrderErrorData.md)
- [CancelOrderData](docs/Model/CancelOrderData.md)
- [CancelOrderResponse](docs/Model/CancelOrderResponse.md)
- [CancelOrderV3Response](docs/Model/CancelOrderV3Response.md)
- [ConvertPositionData](docs/Model/ConvertPositionData.md)
- [ConvertPositionRequest](docs/Model/ConvertPositionRequest.md)
- [ConvertPositionResponse](docs/Model/ConvertPositionResponse.md)
- [Depth](docs/Model/Depth.md)
- [DepthMap](docs/Model/DepthMap.md)
- [DpPlan](docs/Model/DpPlan.md)
- [ExchangeTimingData](docs/Model/ExchangeTimingData.md)
- [ExpiredFutureData](docs/Model/ExpiredFutureData.md)
- [GetBrokerageResponse](docs/Model/GetBrokerageResponse.md)
- [GetExchangeTimingResponse](docs/Model/GetExchangeTimingResponse.md)
- [GetExpiredFuturesContractResponse](docs/Model/GetExpiredFuturesContractResponse.md)
- [GetExpiriesResponse](docs/Model/GetExpiriesResponse.md)
- [GetFullMarketQuoteResponse](docs/Model/GetFullMarketQuoteResponse.md)
- [GetGttOrderResponse](docs/Model/GetGttOrderResponse.md)
- [GetHistoricalCandleResponse](docs/Model/GetHistoricalCandleResponse.md)
- [GetHoldingsResponse](docs/Model/GetHoldingsResponse.md)
- [GetHolidayResponse](docs/Model/GetHolidayResponse.md)
- [GetIntraDayCandleResponse](docs/Model/GetIntraDayCandleResponse.md)
- [GetMarketQuoteLastTradedPriceResponse](docs/Model/GetMarketQuoteLastTradedPriceResponse.md)
- [GetMarketQuoteLastTradedPriceResponseV3](docs/Model/GetMarketQuoteLastTradedPriceResponseV3.md)
- [GetMarketQuoteOHLCResponse](docs/Model/GetMarketQuoteOHLCResponse.md)
- [GetMarketQuoteOHLCResponseV3](docs/Model/GetMarketQuoteOHLCResponseV3.md)
- [GetMarketQuoteOptionGreekResponseV3](docs/Model/GetMarketQuoteOptionGreekResponseV3.md)
- [GetMarketStatusResponse](docs/Model/GetMarketStatusResponse.md)
- [GetOptionChainResponse](docs/Model/GetOptionChainResponse.md)
- [GetOptionContractResponse](docs/Model/GetOptionContractResponse.md)
- [GetOrderBookResponse](docs/Model/GetOrderBookResponse.md)
- [GetOrderDetailsResponse](docs/Model/GetOrderDetailsResponse.md)
- [GetOrderResponse](docs/Model/GetOrderResponse.md)
- [GetPositionResponse](docs/Model/GetPositionResponse.md)
- [GetProfileResponse](docs/Model/GetProfileResponse.md)
- [GetProfitAndLossChargesResponse](docs/Model/GetProfitAndLossChargesResponse.md)
- [GetTradeResponse](docs/Model/GetTradeResponse.md)
- [GetTradeWiseProfitAndLossDataResponse](docs/Model/GetTradeWiseProfitAndLossDataResponse.md)
- [GetTradeWiseProfitAndLossMetaDataResponse](docs/Model/GetTradeWiseProfitAndLossMetaDataResponse.md)
- [GetUserFundMarginResponse](docs/Model/GetUserFundMarginResponse.md)
- [GttCancelOrderRequest](docs/Model/GttCancelOrderRequest.md)
- [GttModifyOrderRequest](docs/Model/GttModifyOrderRequest.md)
- [GttOrderData](docs/Model/GttOrderData.md)
- [GttOrderDetails](docs/Model/GttOrderDetails.md)
- [GttPlaceOrderRequest](docs/Model/GttPlaceOrderRequest.md)
- [GttRule](docs/Model/GttRule.md)
- [GttTriggerOrderResponse](docs/Model/GttTriggerOrderResponse.md)
- [HistoricalCandleData](docs/Model/HistoricalCandleData.md)
- [HoldingsData](docs/Model/HoldingsData.md)
- [HolidayData](docs/Model/HolidayData.md)
- [IndieUserInitTokenData](docs/Model/IndieUserInitTokenData.md)
- [IndieUserInitTokenResponse](docs/Model/IndieUserInitTokenResponse.md)
- [IndieUserTokenRequest](docs/Model/IndieUserTokenRequest.md)
- [Instrument](docs/Model/Instrument.md)
- [InstrumentData](docs/Model/InstrumentData.md)
- [IntraDayCandleData](docs/Model/IntraDayCandleData.md)
- [LogoutResponse](docs/Model/LogoutResponse.md)
- [Margin](docs/Model/Margin.md)
- [MarginData](docs/Model/MarginData.md)
- [MarginRequest](docs/Model/MarginRequest.md)
- [MarketData](docs/Model/MarketData.md)
- [MarketQuoteOHLC](docs/Model/MarketQuoteOHLC.md)
- [MarketQuoteOHLCV3](docs/Model/MarketQuoteOHLCV3.md)
- [MarketQuoteOptionGreekV3](docs/Model/MarketQuoteOptionGreekV3.md)
- [MarketQuoteSymbol](docs/Model/MarketQuoteSymbol.md)
- [MarketQuoteSymbolLtp](docs/Model/MarketQuoteSymbolLtp.md)
- [MarketQuoteSymbolLtpV3](docs/Model/MarketQuoteSymbolLtpV3.md)
- [MarketStatusData](docs/Model/MarketStatusData.md)
- [ModifyOrderData](docs/Model/ModifyOrderData.md)
- [ModifyOrderRequest](docs/Model/ModifyOrderRequest.md)
- [ModifyOrderResponse](docs/Model/ModifyOrderResponse.md)
- [ModifyOrderV3Response](docs/Model/ModifyOrderV3Response.md)
- [MultiOrderData](docs/Model/MultiOrderData.md)
- [MultiOrderError](docs/Model/MultiOrderError.md)
- [MultiOrderRequest](docs/Model/MultiOrderRequest.md)
- [MultiOrderResponse](docs/Model/MultiOrderResponse.md)
- [MultiOrderSummary](docs/Model/MultiOrderSummary.md)
- [MultiOrderV3Data](docs/Model/MultiOrderV3Data.md)
- [OAuthClientException](docs/Model/OAuthClientException.md)
- [OAuthClientExceptionCause](docs/Model/OAuthClientExceptionCause.md)
- [OAuthClientExceptionCauseStackTrace](docs/Model/OAuthClientExceptionCauseStackTrace.md)
- [OAuthClientExceptionCauseSuppressed](docs/Model/OAuthClientExceptionCauseSuppressed.md)
- [Ohlc](docs/Model/Ohlc.md)
- [OhlcV3](docs/Model/OhlcV3.md)
- [OptionStrikeData](docs/Model/OptionStrikeData.md)
- [OrderBookData](docs/Model/OrderBookData.md)
- [OrderData](docs/Model/OrderData.md)
- [OrderMetadata](docs/Model/OrderMetadata.md)
- [OtherTaxes](docs/Model/OtherTaxes.md)
- [PlaceOrderData](docs/Model/PlaceOrderData.md)
- [PlaceOrderRequest](docs/Model/PlaceOrderRequest.md)
- [PlaceOrderResponse](docs/Model/PlaceOrderResponse.md)
- [PlaceOrderV3Request](docs/Model/PlaceOrderV3Request.md)
- [PlaceOrderV3Response](docs/Model/PlaceOrderV3Response.md)
- [PositionData](docs/Model/PositionData.md)
- [PostMarginResponse](docs/Model/PostMarginResponse.md)
- [Problem](docs/Model/Problem.md)
- [ProfileData](docs/Model/ProfileData.md)
- [ProfitAndLossChargesData](docs/Model/ProfitAndLossChargesData.md)
- [ProfitAndLossChargesTaxes](docs/Model/ProfitAndLossChargesTaxes.md)
- [ProfitAndLossChargesWrapperData](docs/Model/ProfitAndLossChargesWrapperData.md)
- [ProfitAndLossMetaData](docs/Model/ProfitAndLossMetaData.md)
- [ProfitAndLossMetaDataWrapper](docs/Model/ProfitAndLossMetaDataWrapper.md)
- [ProfitAndLossOtherChargesTaxes](docs/Model/ProfitAndLossOtherChargesTaxes.md)
- [PutCallOptionChainData](docs/Model/PutCallOptionChainData.md)
- [Rule](docs/Model/Rule.md)
- [TokenRequest](docs/Model/TokenRequest.md)
- [TokenResponse](docs/Model/TokenResponse.md)
- [TradeData](docs/Model/TradeData.md)
- [TradeHistoryResponse](docs/Model/TradeHistoryResponse.md)
- [TradeHistoryResponseMetaData](docs/Model/TradeHistoryResponseMetaData.md)
- [TradeHistoryResponsePageData](docs/Model/TradeHistoryResponsePageData.md)
- [TradeHistoryResponseTradeData](docs/Model/TradeHistoryResponseTradeData.md)
- [TradeWiseMetaData](docs/Model/TradeWiseMetaData.md)
- [TradeWiseProfitAndLossData](docs/Model/TradeWiseProfitAndLossData.md)
- [UserFundMarginData](docs/Model/UserFundMarginData.md)
- [WebsocketAuthRedirectResponse](docs/Model/WebsocketAuthRedirectResponse.md)
- [WebsocketAuthRedirectResponseData](docs/Model/WebsocketAuthRedirectResponseData.md)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance96

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 61.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~63 days

Total

23

Last Release

51d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/16e4715bd27541a427b9bb9e6f9739faa133195a8e13ede582cfbc1d65217c94?d=identicon)[upstox](/maintainers/upstox)

---

Top Contributors

[![KetanGupta12](https://avatars.githubusercontent.com/u/160857068?v=4)](https://github.com/KetanGupta12 "KetanGupta12 (47 commits)")[![Rahulzz](https://avatars.githubusercontent.com/u/20224717?v=4)](https://github.com/Rahulzz "Rahulzz (13 commits)")[![yogendrasrivastava](https://avatars.githubusercontent.com/u/158015200?v=4)](https://github.com/yogendrasrivastava "yogendrasrivastava (11 commits)")[![PradeepJaiswar](https://avatars.githubusercontent.com/u/4545996?v=4)](https://github.com/PradeepJaiswar "PradeepJaiswar (2 commits)")[![anand-sajankar](https://avatars.githubusercontent.com/u/202061354?v=4)](https://github.com/anand-sajankar "anand-sajankar (1 commits)")[![upstox-security-review](https://avatars.githubusercontent.com/u/196019751?v=4)](https://github.com/upstox-security-review "upstox-security-review (1 commits)")[![ITOpx](https://avatars.githubusercontent.com/u/139222425?v=4)](https://github.com/ITOpx "ITOpx (1 commits)")

---

Tags

phpapisdkresttradeupstox

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/upstox-upstox-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/upstox-upstox-php-sdk/health.svg)](https://phpackages.com/packages/upstox-upstox-php-sdk)
```

###  Alternatives

[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34170.2k2](/packages/onesignal-onesignal-php-api)[ory/hydra-client

Documentation for all of Ory Hydra's APIs.

17435.9k](/packages/ory-hydra-client)[zenditplatform/zendit-php-sdk

PHP client for Zendit API

1204.3k](/packages/zenditplatform-zendit-php-sdk)[huaweicloud/huaweicloud-sdk-php

Huawei Cloud SDK for PHP

1829.2k2](/packages/huaweicloud-huaweicloud-sdk-php)[ory/hydra-client-php

Documentation for all of Ory Hydra's APIs.

1710.8k](/packages/ory-hydra-client-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
