Socket
Socket
Sign inDemoInstall

5paisajs

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

5paisajs

Javascript client for 5paisa APIs natively written in .NET


Version published
Weekly downloads
26
decreased by-48%
Maintainers
1
Weekly downloads
 
Created
Source

5paisajs

Official Javascript client for 5paisa APIs natively written in .NET

Installation

npm install 5paisajs --save

Usage

Authentication

Get your API keys from https://www.5paisa.com/DeveloperAPI/APIKeys

// Configuration for your app
const conf = {
    "appSource": "",
    "appName": "",
    "userId": "",
    "password": "",
    "userKey": "",
    "encryptionKey": ""
}

const { FivePaisaClient } = require("5paisajs")

var client = new FivePaisaClient(conf)

// This client object can be used to login multiple users.
client.login("random_email@xyz.com", "password", "YYYYMMDD").then((response) => {
    client.init(response).then(() => {
        // Fetch holdings, positions or place orders here.
        // Some things to try out are given below.
    })
}).catch((err) =>{
    // Oh no :/
    console.log(err)
})

Fetch Holdings

client.getHoldings().then((holdings) => {
    console.log(holdings)
}).catch((err) => {
    console.log(err)
});

/*
[
  {
    BseCode: 535755,
    CurrentPrice: 140,
    DPQty: 0,
    Exch: '\x00',
    ExchType: 'C',
    FullName: 'XYZ ABC',
    NseCode: 30108,
    POASigned: 'N',
    PoolQty: 1,
    Quantity: 1,
    ScripMultiplier: 1,
    Symbol: 'XYZ'
  }
]
*/

Fetch Positions

client.getPositions().then((positions) => {
    console.log(positions)
}).catch((err) => {
    console.log(err)
});
/*
[
  {
    BodQty: 0,
    BookedPL: 0,
    BuyAvgRate: 2.15,
    BuyQty: 2,
    BuyValue: 4.3,
    Exch: 'N',
    ExchType: 'C',
    LTP: 2.15,
    MTOM: 0,
    Multiplier: 1,
    NetQty: 2,
    OrderFor: 'D',
    PreviousClose: 2.25,
    ScripCode: 5831,
    ScripName: 'XYZ',
    SellAvgRate: 0,
    SellQty: 0,
    SellValue: 0
  }
]
*/

Place cash order

var options = {}
try {
      client.placeOrder("BUY", "11111", "1", "B", options).then((response) => {
          console.log(response)
        })
    }
catch (err) {
    console.log(err)
  }

/*
{
  BrokerOrderID: 302493444,
  ClientCode: '51882016',
  Exch: 'N',
  ExchOrderID: '',
  ExchType: 'C',
  LocalOrderID: 0,
  Message: 'Success',
  RMSResponseCode: 0,
  ScripCode: 11111,
  Status: 0,
  Time: '/Date(1598812200000+0530)/'
}
*/

Keywords

FAQs

Package last updated on 07 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc