UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

203 lines (182 loc) 8.19 kB
/* * Upstox Developer API * Build your App on the Upstox platform ![Banner](https://api.upstox.com/api-docs/images/banner.jpg \"banner\") # Introduction Upstox API is a set of rest APIs that provide data required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (using Websocket), and more, with the easy to understand API collection. All requests are over HTTPS and the requests are sent with the content-type ‘application/json’. Developers have the option of choosing the response type as JSON or CSV for a few API calls. To be able to use these APIs you need to create an App in the Developer Console and generate your **apiKey** and **apiSecret**. You can use a redirect URL which will be called after the login flow. If you are a **trader**, you can directly create apps from Upstox mobile app or the desktop platform itself from **Apps** sections inside the **Account** Tab. Head over to <a href=\"http://account.upstox.com/developer/apps\" target=\"_blank\">account.upstox.com/developer/apps</a>.</br> If you are a **business** looking to integrate Upstox APIs, reach out to us and we will get a custom app created for you in no time. It is highly recommended that you do not embed the **apiSecret** in your frontend app. Create a remote backend which does the handshake on behalf of the frontend app. Marking the apiSecret in the frontend app will make your app vulnerable to threats and potential issues. * * OpenAPI spec version: v2 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 3.0.46 * * Do not edit the class manually. * */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. define(['expect.js', '../../src/index'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. factory(require('expect.js'), require('../../src/index')); } else { // Browser globals (root is window) factory(root.expect, root.UpstoxClient); } }(this, function(expect, UpstoxClient) { 'use strict'; var instance; beforeEach(function() { instance = new UpstoxClient.OrderApi(); }); describe('(package)', function() { describe('OrderApi', function() { describe('cancelOrder', function() { it('should call cancelOrder successfully', function(done) { // TODO: uncomment, update parameter values for cancelOrder call and complete the assertions /* instance.cancelOrder(orderId, apiVersion, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.CancelOrderResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); describe('getOrderBook', function() { it('should call getOrderBook successfully', function(done) { // TODO: uncomment, update parameter values for getOrderBook call and complete the assertions /* instance.getOrderBook(apiVersion, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.GetOrderBookResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); describe('getOrderDetails', function() { it('should call getOrderDetails successfully', function(done) { // TODO: uncomment, update parameter values for getOrderDetails call and complete the assertions /* var opts = {}; instance.getOrderDetails(apiVersion, opts, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.GetOrderResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); describe('getOrderStatus', function() { it('should call getOrderStatus successfully', function(done) { // TODO: uncomment, update parameter values for getOrderStatus call and complete the assertions /* var opts = {}; instance.getOrderStatus(opts, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.GetOrderDetailsResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); describe('getTradeHistory', function() { it('should call getTradeHistory successfully', function(done) { // TODO: uncomment, update parameter values for getTradeHistory call and complete the assertions /* instance.getTradeHistory(apiVersion, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.GetTradeResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); describe('getTradesByOrder', function() { it('should call getTradesByOrder successfully', function(done) { // TODO: uncomment, update parameter values for getTradesByOrder call and complete the assertions /* instance.getTradesByOrder(orderId, apiVersion, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.GetTradeResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); describe('modifyOrder', function() { it('should call modifyOrder successfully', function(done) { // TODO: uncomment, update parameter values for modifyOrder call and complete the assertions /* instance.modifyOrder(body, apiVersion, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.ModifyOrderResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); describe('placeOrder', function() { it('should call placeOrder successfully', function(done) { // TODO: uncomment, update parameter values for placeOrder call and complete the assertions /* instance.placeOrder(body, apiVersion, function(error, data, response) { if (error) { done(error); return; } // TODO: update response assertions expect(data).to.be.a(UpstoxClient.PlaceOrderResponse); done(); }); */ // TODO: uncomment and complete method invocation above, then delete this line and the next: done(); }); }); }); }); }));