Api related queries

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(); } ?>

@shanmu @Pradeep_Jaiswar

@Aashish_Tahlan Your question seems a bit broad. Could you share more details on what you’re trying to achieve or any specific issues you’re facing? We’re more than happy to assist with any API-related challenges, though application-specific needs might be out of our scope.

I need to know that how to run the feature of buying and selling basically order placing as I have connected the websocket but there is no option chain data and buying and selling features available

@Aashish_Tahlan Please refer to the Place Order API documentation to understand the flow. Our documentation provides comprehensive details on all our APIs, and going through it would be the most effective way to get the information you need.

Okh thank you so much

I have created API Key, and I have API Secret and also generated Access Token. I am trying to create a code in the Python to fetch the live data from using these code but I am able to do. I am facing some problems.

I have successfully authenticated and obtained your Upstox access token.

  1. kindly let me know whether I have access to market data or not. If not how to get access

  2. What is the url to get end point. PLease give me Correct endpoint for fetching instruments from NSE exchange

I am giving my demat account to a trading account handler. He asked me to give my api key. Is it safe?

it is never safe to share your trading account details with anyone else

1 Like