
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@mstock-mirae-asset/nodetradingapi-typeb
Advanced tools
The official TypeScript/JavaScript client for mStock TypeB Trading API
The official TypeScript/JavaScript client for communicating with the TypeB Trading API.
mStock TypeB is a comprehensive trading API that provides capabilities required to build a complete investment and trading platform. Execute orders in real time, manage user portfolio, stream live market data (WebSockets), and more.
Install via npm
npm install @mstock-mirae-asset/nodetradingapi-typeb
import { MConnect } from '@mstock-mirae-asset/nodetradingapi-typeb';
// Initialize the client
const client = new MConnect('https://api.mstock.trade', 'your-api-key');
// Login
const loginResponse = await client.login({
clientcode: 'your-client-code',
password: 'your-password',
totp: 'your-totp',
state: 'your-state'
});
// Set access token
client.setAccessToken(loginResponse.data.jwtToken);
const order = await client.placeOrder({
variety: 'NORMAL',
tradingsymbol: 'INFY',
symboltoken: '1594',
exchange: 'NSE',
transactiontype: 'BUY',
ordertype: 'LIMIT',
quantity: '100',
producttype: 'DELIVERY',
price: '1500'
});
The SDK supports JWT token authentication. After successful login, use the setAccessToken
method to set the authentication token.
const loginResponse = await client.login({
clientcode: 'your-client-code',
password: 'your-password',
totp: 'your-totp',
state: 'your-state'
});
client.setAccessToken(loginResponse.data.jwtToken);
// Place an order
const order = await client.placeOrder({
variety: 'NORMAL',
tradingsymbol: 'INFY',
symboltoken: '1594',
exchange: 'NSE',
transactiontype: 'BUY',
ordertype: 'LIMIT',
quantity: '100',
producttype: 'DELIVERY',
price: '1500'
});
// Modify an order
const modifiedOrder = await client.modifyOrder({
variety: 'NORMAL',
orderid: '123456',
tradingsymbol: 'INFY',
symboltoken: '1594',
exchange: 'NSE',
ordertype: 'MARKET',
quantity: '50',
producttype: 'DELIVERY'
});
// Cancel an order
await client.cancelOrder({
variety: 'NORMAL',
orderid: '123456'
});
// Get positions
const positions = await client.getPositions();
// Get holdings
const holdings = await client.getHoldings();
// Get fund summary
const fundSummary = await client.getFundSummary();
// Get historical data
const historicalData = await client.getHistoricalData({
exchange: 'NSE',
symboltoken: '1594',
interval: 'ONE_MINUTE',
fromdate: '2024-01-01',
todate: '2024-01-31'
});
// Get real-time quotes
const quotes = await client.getQuote({
mode: 'FULL',
exchangeTokens: {
NSE: ['1594', '2885'],
BSE: ['500325', '500209']
}
});
// Create basket
const basket = await client.createBasket({
BaskName: 'MyStrategy',
BaskDesc: 'My trading strategy basket'
});
// Calculate basket
const calculation = await client.calculateBasket({
basket_name: 'MyStrategy',
basket_id: '123',
operation: 'CALCULATE',
include_exist_pos: 'Y'
});
Method | Description |
---|---|
login() | User authentication |
verifyOTP() | Verify OTP for session token |
verifyTOTP() | Verify TOTP for 2FA |
logout() | User logout |
Method | Description |
---|---|
placeOrder() | Place new orders |
modifyOrder() | Modify existing orders |
cancelOrder() | Cancel orders |
cancelAllOrders() | Cancel all open orders |
Method | Description |
---|---|
getPositions() | Get open positions |
getHoldings() | Get portfolio holdings |
getFundSummary() | Get fund summary |
Method | Description |
---|---|
getHistoricalData() | Get historical candlestick data |
getIntradayChartData() | Get intraday chart data |
getQuote() | Get real-time quotes |
getInstrumentMaster() | Get instrument master data |
Method | Description |
---|---|
getOptionChainMaster() | Get option chain master data |
getOptionChain() | Get detailed option chain data |
npm test
npm run build
MIT License - see LICENSE file for details.
mStock By Mirae Asset Capital Markets (India) Pvt. Ltd. (c) 2025. Licensed under the MIT License.
For issues, please open an issue on GitHub.
We welcome contributions! Please follow these steps:
FAQs
The official TypeScript/JavaScript client for mStock TypeB Trading API
We found that @mstock-mirae-asset/nodetradingapi-typeb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.