I have connected the websocket and also fetched the option chain data from api but now I am facing issue in buying and selling feature .How to run buy /sell feature in this for my platform . Response I am getting is:-
Upstox\Client\Model\GetFullMarketQuoteResponse Object
(
[container:protected] => Array
(
[status] => success
[data] => Array
(
[BSE_INDEX:SENSEX] => Upstox\Client\Model\MarketQuoteSymbol Object
(
[container:protected] => Array
(
[ohlc] => Upstox\Client\Model\Ohlc Object
(
[container:protected] => Array
(
[open] => 75672.84
[high] => 75794.15
[low] => 75463.01
[close] => 75695.08
)
)
[depth] => Upstox\Client\Model\DepthMap Object
(
[container:protected] => Array
(
[buy] => Array
(
)
[sell] => Array
(
)
)
)
[timestamp] => 2025-02-20T13:38:57.282+05:30
[instrument_token] => BSE_INDEX|SENSEX
[symbol] => NA
[last_price] => 75695.08
[volume] =>
[average_price] =>
[oi] =>
[net_change] => -244.1
[total_buy_quantity] =>
[total_sell_quantity] =>
[lower_circuit_limit] =>
[upper_circuit_limit] =>
[last_trade_time] => 1740038936669
[oi_day_high] =>
[oi_day_low] =>
)
)
)
)
)
And
<?php require 'vendor/autoload.php'; use Upstox\Client\Api\MarketQuoteApi; use Upstox\Client\Configuration; use GuzzleHttp\Client; // Set Upstox API Configuration $config = new Configuration(); $config->setHost('https://api.upstox.com'); $config->setAccessToken('eyJ0eXAiOiJKV1QiLCJrZXlfaWQiOiJza192MS4wIiwiYWxnIjoiSFMyNTYifQ.eyJzdWIiOiIzQUNXTDYiLCJqdGkiOiI2N2I2Y2Q0ZTA2NDY5NTEyOTI5NjcxOGIiLCJpc011bHRpQ2xpZW50IjpmYWxzZSwiaWF0IjoxNzQwMDMzMzU4LCJpc3MiOiJ1ZGFwaS1nYXRld2F5LXNlcnZpY2UiLCJleHAiOjE3NDAwODg4MDB9.Xu2ApY8UGjwhFiM1Jo2sql0E5e2zqg5elVmAmE5NHiE'); // Replace with a valid token // Create an API client $client = new Client(); $marketApi = new MarketQuoteApi($client, $config); try { // â Use a valid exchange_token and instrument_key $exchange_token = "BSE_INDEX|SENSEX"; $instrument_key = "1"; // Fetch Market Quote (Now passing both required parameters) $response = $marketApi->getFullMarketQuote($exchange_token, $instrument_key); // Print the response print_r($response); } catch (Exception $e) { echo "Error: " . $e->getMessage(); } ?>