@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.
35 lines (33 loc) • 806 B
JavaScript
// src/config_utils.ts
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];
}
export {
getSpreadConfig,
getNakedConfig,
getOptionTypeOfSpread
};