├── mocha.opts
├── .github
└── workflows
│ └── CODEOWNER
├── test
├── sdk
│ ├── DataToken.js
│ ├── PortfolioStreamer.js
│ └── PlaceOrder.js
├── model
│ ├── OrderMetadata.spec.js
│ ├── GttOrderData.spec.js
│ ├── MarginRequest.spec.js
│ ├── MultiOrderV3Data.spec.js
│ ├── GttCancelOrderRequest.spec.js
│ ├── IndieUserTokenRequest.spec.js
│ ├── TradeHistoryResponseMetaData.spec.js
│ ├── CancelOrExitMultiOrderData.spec.js
│ ├── GetHolidayResponse.spec.js
│ ├── PostMarginResponse.spec.js
│ ├── GetOptionChainResponse.spec.js
│ ├── GetMarketStatusResponse.spec.js
│ ├── GetOrderDetailsResponse.spec.js
│ ├── MultiOrderData.spec.js
│ ├── GetExchangeTimingResponse.spec.js
│ ├── GetOptionContractResponse.spec.js
│ ├── IndieUserInitTokenResponse.spec.js
│ ├── IndieUserInitTokenData.spec.js
│ ├── GttRule.spec.js
│ ├── GetGttOrderResponse.spec.js
│ ├── BatchExecutionSummary.spec.js
│ ├── PlaceOrderV3Response.spec.js
│ ├── TradeHistoryResponse.spec.js
│ ├── CancelOrderV3Response.spec.js
│ ├── ModifyOrderV3Response.spec.js
│ ├── MarginData.spec.js
│ ├── MarketStatusData.spec.js
│ ├── ExchangeTimingData.spec.js
│ ├── GttTriggerOrderResponse.spec.js
│ └── PutCallOptionChainData.spec.js
└── api
│ └── PostTradeApi.spec.js
├── .travis.yml
├── examples
├── websocket
│ ├── react_websocket
│ │ ├── public
│ │ │ ├── robots.txt
│ │ │ ├── favicon.ico
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── manifest.json
│ │ │ └── index.html
│ │ ├── src
│ │ │ ├── index.js
│ │ │ ├── App.js
│ │ │ └── App.css
│ │ ├── .gitignore
│ │ ├── package.json
│ │ └── README.md
│ └── order_updates
│ │ └── README.md
└── README.md
├── docs
├── OrderMetadata.md
├── ModifyOrderData.md
├── MultiOrderV3Data.md
├── IntraDayCandleData.md
├── CancelOrderData.md
├── HistoricalCandleData.md
├── MarginRequest.md
├── GttOrderData.md
├── BrokerageWrapperData.md
├── PlaceOrderData.md
├── CancelOrExitMultiOrderData.md
├── ConvertPositionData.md
├── WebsocketAuthRedirectResponseData.md
├── DpPlan.md
├── GttCancelOrderRequest.md
├── DepthMap.md
├── ProfitAndLossMetaDataWrapper.md
├── TradeHistoryResponseMetaData.md
├── Depth.md
├── ProfitAndLossChargesWrapperData.md
├── MarketQuoteSymbolLtp.md
├── MarketStatusData.md
├── ProfitAndLossMetaData.md
├── ExchangeTimingData.md
├── IndieUserTokenRequest.md
├── IndieUserInitTokenData.md
├── BrokerageTaxes.md
├── MarketQuoteOHLC.md
├── OtherTaxes.md
├── ProfitAndLossChargesTaxes.md
├── MultiOrderData.md
├── PutCallOptionChainData.md
├── TradeHistoryResponsePageData.md
├── TradeWiseMetaData.md
├── LogoutResponse.md
├── MarketQuoteSymbolLtpV3.md
├── OAuthClientExceptionCauseSuppressed.md
├── AnalyticsData.md
├── MarketQuoteOHLCV3.md
├── PostMarginResponse.md
├── GetProfileResponse.md
├── MarginData.md
├── ApiGatewayErrorResponse.md
├── PlaceOrderResponse.md
├── CancelOrderResponse.md
├── ModifyOrderResponse.md
├── Rule.md
├── GetTradeResponse.md
├── GetBrokerageResponse.md
├── GetMarketStatusResponse.md
├── ConvertPositionResponse.md
├── GetIntraDayCandleResponse.md
├── GetOrderResponse.md
├── GetHoldingsResponse.md
├── GetHolidayResponse.md
├── GetExpiriesResponse.md
├── GetFullMarketQuoteResponse.md
├── GetHistoricalCandleResponse.md
├── GetMarketQuoteOHLCResponse.md
├── GetOrderBookResponse.md
├── GetPositionResponse.md
├── GetOptionChainResponse.md
├── GetOptionContractResponse.md
├── GetTradeWiseProfitAndLossMetaDataResponse.md
├── GetUserFundMarginResponse.md
├── GetExchangeTimingResponse.md
├── GetMarketQuoteLastTradedPriceResponse.md
├── GetOrderDetailsResponse.md
├── GetProfitAndLossChargesResponse.md
├── Ohlc.md
├── WebsocketAuthRedirectResponse.md
├── BrokerageData.md
├── IndieUserInitTokenResponse.md
├── GetExpiredFuturesContractResponse.md
├── GetMarketQuoteOHLCResponseV3.md
├── OAuthClientExceptionCause.md
├── ProfitAndLossOtherChargesTaxes.md
├── BatchExecutionSummary.md
├── ProfitAndLossChargesData.md
├── Instrument.md
├── GetMarketQuoteOptionGreekResponseV3.md
├── GetMarketQuoteLastTradedPriceResponseV3.md
├── CancelOrderV3Response.md
├── GttTriggerOrderResponse.md
├── MarketData.md
├── ModifyOrderV3Response.md
├── PlaceOrderV3Response.md
├── TradeHistoryResponse.md
├── GetGttOrderResponse.md
├── OptionStrikeData.md
├── OAuthClientExceptionCauseStackTrace.md
├── TokenRequest.md
├── OAuthClientException.md
├── GetTradeWiseProfitAndLossDataResponse.md
├── Problem.md
├── OhlcV3.md
├── GttOrderDetails.md
├── MarketQuoteOptionGreekV3.md
├── MultiOrderResponse.md
├── HolidayData.md
├── CancelOrExitMultiOrderResponse.md
├── GttModifyOrderRequest.md
├── MultiOrderError.md
├── CancelOrExitOrderErrorData.md
├── GttRule.md
├── MultiOrderSummary.md
├── Margin.md
├── UserFundMarginData.md
├── TradeHistoryResponseTradeData.md
├── TradeWiseProfitAndLossData.md
├── ConvertPositionRequest.md
├── GttPlaceOrderRequest.md
├── ModifyOrderRequest.md
├── ExpiredFutureData.md
├── MarketQuoteSymbol.md
├── ProfileData.md
├── PlaceOrderV3Request.md
├── TokenResponse.md
├── PlaceOrderRequest.md
├── InstrumentData.md
├── MultiOrderRequest.md
└── HoldingsData.md
├── .npmignore
├── src
├── feeder
│ ├── PortfolioDataStreamer.js
│ └── Feeder.js
└── model
│ ├── OrderMetadata.js
│ ├── MultiOrderV3Data.js
│ ├── GttOrderData.js
│ ├── IndieUserTokenRequest.js
│ ├── MarginRequest.js
│ ├── CancelOrExitMultiOrderData.js
│ ├── TradeHistoryResponseMetaData.js
│ ├── GttCancelOrderRequest.js
│ ├── MultiOrderData.js
│ ├── IndieUserInitTokenData.js
│ ├── ExchangeTimingData.js
│ ├── MarketStatusData.js
│ ├── MarginData.js
│ ├── PostMarginResponse.js
│ ├── GetHolidayResponse.js
│ ├── PutCallOptionChainData.js
│ ├── GetExpiriesResponse.js
│ ├── GetMarketStatusResponse.js
│ ├── GetOptionChainResponse.js
│ └── BatchExecutionSummary.js
├── .babelrc
└── package.json
/mocha.opts:
--------------------------------------------------------------------------------
1 | --timeout 10000
2 |
--------------------------------------------------------------------------------
/.github/workflows/CODEOWNER:
--------------------------------------------------------------------------------
1 | # CODEOWNERS
2 | * @upstox-security-review
3 |
--------------------------------------------------------------------------------
/test/sdk/DataToken.js:
--------------------------------------------------------------------------------
1 | let accessToken = "access_token";
2 | module.exports = {accessToken};
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "6"
4 | - "6.1"
5 | - "5"
6 | - "5.11"
7 |
8 |
--------------------------------------------------------------------------------
/examples/websocket/react_websocket/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/examples/websocket/react_websocket/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upstox/upstox-nodejs/HEAD/examples/websocket/react_websocket/public/favicon.ico
--------------------------------------------------------------------------------
/examples/websocket/react_websocket/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upstox/upstox-nodejs/HEAD/examples/websocket/react_websocket/public/logo192.png
--------------------------------------------------------------------------------
/examples/websocket/react_websocket/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/upstox/upstox-nodejs/HEAD/examples/websocket/react_websocket/public/logo512.png
--------------------------------------------------------------------------------
/docs/OrderMetadata.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.OrderMetadata
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **latency** | **Number** | | [optional]
7 |
--------------------------------------------------------------------------------
/docs/ModifyOrderData.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.ModifyOrderData
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **orderId** | **String** | Order ID | [optional]
7 |
--------------------------------------------------------------------------------
/docs/MultiOrderV3Data.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.MultiOrderV3Data
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **orderIds** | **[String]** | | [optional]
7 |
--------------------------------------------------------------------------------
/docs/IntraDayCandleData.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.IntraDayCandleData
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **candles** | **[[Object]]** | | [optional]
7 |
--------------------------------------------------------------------------------
/docs/CancelOrderData.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.CancelOrderData
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **orderId** | **String** | Reference order ID | [optional]
7 |
--------------------------------------------------------------------------------
/docs/HistoricalCandleData.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.HistoricalCandleData
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **candles** | **[[Object]]** | | [optional]
7 |
--------------------------------------------------------------------------------
/docs/MarginRequest.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.MarginRequest
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **instruments** | [**[Instrument]**](Instrument.md) | instruments |
7 |
--------------------------------------------------------------------------------
/examples/websocket/react_websocket/src/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom/client";
3 | import App from "./App";
4 |
5 | const root = ReactDOM.createRoot(document.getElementById("root"));
6 | root.render(
OrderMetadata.
25 | * @alias module:model/OrderMetadata
26 | * @class
27 | */
28 | constructor() {
29 | }
30 |
31 | /**
32 | * Constructs a OrderMetadata from a plain JavaScript object, optionally creating a new instance.
33 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
34 | * @param {Object} data The plain JavaScript object bearing properties of interest.
35 | * @param {module:model/OrderMetadata} obj Optional instance to populate.
36 | * @return {module:model/OrderMetadata} The populated OrderMetadata instance.
37 | */
38 | static constructFromObject(data, obj) {
39 | if (data) {
40 | obj = obj || new OrderMetadata();
41 | if (data.hasOwnProperty('latency'))
42 | obj.latency = ApiClient.convertToType(data['latency'], 'Number');
43 | }
44 | return obj;
45 | }
46 | }
47 |
48 | /**
49 | * @member {Number} latency
50 | */
51 | OrderMetadata.prototype.latency = undefined;
52 |
53 |
--------------------------------------------------------------------------------
/src/feeder/Feeder.js:
--------------------------------------------------------------------------------
1 | import { Readable } from "stream";
2 |
3 | /**
4 | * Interface representing a data feeder.
5 | * Implementations should provide functionality for connecting to a data source,
6 | * handling connection events, and streaming data.
7 | */
8 | class Feeder extends Readable {
9 | constructor() {
10 | super();
11 | if (new.target === Feeder) {
12 | throw new Error(
13 | "Feeder is an interface-like class and cannot be instantiated directly."
14 | );
15 | }
16 | }
17 |
18 | /**
19 | * Establishes a connection to the data source.
20 | */
21 | async connect() {
22 | throw new Error("Method 'connect()' must be implemented.");
23 | }
24 |
25 | /**
26 | * Determines if a reconnection is necessary.
27 | */
28 | shouldReconnect() {
29 | throw new Error("Method 'shouldReconnect()' must be implemented.");
30 | }
31 |
32 | /**
33 | * Handles incoming messages from the WebSocket connection.
34 | */
35 | onMessage() {
36 | throw new Error("Method 'onMessage()' must be implemented.");
37 | }
38 |
39 | /**
40 | * Handles the closing of the WebSocket connection.
41 | */
42 | onClose() {
43 | throw new Error("Method 'onClose()' must be implemented.");
44 | }
45 |
46 | /**
47 | * Handles errors from the WebSocket connection.
48 | */
49 | onError() {
50 | throw new Error("Method 'onError()' must be implemented.");
51 | }
52 |
53 | /**
54 | * Disconnects from the data source.
55 | */
56 | disconnect() {
57 | throw new Error("Method 'disconnect()' must be implemented.");
58 | }
59 |
60 | /**
61 | * Implementation of the Readable stream's _read method.
62 | */
63 | _read() {}
64 | }
65 |
66 | export default Feeder;
67 |
--------------------------------------------------------------------------------
/src/model/MultiOrderV3Data.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 |
17 | /**
18 | * The MultiOrderV3Data model module.
19 | * @module model/MultiOrderV3Data
20 | * @version v0
21 | */
22 | export class MultiOrderV3Data {
23 | /**
24 | * Constructs a new MultiOrderV3Data.
25 | * @alias module:model/MultiOrderV3Data
26 | * @class
27 | */
28 | constructor() {
29 | }
30 |
31 | /**
32 | * Constructs a MultiOrderV3Data from a plain JavaScript object, optionally creating a new instance.
33 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
34 | * @param {Object} data The plain JavaScript object bearing properties of interest.
35 | * @param {module:model/MultiOrderV3Data} obj Optional instance to populate.
36 | * @return {module:model/MultiOrderV3Data} The populated MultiOrderV3Data instance.
37 | */
38 | static constructFromObject(data, obj) {
39 | if (data) {
40 | obj = obj || new MultiOrderV3Data();
41 | if (data.hasOwnProperty('order_ids'))
42 | obj.orderIds = ApiClient.convertToType(data['order_ids'], ['String']);
43 | }
44 | return obj;
45 | }
46 | }
47 |
48 | /**
49 | * @member {Array.GttOrderData.
25 | * Response data for GTT order request
26 | * @alias module:model/GttOrderData
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a GttOrderData from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/GttOrderData} obj Optional instance to populate.
37 | * @return {module:model/GttOrderData} The populated GttOrderData instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new GttOrderData();
42 | if (data.hasOwnProperty('gtt_order_ids'))
43 | obj.gttOrderIds = ApiClient.convertToType(data['gtt_order_ids'], ['String']);
44 | }
45 | return obj;
46 | }
47 | }
48 |
49 | /**
50 | * Order ID for the placed GTT order
51 | * @member {Array.IndieUserTokenRequest.
25 | * @alias module:model/IndieUserTokenRequest
26 | * @class
27 | */
28 | constructor() {
29 | }
30 |
31 | /**
32 | * Constructs a IndieUserTokenRequest from a plain JavaScript object, optionally creating a new instance.
33 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
34 | * @param {Object} data The plain JavaScript object bearing properties of interest.
35 | * @param {module:model/IndieUserTokenRequest} obj Optional instance to populate.
36 | * @return {module:model/IndieUserTokenRequest} The populated IndieUserTokenRequest instance.
37 | */
38 | static constructFromObject(data, obj) {
39 | if (data) {
40 | obj = obj || new IndieUserTokenRequest();
41 | if (data.hasOwnProperty('client_secret'))
42 | obj.clientSecret = ApiClient.convertToType(data['client_secret'], 'String');
43 | }
44 | return obj;
45 | }
46 | }
47 |
48 | /**
49 | * OAuth client secret that is a private secret known only to app and authorization server
50 | * @member {String} clientSecret
51 | */
52 | IndieUserTokenRequest.prototype.clientSecret = undefined;
53 |
54 |
--------------------------------------------------------------------------------
/docs/InstrumentData.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.InstrumentData
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **name** | **String** | | [optional]
7 | **segment** | **String** | | [optional]
8 | **exchange** | **String** | | [optional]
9 | **isin** | **String** | | [optional]
10 | **expiry** | **Date** | | [optional]
11 | **country** | **String** | | [optional]
12 | **latency** | **String** | | [optional]
13 | **description** | **String** | | [optional]
14 | **currency** | **String** | | [optional]
15 | **weekly** | **Boolean** | | [optional]
16 | **instrumentKey** | **String** | | [optional]
17 | **exchangeToken** | **String** | | [optional]
18 | **tradingSymbol** | **String** | | [optional]
19 | **shortName** | **String** | | [optional]
20 | **tickSize** | **Number** | | [optional]
21 | **lotSize** | **Number** | | [optional]
22 | **instrumentType** | **String** | | [optional]
23 | **freezeQuantity** | **Number** | | [optional]
24 | **underlyingKey** | **String** | | [optional]
25 | **underlyingType** | **String** | | [optional]
26 | **underlyingSymbol** | **String** | | [optional]
27 | **lastTradingDate** | **Date** | | [optional]
28 | **strikePrice** | **Number** | | [optional]
29 | **priceQuoteUnit** | **String** | | [optional]
30 | **qtyMultiplier** | **Number** | | [optional]
31 | **minimumLot** | **Number** | | [optional]
32 | **startTime** | **String** | | [optional]
33 | **endTime** | **String** | | [optional]
34 | **weekDays** | **String** | | [optional]
35 | **generalDenominator** | **Number** | | [optional]
36 | **generalNumerator** | **Number** | | [optional]
37 | **priceNumerator** | **Number** | | [optional]
38 | **priceDenominator** | **Number** | | [optional]
39 | **mtfEnabled** | **Boolean** | | [optional]
40 | **mtfBracket** | **Number** | | [optional]
41 | **securityType** | **String** | | [optional]
42 |
--------------------------------------------------------------------------------
/src/model/MarginRequest.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 | import {Instrument} from './Instrument';
17 |
18 | /**
19 | * The MarginRequest model module.
20 | * @module model/MarginRequest
21 | * @version v0
22 | */
23 | export class MarginRequest {
24 | /**
25 | * Constructs a new MarginRequest.
26 | * @alias module:model/MarginRequest
27 | * @class
28 | * @param instruments {Array.MarginRequest from a plain JavaScript object, optionally creating a new instance.
36 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
37 | * @param {Object} data The plain JavaScript object bearing properties of interest.
38 | * @param {module:model/MarginRequest} obj Optional instance to populate.
39 | * @return {module:model/MarginRequest} The populated MarginRequest instance.
40 | */
41 | static constructFromObject(data, obj) {
42 | if (data) {
43 | obj = obj || new MarginRequest();
44 | if (data.hasOwnProperty('instruments'))
45 | obj.instruments = ApiClient.convertToType(data['instruments'], [Instrument]);
46 | }
47 | return obj;
48 | }
49 | }
50 |
51 | /**
52 | * instruments
53 | * @member {Array.CancelOrExitMultiOrderData.
25 | * Response data for cancel or exit order request
26 | * @alias module:model/CancelOrExitMultiOrderData
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a CancelOrExitMultiOrderData from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/CancelOrExitMultiOrderData} obj Optional instance to populate.
37 | * @return {module:model/CancelOrExitMultiOrderData} The populated CancelOrExitMultiOrderData instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new CancelOrExitMultiOrderData();
42 | if (data.hasOwnProperty('order_ids'))
43 | obj.orderIds = ApiClient.convertToType(data['order_ids'], ['String']);
44 | }
45 | return obj;
46 | }
47 | }
48 |
49 | /**
50 | * Reference order IDs
51 | * @member {Array.TradeHistoryResponseMetaData.
26 | * @alias module:model/TradeHistoryResponseMetaData
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a TradeHistoryResponseMetaData from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/TradeHistoryResponseMetaData} obj Optional instance to populate.
37 | * @return {module:model/TradeHistoryResponseMetaData} The populated TradeHistoryResponseMetaData instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new TradeHistoryResponseMetaData();
42 | if (data.hasOwnProperty('page'))
43 | obj.page = TradeHistoryResponsePageData.constructFromObject(data['page']);
44 | }
45 | return obj;
46 | }
47 | }
48 |
49 | /**
50 | * @member {module:model/TradeHistoryResponsePageData} page
51 | */
52 | TradeHistoryResponseMetaData.prototype.page = undefined;
53 |
54 |
--------------------------------------------------------------------------------
/src/model/GttCancelOrderRequest.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 |
17 | /**
18 | * The GttCancelOrderRequest model module.
19 | * @module model/GttCancelOrderRequest
20 | * @version v0
21 | */
22 | export class GttCancelOrderRequest {
23 | /**
24 | * Constructs a new GttCancelOrderRequest.
25 | * @alias module:model/GttCancelOrderRequest
26 | * @class
27 | * @param gttOrderId {String} Unique identifier of the GTT order to be cancelled
28 | */
29 | constructor(gttOrderId) {
30 | this.gttOrderId = gttOrderId;
31 | }
32 |
33 | /**
34 | * Constructs a GttCancelOrderRequest from a plain JavaScript object, optionally creating a new instance.
35 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
36 | * @param {Object} data The plain JavaScript object bearing properties of interest.
37 | * @param {module:model/GttCancelOrderRequest} obj Optional instance to populate.
38 | * @return {module:model/GttCancelOrderRequest} The populated GttCancelOrderRequest instance.
39 | */
40 | static constructFromObject(data, obj) {
41 | if (data) {
42 | obj = obj || new GttCancelOrderRequest();
43 | if (data.hasOwnProperty('gtt_order_id'))
44 | obj.gttOrderId = ApiClient.convertToType(data['gtt_order_id'], 'String');
45 | }
46 | return obj;
47 | }
48 | }
49 |
50 | /**
51 | * Unique identifier of the GTT order to be cancelled
52 | * @member {String} gttOrderId
53 | */
54 | GttCancelOrderRequest.prototype.gttOrderId = undefined;
55 |
56 |
--------------------------------------------------------------------------------
/docs/MultiOrderRequest.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.MultiOrderRequest
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **quantity** | **Number** | Quantity with which the order is to be placed |
7 | **product** | **String** | Signifies if the order was either Intraday, Delivery, CO or OCO |
8 | **validity** | **String** | It can be one of the following - DAY(default), IOC |
9 | **price** | **Number** | Price at which the order will be placed |
10 | **tag** | **String** | | [optional]
11 | **slice** | **Boolean** | To divide the order line based on predefined exchange definitions |
12 | **instrumentToken** | **String** | Key of the instrument |
13 | **orderType** | **String** | Type of order. It can be one of the following MARKET refers to market order LIMIT refers to Limit Order SL refers to Stop Loss Limit SL-M refers to Stop Loss Market |
14 | **transactionType** | **String** | Indicates whether its a buy or sell order |
15 | **disclosedQuantity** | **Number** | The quantity that should be disclosed in the market depth |
16 | **triggerPrice** | **Number** | If the order is a stop loss order then the trigger price to be set is mentioned here |
17 | **isAmo** | **Boolean** | Signifies if the order is an After Market Order |
18 | **correlationId** | **String** | A unique identifier for tracking individual orders within the batch |
19 |
20 |
21 | ## Enum: ProductEnum
22 |
23 | * `I` (value: `"I"`)
24 | * `D` (value: `"D"`)
25 | * `MTF` (value: `"MTF"`)
26 |
27 |
28 |
29 | ## Enum: ValidityEnum
30 |
31 | * `DAY` (value: `"DAY"`)
32 | * `IOC` (value: `"IOC"`)
33 |
34 |
35 |
36 | ## Enum: OrderTypeEnum
37 |
38 | * `MARKET` (value: `"MARKET"`)
39 | * `LIMIT` (value: `"LIMIT"`)
40 | * `SL` (value: `"SL"`)
41 | * `SL_M` (value: `"SL-M"`)
42 |
43 |
44 |
45 | ## Enum: TransactionTypeEnum
46 |
47 | * `BUY` (value: `"BUY"`)
48 | * `SELL` (value: `"SELL"`)
49 |
50 |
--------------------------------------------------------------------------------
/test/model/GetHolidayResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GetHolidayResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GetHolidayResponse();
35 | });
36 |
37 | it('should create an instance of GetHolidayResponse', function() {
38 | // TODO: update the code to test GetHolidayResponse
39 | expect(instance).to.be.a(UpstoxClient.GetHolidayResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/model/PostMarginResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('PostMarginResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.PostMarginResponse();
35 | });
36 |
37 | it('should create an instance of PostMarginResponse', function() {
38 | // TODO: update the code to test PostMarginResponse
39 | expect(instance).to.be.a(UpstoxClient.PostMarginResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/model/GetOptionChainResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GetOptionChainResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GetOptionChainResponse();
35 | });
36 |
37 | it('should create an instance of GetOptionChainResponse', function() {
38 | // TODO: update the code to test GetOptionChainResponse
39 | expect(instance).to.be.a(UpstoxClient.GetOptionChainResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/model/GetMarketStatusResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GetMarketStatusResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GetMarketStatusResponse();
35 | });
36 |
37 | it('should create an instance of GetMarketStatusResponse', function() {
38 | // TODO: update the code to test GetMarketStatusResponse
39 | expect(instance).to.be.a(UpstoxClient.GetMarketStatusResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/model/GetOrderDetailsResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.62
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GetOrderDetailsResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GetOrderDetailsResponse();
35 | });
36 |
37 | it('should create an instance of GetOrderDetailsResponse', function() {
38 | // TODO: update the code to test GetOrderDetailsResponse
39 | expect(instance).to.be.a(UpstoxClient.GetOrderDetailsResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/model/MultiOrderData.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.62
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('MultiOrderData', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.MultiOrderData();
35 | });
36 |
37 | it('should create an instance of MultiOrderData', function() {
38 | // TODO: update the code to test MultiOrderData
39 | expect(instance).to.be.a(UpstoxClient.MultiOrderData);
40 | });
41 |
42 | it('should have the property correlationId (base name: "correlation_id")', function() {
43 | // TODO: update the code to test the property correlationId
44 | expect(instance).to.have.property('correlationId');
45 | // expect(instance.correlationId).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property orderId (base name: "order_id")', function() {
49 | // TODO: update the code to test the property orderId
50 | expect(instance).to.have.property('orderId');
51 | // expect(instance.orderId).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/model/GetExchangeTimingResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GetExchangeTimingResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GetExchangeTimingResponse();
35 | });
36 |
37 | it('should create an instance of GetExchangeTimingResponse', function() {
38 | // TODO: update the code to test GetExchangeTimingResponse
39 | expect(instance).to.be.a(UpstoxClient.GetExchangeTimingResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/model/GetOptionContractResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GetOptionContractResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GetOptionContractResponse();
35 | });
36 |
37 | it('should create an instance of GetOptionContractResponse', function() {
38 | // TODO: update the code to test GetOptionContractResponse
39 | expect(instance).to.be.a(UpstoxClient.GetOptionContractResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/test/api/PostTradeApi.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | beforeEach(function() {
32 | instance = new UpstoxClient.PostTradeApi();
33 | });
34 |
35 | describe('(package)', function() {
36 | describe('PostTradeApi', function() {
37 | describe('getTradesByDateRange', function() {
38 | it('should call getTradesByDateRange successfully', function(done) {
39 | // TODO: uncomment, update parameter values for getTradesByDateRange call and complete the assertions
40 | /*
41 | var opts = {};
42 |
43 | instance.getTradesByDateRange(startDate, endDate, pageNumber, pageSize, opts, function(error, data, response) {
44 | if (error) {
45 | done(error);
46 | return;
47 | }
48 | // TODO: update response assertions
49 | expect(data).to.be.a(UpstoxClient.TradeHistoryResponse);
50 |
51 | done();
52 | });
53 | */
54 | // TODO: uncomment and complete method invocation above, then delete this line and the next:
55 | done();
56 | });
57 | });
58 | });
59 | });
60 |
61 | }));
62 |
--------------------------------------------------------------------------------
/test/model/IndieUserInitTokenResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('IndieUserInitTokenResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.IndieUserInitTokenResponse();
35 | });
36 |
37 | it('should create an instance of IndieUserInitTokenResponse', function() {
38 | // TODO: update the code to test IndieUserInitTokenResponse
39 | expect(instance).to.be.a(UpstoxClient.IndieUserInitTokenResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/src/model/MultiOrderData.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.62
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 |
17 | /**
18 | * The MultiOrderData model module.
19 | * @module model/MultiOrderData
20 | * @version v0
21 | */
22 | export class MultiOrderData {
23 | /**
24 | * Constructs a new MultiOrderData.
25 | * Response data for multi order request
26 | * @alias module:model/MultiOrderData
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a MultiOrderData from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/MultiOrderData} obj Optional instance to populate.
37 | * @return {module:model/MultiOrderData} The populated MultiOrderData instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new MultiOrderData();
42 | if (data.hasOwnProperty('correlation_id'))
43 | obj.correlationId = ApiClient.convertToType(data['correlation_id'], 'String');
44 | if (data.hasOwnProperty('order_id'))
45 | obj.orderId = ApiClient.convertToType(data['order_id'], 'String');
46 | }
47 | return obj;
48 | }
49 | }
50 |
51 | /**
52 | * A unique identifier for tracking individual orders within the batch
53 | * @member {String} correlationId
54 | */
55 | MultiOrderData.prototype.correlationId = undefined;
56 |
57 | /**
58 | * An order ID for the order request placed
59 | * @member {String} orderId
60 | */
61 | MultiOrderData.prototype.orderId = undefined;
62 |
63 |
--------------------------------------------------------------------------------
/docs/HoldingsData.md:
--------------------------------------------------------------------------------
1 | # UpstoxClient.HoldingsData
2 |
3 | ## Properties
4 | Name | Type | Description | Notes
5 | ------------ | ------------- | ------------- | -------------
6 | **isin** | **String** | The standard ISIN representing stocks listed on multiple exchanges | [optional]
7 | **cncUsedQuantity** | **Number** | Quantity either blocked towards open or completed order | [optional]
8 | **collateralType** | **String** | Category of collateral assigned by RMS | [optional]
9 | **companyName** | **String** | Name of the company | [optional]
10 | **haircut** | **Number** | This is the haircut percentage applied from RMS (applicable incase of collateral) | [optional]
11 | **product** | **String** | Shows if the order was either Intraday, Delivery, CO or OCO | [optional]
12 | **quantity** | **Number** | The total holding qty | [optional]
13 | **tradingsymbol** | **String** | Shows the trading symbol of the instrument | [optional]
14 | **lastPrice** | **Number** | The last traded price of the instrument | [optional]
15 | **closePrice** | **Number** | Closing price of the instrument from the last trading day | [optional]
16 | **pnl** | **Number** | Profit and Loss | [optional]
17 | **dayChange** | **Number** | Day's change in absolute value for the stock | [optional]
18 | **dayChangePercentage** | **Number** | Day's change in percentage for the stock | [optional]
19 | **instrumentToken** | **String** | Key issued by Upstox for the instrument | [optional]
20 | **averagePrice** | **Number** | Average price at which the net holding quantity was acquired | [optional]
21 | **collateralQuantity** | **Number** | Quantity marked as collateral by RMS on users request | [optional]
22 | **collateralUpdateQuantity** | **Number** | | [optional]
23 | **t1Quantity** | **Number** | Quantity on T+1 day after order execution | [optional]
24 | **exchange** | **String** | Exchange of the trading symbol | [optional]
25 |
26 |
27 | ## Enum: ExchangeEnum
28 |
29 | * `NSE` (value: `"NSE"`)
30 | * `NFO` (value: `"NFO"`)
31 | * `CDS` (value: `"CDS"`)
32 | * `BSE` (value: `"BSE"`)
33 | * `BCD` (value: `"BCD"`)
34 | * `BFO` (value: `"BFO"`)
35 | * `MCX` (value: `"MCX"`)
36 |
37 |
--------------------------------------------------------------------------------
/test/model/IndieUserInitTokenData.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('IndieUserInitTokenData', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.IndieUserInitTokenData();
35 | });
36 |
37 | it('should create an instance of IndieUserInitTokenData', function() {
38 | // TODO: update the code to test IndieUserInitTokenData
39 | expect(instance).to.be.a(UpstoxClient.IndieUserInitTokenData);
40 | });
41 |
42 | it('should have the property authorizationExpiry (base name: "authorization_expiry")', function() {
43 | // TODO: update the code to test the property authorizationExpiry
44 | expect(instance).to.have.property('authorizationExpiry');
45 | // expect(instance.authorizationExpiry).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property notifierUrl (base name: "notifier_url")', function() {
49 | // TODO: update the code to test the property notifierUrl
50 | expect(instance).to.have.property('notifierUrl');
51 | // expect(instance.notifierUrl).to.be(expectedValueLiteral);
52 | });
53 |
54 | });
55 | });
56 |
57 | }));
58 |
--------------------------------------------------------------------------------
/src/model/IndieUserInitTokenData.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 |
17 | /**
18 | * The IndieUserInitTokenData model module.
19 | * @module model/IndieUserInitTokenData
20 | * @version v0
21 | */
22 | export class IndieUserInitTokenData {
23 | /**
24 | * Constructs a new IndieUserInitTokenData.
25 | * Init token response data for indie user
26 | * @alias module:model/IndieUserInitTokenData
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a IndieUserInitTokenData from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/IndieUserInitTokenData} obj Optional instance to populate.
37 | * @return {module:model/IndieUserInitTokenData} The populated IndieUserInitTokenData instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new IndieUserInitTokenData();
42 | if (data.hasOwnProperty('authorization_expiry'))
43 | obj.authorizationExpiry = ApiClient.convertToType(data['authorization_expiry'], 'String');
44 | if (data.hasOwnProperty('notifier_url'))
45 | obj.notifierUrl = ApiClient.convertToType(data['notifier_url'], 'String');
46 | }
47 | return obj;
48 | }
49 | }
50 |
51 | /**
52 | * authorize token expiry
53 | * @member {String} authorizationExpiry
54 | */
55 | IndieUserInitTokenData.prototype.authorizationExpiry = undefined;
56 |
57 | /**
58 | * notifier webhook url
59 | * @member {String} notifierUrl
60 | */
61 | IndieUserInitTokenData.prototype.notifierUrl = undefined;
62 |
63 |
--------------------------------------------------------------------------------
/src/model/ExchangeTimingData.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 |
17 | /**
18 | * The ExchangeTimingData model module.
19 | * @module model/ExchangeTimingData
20 | * @version v0
21 | */
22 | export class ExchangeTimingData {
23 | /**
24 | * Constructs a new ExchangeTimingData.
25 | * @alias module:model/ExchangeTimingData
26 | * @class
27 | */
28 | constructor() {
29 | }
30 |
31 | /**
32 | * Constructs a ExchangeTimingData from a plain JavaScript object, optionally creating a new instance.
33 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
34 | * @param {Object} data The plain JavaScript object bearing properties of interest.
35 | * @param {module:model/ExchangeTimingData} obj Optional instance to populate.
36 | * @return {module:model/ExchangeTimingData} The populated ExchangeTimingData instance.
37 | */
38 | static constructFromObject(data, obj) {
39 | if (data) {
40 | obj = obj || new ExchangeTimingData();
41 | if (data.hasOwnProperty('exchange'))
42 | obj.exchange = ApiClient.convertToType(data['exchange'], 'String');
43 | if (data.hasOwnProperty('start_time'))
44 | obj.startTime = ApiClient.convertToType(data['start_time'], 'Number');
45 | if (data.hasOwnProperty('end_time'))
46 | obj.endTime = ApiClient.convertToType(data['end_time'], 'Number');
47 | }
48 | return obj;
49 | }
50 | }
51 |
52 | /**
53 | * @member {String} exchange
54 | */
55 | ExchangeTimingData.prototype.exchange = undefined;
56 |
57 | /**
58 | * @member {Number} startTime
59 | */
60 | ExchangeTimingData.prototype.startTime = undefined;
61 |
62 | /**
63 | * @member {Number} endTime
64 | */
65 | ExchangeTimingData.prototype.endTime = undefined;
66 |
67 |
--------------------------------------------------------------------------------
/src/model/MarketStatusData.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 |
17 | /**
18 | * The MarketStatusData model module.
19 | * @module model/MarketStatusData
20 | * @version v0
21 | */
22 | export class MarketStatusData {
23 | /**
24 | * Constructs a new MarketStatusData.
25 | * Response data for market live status
26 | * @alias module:model/MarketStatusData
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a MarketStatusData from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/MarketStatusData} obj Optional instance to populate.
37 | * @return {module:model/MarketStatusData} The populated MarketStatusData instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new MarketStatusData();
42 | if (data.hasOwnProperty('exchange'))
43 | obj.exchange = ApiClient.convertToType(data['exchange'], 'String');
44 | if (data.hasOwnProperty('status'))
45 | obj.status = ApiClient.convertToType(data['status'], 'String');
46 | if (data.hasOwnProperty('last_updated'))
47 | obj.lastUpdated = ApiClient.convertToType(data['last_updated'], 'Number');
48 | }
49 | return obj;
50 | }
51 | }
52 |
53 | /**
54 | * @member {String} exchange
55 | */
56 | MarketStatusData.prototype.exchange = undefined;
57 |
58 | /**
59 | * @member {String} status
60 | */
61 | MarketStatusData.prototype.status = undefined;
62 |
63 | /**
64 | * @member {Number} lastUpdated
65 | */
66 | MarketStatusData.prototype.lastUpdated = undefined;
67 |
68 |
--------------------------------------------------------------------------------
/examples/websocket/react_websocket/README.md:
--------------------------------------------------------------------------------
1 | # React WebSocket Client
2 |
3 | This sample project demonstrates how to connect to the Upstox WebSocket API using ReactJS to stream live market data and order updates. It includes implementations for both market data streaming and order updates. Users need to set up their Upstox API access token and can then start receiving live feeds of market data and order updates.
4 |
5 | ## Getting Started
6 |
7 | Follow these instructions to run the React WebSocket client on your local machine.
8 |
9 | ### Prerequisites
10 |
11 | Before you start, ensure you have Node.js and npm installed on your system. If you haven't installed Node.js and npm yet, you can download them from the official website:
12 |
13 | [Download Node.js](https://nodejs.org/)
14 |
15 | ### Installation
16 |
17 | This project requires several dependencies which can be installed using npm. These dependencies are listed in the `package.json` file. Run the following command in your terminal to install all required packages:
18 |
19 | ```bash
20 | npm install
21 | ```
22 |
23 | ### Configuration
24 |
25 | The application requires an Upstox API access token for authorization. You need to specify your Upstox API access token in the App.js file. Locate the following line in App.js and replace 'ACCESS_TOKEN' with your actual access token:
26 |
27 | ```bash
28 | const auth_token = "ACCESS_TOKEN";
29 | ```
30 |
31 | ### Running the Application
32 |
33 | After installing the prerequisites and configuring your access token, you can start the application. Navigate to the directory containing your project and run the following command:
34 |
35 | ```bash
36 | npm start
37 | ```
38 |
39 | ### Understanding the Code
40 |
41 | The project consists of a React application that establishes connections to the Upstox WebSocket API for market data and order updates. After successful authentication, the application connects to the WebSocket server and starts receiving data. The received data is then decoded, and the live feed is displayed on the screen.
42 |
43 | ### Support
44 |
45 | If you encounter any problems or have any questions about this project, feel free to open an issue in this repository.
46 |
47 | ### Disclaimer
48 |
49 | This is a sample application meant for educational purposes. It may require modifications to work with your specific requirements.
--------------------------------------------------------------------------------
/test/model/GttRule.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GttRule', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GttRule();
35 | });
36 |
37 | it('should create an instance of GttRule', function() {
38 | // TODO: update the code to test GttRule
39 | expect(instance).to.be.a(UpstoxClient.GttRule);
40 | });
41 |
42 | it('should have the property strategy (base name: "strategy")', function() {
43 | // TODO: update the code to test the property strategy
44 | expect(instance).to.have.property('strategy');
45 | // expect(instance.strategy).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property triggerType (base name: "trigger_type")', function() {
49 | // TODO: update the code to test the property triggerType
50 | expect(instance).to.have.property('triggerType');
51 | // expect(instance.triggerType).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property triggerPrice (base name: "trigger_price")', function() {
55 | // TODO: update the code to test the property triggerPrice
56 | expect(instance).to.have.property('triggerPrice');
57 | // expect(instance.triggerPrice).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/GetGttOrderResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GetGttOrderResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GetGttOrderResponse();
35 | });
36 |
37 | it('should create an instance of GetGttOrderResponse', function() {
38 | // TODO: update the code to test GetGttOrderResponse
39 | expect(instance).to.be.a(UpstoxClient.GetGttOrderResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property metadata (base name: "metadata")', function() {
55 | // TODO: update the code to test the property metadata
56 | expect(instance).to.have.property('metadata');
57 | // expect(instance.metadata).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/BatchExecutionSummary.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.62
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('BatchExecutionSummary', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.BatchExecutionSummary();
35 | });
36 |
37 | it('should create an instance of BatchExecutionSummary', function() {
38 | // TODO: update the code to test BatchExecutionSummary
39 | expect(instance).to.be.a(UpstoxClient.BatchExecutionSummary);
40 | });
41 |
42 | it('should have the property total (base name: "total")', function() {
43 | // TODO: update the code to test the property total
44 | expect(instance).to.have.property('total');
45 | // expect(instance.total).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property success (base name: "success")', function() {
49 | // TODO: update the code to test the property success
50 | expect(instance).to.have.property('success');
51 | // expect(instance.success).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property error (base name: "error")', function() {
55 | // TODO: update the code to test the property error
56 | expect(instance).to.have.property('error');
57 | // expect(instance.error).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/PlaceOrderV3Response.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('PlaceOrderV3Response', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.PlaceOrderV3Response();
35 | });
36 |
37 | it('should create an instance of PlaceOrderV3Response', function() {
38 | // TODO: update the code to test PlaceOrderV3Response
39 | expect(instance).to.be.a(UpstoxClient.PlaceOrderV3Response);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property metadata (base name: "metadata")', function() {
55 | // TODO: update the code to test the property metadata
56 | expect(instance).to.have.property('metadata');
57 | // expect(instance.metadata).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/TradeHistoryResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('TradeHistoryResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.TradeHistoryResponse();
35 | });
36 |
37 | it('should create an instance of TradeHistoryResponse', function() {
38 | // TODO: update the code to test TradeHistoryResponse
39 | expect(instance).to.be.a(UpstoxClient.TradeHistoryResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property metaData (base name: "metaData")', function() {
55 | // TODO: update the code to test the property metaData
56 | expect(instance).to.have.property('metaData');
57 | // expect(instance.metaData).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/CancelOrderV3Response.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('CancelOrderV3Response', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.CancelOrderV3Response();
35 | });
36 |
37 | it('should create an instance of CancelOrderV3Response', function() {
38 | // TODO: update the code to test CancelOrderV3Response
39 | expect(instance).to.be.a(UpstoxClient.CancelOrderV3Response);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property metadata (base name: "metadata")', function() {
55 | // TODO: update the code to test the property metadata
56 | expect(instance).to.have.property('metadata');
57 | // expect(instance.metadata).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/ModifyOrderV3Response.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('ModifyOrderV3Response', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.ModifyOrderV3Response();
35 | });
36 |
37 | it('should create an instance of ModifyOrderV3Response', function() {
38 | // TODO: update the code to test ModifyOrderV3Response
39 | expect(instance).to.be.a(UpstoxClient.ModifyOrderV3Response);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property metadata (base name: "metadata")', function() {
55 | // TODO: update the code to test the property metadata
56 | expect(instance).to.have.property('metadata');
57 | // expect(instance.metadata).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/MarginData.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('MarginData', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.MarginData();
35 | });
36 |
37 | it('should create an instance of MarginData', function() {
38 | // TODO: update the code to test MarginData
39 | expect(instance).to.be.a(UpstoxClient.MarginData);
40 | });
41 |
42 | it('should have the property margins (base name: "margins")', function() {
43 | // TODO: update the code to test the property margins
44 | expect(instance).to.have.property('margins');
45 | // expect(instance.margins).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property requiredMargin (base name: "required_margin")', function() {
49 | // TODO: update the code to test the property requiredMargin
50 | expect(instance).to.have.property('requiredMargin');
51 | // expect(instance.requiredMargin).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property finalMargin (base name: "final_margin")', function() {
55 | // TODO: update the code to test the property finalMargin
56 | expect(instance).to.have.property('finalMargin');
57 | // expect(instance.finalMargin).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/MarketStatusData.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('MarketStatusData', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.MarketStatusData();
35 | });
36 |
37 | it('should create an instance of MarketStatusData', function() {
38 | // TODO: update the code to test MarketStatusData
39 | expect(instance).to.be.a(UpstoxClient.MarketStatusData);
40 | });
41 |
42 | it('should have the property exchange (base name: "exchange")', function() {
43 | // TODO: update the code to test the property exchange
44 | expect(instance).to.have.property('exchange');
45 | // expect(instance.exchange).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property status (base name: "status")', function() {
49 | // TODO: update the code to test the property status
50 | expect(instance).to.have.property('status');
51 | // expect(instance.status).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property lastUpdated (base name: "last_updated")', function() {
55 | // TODO: update the code to test the property lastUpdated
56 | expect(instance).to.have.property('lastUpdated');
57 | // expect(instance.lastUpdated).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/ExchangeTimingData.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('ExchangeTimingData', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.ExchangeTimingData();
35 | });
36 |
37 | it('should create an instance of ExchangeTimingData', function() {
38 | // TODO: update the code to test ExchangeTimingData
39 | expect(instance).to.be.a(UpstoxClient.ExchangeTimingData);
40 | });
41 |
42 | it('should have the property exchange (base name: "exchange")', function() {
43 | // TODO: update the code to test the property exchange
44 | expect(instance).to.have.property('exchange');
45 | // expect(instance.exchange).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property startTime (base name: "start_time")', function() {
49 | // TODO: update the code to test the property startTime
50 | expect(instance).to.have.property('startTime');
51 | // expect(instance.startTime).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property endTime (base name: "end_time")', function() {
55 | // TODO: update the code to test the property endTime
56 | expect(instance).to.have.property('endTime');
57 | // expect(instance.endTime).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/test/model/GttTriggerOrderResponse.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('GttTriggerOrderResponse', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.GttTriggerOrderResponse();
35 | });
36 |
37 | it('should create an instance of GttTriggerOrderResponse', function() {
38 | // TODO: update the code to test GttTriggerOrderResponse
39 | expect(instance).to.be.a(UpstoxClient.GttTriggerOrderResponse);
40 | });
41 |
42 | it('should have the property status (base name: "status")', function() {
43 | // TODO: update the code to test the property status
44 | expect(instance).to.have.property('status');
45 | // expect(instance.status).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property data (base name: "data")', function() {
49 | // TODO: update the code to test the property data
50 | expect(instance).to.have.property('data');
51 | // expect(instance.data).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property metadata (base name: "metadata")', function() {
55 | // TODO: update the code to test the property metadata
56 | expect(instance).to.have.property('metadata');
57 | // expect(instance.metadata).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/src/model/MarginData.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 | import {Margin} from './Margin';
17 |
18 | /**
19 | * The MarginData model module.
20 | * @module model/MarginData
21 | * @version v0
22 | */
23 | export class MarginData {
24 | /**
25 | * Constructs a new MarginData.
26 | * Response data for margin
27 | * @alias module:model/MarginData
28 | * @class
29 | */
30 | constructor() {
31 | }
32 |
33 | /**
34 | * Constructs a MarginData from a plain JavaScript object, optionally creating a new instance.
35 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
36 | * @param {Object} data The plain JavaScript object bearing properties of interest.
37 | * @param {module:model/MarginData} obj Optional instance to populate.
38 | * @return {module:model/MarginData} The populated MarginData instance.
39 | */
40 | static constructFromObject(data, obj) {
41 | if (data) {
42 | obj = obj || new MarginData();
43 | if (data.hasOwnProperty('margins'))
44 | obj.margins = ApiClient.convertToType(data['margins'], [Margin]);
45 | if (data.hasOwnProperty('required_margin'))
46 | obj.requiredMargin = ApiClient.convertToType(data['required_margin'], 'Number');
47 | if (data.hasOwnProperty('final_margin'))
48 | obj.finalMargin = ApiClient.convertToType(data['final_margin'], 'Number');
49 | }
50 | return obj;
51 | }
52 | }
53 |
54 | /**
55 | * Response data for instrument margin details
56 | * @member {Array.PostMarginResponse.
26 | * @alias module:model/PostMarginResponse
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a PostMarginResponse from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/PostMarginResponse} obj Optional instance to populate.
37 | * @return {module:model/PostMarginResponse} The populated PostMarginResponse instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new PostMarginResponse();
42 | if (data.hasOwnProperty('status'))
43 | obj.status = ApiClient.convertToType(data['status'], 'String');
44 | if (data.hasOwnProperty('data'))
45 | obj.data = MarginData.constructFromObject(data['data']);
46 | }
47 | return obj;
48 | }
49 | }
50 |
51 | /**
52 | * Allowed values for the status property.
53 | * @enum {String}
54 | * @readonly
55 | */
56 | PostMarginResponse.StatusEnum = {
57 | /**
58 | * value: "success"
59 | * @const
60 | */
61 | success: "success",
62 |
63 | /**
64 | * value: "error"
65 | * @const
66 | */
67 | error: "error"
68 | };
69 | /**
70 | * @member {module:model/PostMarginResponse.StatusEnum} status
71 | */
72 | PostMarginResponse.prototype.status = undefined;
73 |
74 | /**
75 | * @member {module:model/MarginData} data
76 | */
77 | PostMarginResponse.prototype.data = undefined;
78 |
79 |
--------------------------------------------------------------------------------
/examples/websocket/order_updates/README.md:
--------------------------------------------------------------------------------
1 | # Portfolio Stream Feed WebSocket Client
2 |
3 | This Node.js project illustrates how to connect to the Upstox WebSocket API for streaming live order updates. It fetches the order updates and prints them to the console.
4 |
5 | ## Getting Started
6 |
7 | Follow these instructions to run the websocket client.
8 |
9 | ### Prerequisites
10 |
11 | Before you can run this script, you need to have Node.js and npm installed on your system. If you haven't installed Node.js and npm yet, you can download it from the official website:
12 |
13 | [Download Node.js](https://nodejs.org/en/download)
14 |
15 | You will also need to install several npm packages:
16 |
17 | - `upstox-js-sdk`
18 | - `ws`
19 |
20 | You can install these packages using npm, a package manager for Node.js. Open a terminal and enter the following command:
21 |
22 | ```sh
23 | npm install upstox-js-sdk ws
24 | ```
25 |
26 | ### Configuration
27 |
28 | The script requires an Upstox API access token for authorization. You will need to specify your Upstox API access token in the script. Look for the line below and replace 'ACCESS_TOKEN' with your actual access token.
29 |
30 | ```
31 | OAUTH2.accessToken = "ACCESS_TOKEN";
32 | ```
33 |
34 | ### Running the Script
35 |
36 | After installing the prerequisites and setting up your access token, you can run the script. Navigate to the directory containing the script and run the following command:
37 |
38 | ```
39 | node websocket_client.js
40 | ```
41 |
42 | Replace websocket_client.py with the name of your JavaScript file.
43 |
44 | ## Understanding the Code
45 |
46 | The script first authenticates using an OAuth2 access token. It fetches the authorized redirect URI from the Upstox server and uses this to establish a connection to the Websocket server.
47 |
48 | The script then establishes a websocket connection where it continually receives order update messages from the server and prints them to the console..
49 |
50 | ## Support
51 |
52 | If you encounter any problems or have any questions about this project, feel free to open an issue in this repository.
53 |
54 | ## Disclaimer
55 |
56 | This is a sample script meant for educational purposes. It may require modifications to work with your specific requirements.
57 |
58 | Please replace `'ACCESS_TOKEN'` with your actual access token and `websocket_client.js` with the name of your JavaScript file. Modify any other details as needed to fit your project.
59 |
60 |
61 |
--------------------------------------------------------------------------------
/src/model/GetHolidayResponse.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 | import {HolidayData} from './HolidayData';
17 |
18 | /**
19 | * The GetHolidayResponse model module.
20 | * @module model/GetHolidayResponse
21 | * @version v0
22 | */
23 | export class GetHolidayResponse {
24 | /**
25 | * Constructs a new GetHolidayResponse.
26 | * @alias module:model/GetHolidayResponse
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a GetHolidayResponse from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/GetHolidayResponse} obj Optional instance to populate.
37 | * @return {module:model/GetHolidayResponse} The populated GetHolidayResponse instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new GetHolidayResponse();
42 | if (data.hasOwnProperty('status'))
43 | obj.status = ApiClient.convertToType(data['status'], 'String');
44 | if (data.hasOwnProperty('data'))
45 | obj.data = ApiClient.convertToType(data['data'], [HolidayData]);
46 | }
47 | return obj;
48 | }
49 | }
50 |
51 | /**
52 | * Allowed values for the status property.
53 | * @enum {String}
54 | * @readonly
55 | */
56 | GetHolidayResponse.StatusEnum = {
57 | /**
58 | * value: "success"
59 | * @const
60 | */
61 | success: "success",
62 |
63 | /**
64 | * value: "error"
65 | * @const
66 | */
67 | error: "error"
68 | };
69 | /**
70 | * @member {module:model/GetHolidayResponse.StatusEnum} status
71 | */
72 | GetHolidayResponse.prototype.status = undefined;
73 |
74 | /**
75 | * Response data for holiday list
76 | * @member {Array.PutCallOptionChainData.
27 | * @alias module:model/PutCallOptionChainData
28 | * @class
29 | */
30 | constructor() {
31 | }
32 |
33 | /**
34 | * Constructs a PutCallOptionChainData from a plain JavaScript object, optionally creating a new instance.
35 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
36 | * @param {Object} data The plain JavaScript object bearing properties of interest.
37 | * @param {module:model/PutCallOptionChainData} obj Optional instance to populate.
38 | * @return {module:model/PutCallOptionChainData} The populated PutCallOptionChainData instance.
39 | */
40 | static constructFromObject(data, obj) {
41 | if (data) {
42 | obj = obj || new PutCallOptionChainData();
43 | if (data.hasOwnProperty('instrument_key'))
44 | obj.instrumentKey = ApiClient.convertToType(data['instrument_key'], 'String');
45 | if (data.hasOwnProperty('market_data'))
46 | obj.marketData = MarketData.constructFromObject(data['market_data']);
47 | if (data.hasOwnProperty('option_greeks'))
48 | obj.optionGreeks = AnalyticsData.constructFromObject(data['option_greeks']);
49 | }
50 | return obj;
51 | }
52 | }
53 |
54 | /**
55 | * @member {String} instrumentKey
56 | */
57 | PutCallOptionChainData.prototype.instrumentKey = undefined;
58 |
59 | /**
60 | * @member {module:model/MarketData} marketData
61 | */
62 | PutCallOptionChainData.prototype.marketData = undefined;
63 |
64 | /**
65 | * @member {module:model/AnalyticsData} optionGreeks
66 | */
67 | PutCallOptionChainData.prototype.optionGreeks = undefined;
68 |
69 |
--------------------------------------------------------------------------------
/test/model/PutCallOptionChainData.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | (function(root, factory) {
16 | if (typeof define === 'function' && define.amd) {
17 | // AMD.
18 | define(['expect.js', '../../src/index'], factory);
19 | } else if (typeof module === 'object' && module.exports) {
20 | // CommonJS-like environments that support module.exports, like Node.
21 | factory(require('expect.js'), require('../../src/index'));
22 | } else {
23 | // Browser globals (root is window)
24 | factory(root.expect, root.UpstoxClient);
25 | }
26 | }(this, function(expect, UpstoxClient) {
27 | 'use strict';
28 |
29 | var instance;
30 |
31 | describe('(package)', function() {
32 | describe('PutCallOptionChainData', function() {
33 | beforeEach(function() {
34 | instance = new UpstoxClient.PutCallOptionChainData();
35 | });
36 |
37 | it('should create an instance of PutCallOptionChainData', function() {
38 | // TODO: update the code to test PutCallOptionChainData
39 | expect(instance).to.be.a(UpstoxClient.PutCallOptionChainData);
40 | });
41 |
42 | it('should have the property instrumentKey (base name: "instrument_key")', function() {
43 | // TODO: update the code to test the property instrumentKey
44 | expect(instance).to.have.property('instrumentKey');
45 | // expect(instance.instrumentKey).to.be(expectedValueLiteral);
46 | });
47 |
48 | it('should have the property marketData (base name: "market_data")', function() {
49 | // TODO: update the code to test the property marketData
50 | expect(instance).to.have.property('marketData');
51 | // expect(instance.marketData).to.be(expectedValueLiteral);
52 | });
53 |
54 | it('should have the property optionGreeks (base name: "option_greeks")', function() {
55 | // TODO: update the code to test the property optionGreeks
56 | expect(instance).to.have.property('optionGreeks');
57 | // expect(instance.optionGreeks).to.be(expectedValueLiteral);
58 | });
59 |
60 | });
61 | });
62 |
63 | }));
64 |
--------------------------------------------------------------------------------
/src/model/GetExpiriesResponse.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.66
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 |
17 | /**
18 | * The GetExpiriesResponse model module.
19 | * @module model/GetExpiriesResponse
20 | * @version v0
21 | */
22 | export class GetExpiriesResponse {
23 | /**
24 | * Constructs a new GetExpiriesResponse.
25 | * @alias module:model/GetExpiriesResponse
26 | * @class
27 | */
28 | constructor() {
29 | }
30 |
31 | /**
32 | * Constructs a GetExpiriesResponse from a plain JavaScript object, optionally creating a new instance.
33 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
34 | * @param {Object} data The plain JavaScript object bearing properties of interest.
35 | * @param {module:model/GetExpiriesResponse} obj Optional instance to populate.
36 | * @return {module:model/GetExpiriesResponse} The populated GetExpiriesResponse instance.
37 | */
38 | static constructFromObject(data, obj) {
39 | if (data) {
40 | obj = obj || new GetExpiriesResponse();
41 | if (data.hasOwnProperty('status'))
42 | obj.status = ApiClient.convertToType(data['status'], 'String');
43 | if (data.hasOwnProperty('data'))
44 | obj.data = ApiClient.convertToType(data['data'], ['String']);
45 | }
46 | return obj;
47 | }
48 | }
49 |
50 | /**
51 | * Allowed values for the status property.
52 | * @enum {String}
53 | * @readonly
54 | */
55 | GetExpiriesResponse.StatusEnum = {
56 | /**
57 | * value: "success"
58 | * @const
59 | */
60 | success: "success",
61 |
62 | /**
63 | * value: "error"
64 | * @const
65 | */
66 | error: "error",
67 |
68 | /**
69 | * value: "partial_success"
70 | * @const
71 | */
72 | partialSuccess: "partial_success"
73 | };
74 | /**
75 | * @member {module:model/GetExpiriesResponse.StatusEnum} status
76 | */
77 | GetExpiriesResponse.prototype.status = undefined;
78 |
79 | /**
80 | * @member {Array.GetMarketStatusResponse.
26 | * @alias module:model/GetMarketStatusResponse
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a GetMarketStatusResponse from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/GetMarketStatusResponse} obj Optional instance to populate.
37 | * @return {module:model/GetMarketStatusResponse} The populated GetMarketStatusResponse instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new GetMarketStatusResponse();
42 | if (data.hasOwnProperty('status'))
43 | obj.status = ApiClient.convertToType(data['status'], 'String');
44 | if (data.hasOwnProperty('data'))
45 | obj.data = MarketStatusData.constructFromObject(data['data']);
46 | }
47 | return obj;
48 | }
49 | }
50 |
51 | /**
52 | * Allowed values for the status property.
53 | * @enum {String}
54 | * @readonly
55 | */
56 | GetMarketStatusResponse.StatusEnum = {
57 | /**
58 | * value: "success"
59 | * @const
60 | */
61 | success: "success",
62 |
63 | /**
64 | * value: "error"
65 | * @const
66 | */
67 | error: "error"
68 | };
69 | /**
70 | * @member {module:model/GetMarketStatusResponse.StatusEnum} status
71 | */
72 | GetMarketStatusResponse.prototype.status = undefined;
73 |
74 | /**
75 | * @member {module:model/MarketStatusData} data
76 | */
77 | GetMarketStatusResponse.prototype.data = undefined;
78 |
79 |
--------------------------------------------------------------------------------
/src/model/GetOptionChainResponse.js:
--------------------------------------------------------------------------------
1 | /*
2 | * OpenAPI definition
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: v0
6 | *
7 | * NOTE: This class is auto generated by the swagger code generator program.
8 | * https://github.com/swagger-api/swagger-codegen.git
9 | *
10 | * Swagger Codegen version: 3.0.54
11 | *
12 | * Do not edit the class manually.
13 | *
14 | */
15 | import {ApiClient} from '../ApiClient';
16 | import {OptionStrikeData} from './OptionStrikeData';
17 |
18 | /**
19 | * The GetOptionChainResponse model module.
20 | * @module model/GetOptionChainResponse
21 | * @version v0
22 | */
23 | export class GetOptionChainResponse {
24 | /**
25 | * Constructs a new GetOptionChainResponse.
26 | * @alias module:model/GetOptionChainResponse
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a GetOptionChainResponse from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/GetOptionChainResponse} obj Optional instance to populate.
37 | * @return {module:model/GetOptionChainResponse} The populated GetOptionChainResponse instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new GetOptionChainResponse();
42 | if (data.hasOwnProperty('status'))
43 | obj.status = ApiClient.convertToType(data['status'], 'String');
44 | if (data.hasOwnProperty('data'))
45 | obj.data = ApiClient.convertToType(data['data'], [OptionStrikeData]);
46 | }
47 | return obj;
48 | }
49 | }
50 |
51 | /**
52 | * Allowed values for the status property.
53 | * @enum {String}
54 | * @readonly
55 | */
56 | GetOptionChainResponse.StatusEnum = {
57 | /**
58 | * value: "success"
59 | * @const
60 | */
61 | success: "success",
62 |
63 | /**
64 | * value: "error"
65 | * @const
66 | */
67 | error: "error"
68 | };
69 | /**
70 | * @member {module:model/GetOptionChainResponse.StatusEnum} status
71 | */
72 | GetOptionChainResponse.prototype.status = undefined;
73 |
74 | /**
75 | * Response data for option chain data
76 | * @member {Array.BatchExecutionSummary.
25 | * Execution summary for cancel or exit order request
26 | * @alias module:model/BatchExecutionSummary
27 | * @class
28 | */
29 | constructor() {
30 | }
31 |
32 | /**
33 | * Constructs a BatchExecutionSummary from a plain JavaScript object, optionally creating a new instance.
34 | * Copies all relevant properties from data to obj if supplied or a new instance if not.
35 | * @param {Object} data The plain JavaScript object bearing properties of interest.
36 | * @param {module:model/BatchExecutionSummary} obj Optional instance to populate.
37 | * @return {module:model/BatchExecutionSummary} The populated BatchExecutionSummary instance.
38 | */
39 | static constructFromObject(data, obj) {
40 | if (data) {
41 | obj = obj || new BatchExecutionSummary();
42 | if (data.hasOwnProperty('total'))
43 | obj.total = ApiClient.convertToType(data['total'], 'Number');
44 | if (data.hasOwnProperty('success'))
45 | obj.success = ApiClient.convertToType(data['success'], 'Number');
46 | if (data.hasOwnProperty('error'))
47 | obj.error = ApiClient.convertToType(data['error'], 'Number');
48 | }
49 | return obj;
50 | }
51 | }
52 |
53 | /**
54 | * The total number of order lines present in the payload.
55 | * @member {Number} total
56 | */
57 | BatchExecutionSummary.prototype.total = undefined;
58 |
59 | /**
60 | * The number of order lines that were successfully placed without any errors.
61 | * @member {Number} success
62 | */
63 | BatchExecutionSummary.prototype.success = undefined;
64 |
65 | /**
66 | * The number of order lines that encountered errors during processing, despite their payloads being valid.
67 | * @member {Number} error
68 | */
69 | BatchExecutionSummary.prototype.error = undefined;
70 |
71 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "upstox-js-sdk",
3 | "version": "2.21.0",
4 | "description": "The official Node Js client for communicating with the Upstox API",
5 | "license": "MIT",
6 | "main": "dist/index.js",
7 | "homepage": "https://github.com/upstox/upstox-nodejs#readme",
8 | "scripts": {
9 | "build": "babel src --out-dir dist && shx mkdir -p dist/feeder/proto/ && shx cp src/feeder/proto/*.proto dist/feeder/proto/",
10 | "test": "mocha --require @babel/register --recursive",
11 | "dev-publish-local": "yalc publish",
12 | "dev-push-local": "yalc push",
13 | "dev-release": "npm run build && npm run dev-publish-local && npm run dev-push-local"
14 | },
15 | "keywords": [
16 | "Upstox",
17 | "Share",
18 | "market",
19 | "trading",
20 | "UpstoxAPI"
21 | ],
22 | "browser": {
23 | "fs": false
24 | },
25 | "repository": {
26 | "type": "git",
27 | "url": "git@github.com:upstox/upstox-nodejs.git"
28 | },
29 | "bugs": {
30 | "url": "https://github.com/upstox/upstox-nodejs/issues"
31 | },
32 | "dependencies": {
33 | "@babel/cli": "^7.0.0",
34 | "@babel/traverse": "^7.23.2",
35 | "axios": "^1.7.9",
36 | "minimatch": "^3.0.5",
37 | "nanoid": "^3.1.31",
38 | "protobufjs": "^7.2.6",
39 | "superagent": "^5.3.0",
40 | "uuid4": "^2.0.3",
41 | "ws": "^8.16.0"
42 | },
43 | "devDependencies": {
44 | "@babel/core": "^7.0.0",
45 | "@babel/plugin-proposal-class-properties": "^7.0.0",
46 | "@babel/plugin-proposal-decorators": "^7.0.0",
47 | "@babel/plugin-proposal-do-expressions": "^7.0.0",
48 | "@babel/plugin-proposal-export-default-from": "^7.0.0",
49 | "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
50 | "@babel/plugin-proposal-function-bind": "^7.0.0",
51 | "@babel/plugin-proposal-function-sent": "^7.0.0",
52 | "@babel/plugin-proposal-json-strings": "^7.0.0",
53 | "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
54 | "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
55 | "@babel/plugin-proposal-numeric-separator": "^7.0.0",
56 | "@babel/plugin-proposal-optional-chaining": "^7.0.0",
57 | "@babel/plugin-proposal-pipeline-operator": "^7.0.0",
58 | "@babel/plugin-proposal-throw-expressions": "^7.0.0",
59 | "@babel/plugin-syntax-dynamic-import": "^7.0.0",
60 | "@babel/plugin-syntax-import-meta": "^7.0.0",
61 | "@babel/preset-env": "^7.0.0",
62 | "@babel/register": "^7.0.0",
63 | "expect.js": "^0.3.1",
64 | "mocha": "^10.3.0",
65 | "shx": "^0.3.4",
66 | "sinon": "^7.2.0"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------