UNPKG

@thoshpathi/utils-smartapi-order

Version:

Utility functions for placing live and dummy orders using Angel One's SmartAPI, with helper methods for streamlined trading workflows.

61 lines (59 loc) 1.94 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/config_utils.ts var config_utils_exports = {}; __export(config_utils_exports, { getNakedConfig: () => getNakedConfig, getOptionTypeOfSpread: () => getOptionTypeOfSpread, getSpreadConfig: () => getSpreadConfig }); module.exports = __toCommonJS(config_utils_exports); var spreadConfig = { BUY_call_spread: ["BUY", "SELL"], BUY_put_spread: ["SELL", "BUY"], SELL_call_spread: ["SELL", "BUY"], SELL_put_spread: ["BUY", "SELL"] }; function getSpreadConfig(params) { const { trend, spreadType } = params; return spreadConfig[`${trend}_${spreadType}`]; } var nakedConfig = { BUY_BUY: ["BUY", "CE"], BUY_SELL: ["BUY", "PE"], SELL_BUY: ["SELL", "PE"], SELL_SELL: ["SELL", "CE"] }; function getNakedConfig(params) { const { trend, transaction } = params; return nakedConfig[`${transaction}_${trend}`]; } var spreadOptionConfig = { call_spread: "CE", put_spread: "PE" }; function getOptionTypeOfSpread(spreadType) { return spreadOptionConfig[spreadType]; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { getNakedConfig, getOptionTypeOfSpread, getSpreadConfig });