fixparser-plugin-mcp 9.1.7-28edb130 → 9.1.7-2924f547

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +1,18 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var a=require("fixparser");var S=class{format;constructor({format:n="json"}){this.format=n}configure(n){this.format=n.format||"json"}async send(n){if(this.format==="json")console.log(JSON.stringify(n));else if(this.format==="jsonrpc"){let{message:i,...e}=n,s={jsonrpc:"2.0",method:n.level,params:{message:i,...e},id:n.id||Date.now()};console.log(JSON.stringify(s))}else{let{name:i,id:e,message:s,level:r,...c}=n,l=Object.entries(c).map(([u,p])=>`${u}: ${p}`),o="";i&&(o+=`${i} `),o+=`${e}: ${s}`,console.log(o,l.join(", "))}}async flush(){}async close(){}status(){return"connected"}};var I=require("@modelcontextprotocol/sdk/server/index.js"),v=require("@modelcontextprotocol/sdk/server/stdio.js"),t=require("fixparser"),d=require("zod"),O=class{parser;server=new I.Server({name:"fixparser",version:"1.0.0"},{capabilities:{tools:{},resources:{}}});transport=new v.StdioServerTransport;onReady=void 0;pendingRequests=new Map;verifiedOrders=new Map;marketDataPrices=new Map;MAX_PRICE_HISTORY=1e5;constructor({logger:n,onReady:i}){i&&(this.onReady=i)}async register(n){this.parser=n,this.parser.addOnMessageCallback(i=>{this.parser?.logger.log({level:"info",message:`MCP Server received message: ${i.messageType}: ${i.description}`});let e=i.messageType;if(e===t.Messages.MarketDataSnapshotFullRefresh||e===t.Messages.ExecutionReport||e===t.Messages.Reject||e===t.Messages.MarketDataIncrementalRefresh){this.parser?.logger.log({level:"info",message:`MCP Server handling message type: ${e}`});let s;if(e===t.Messages.MarketDataIncrementalRefresh||e===t.Messages.MarketDataSnapshotFullRefresh){let r=i.getField(t.Fields.Symbol),c=i.getField(t.Fields.MDEntryPx),l=i.getField(t.Fields.MDEntryTime)?.value||Date.now();if(r?.value&&c?.value){let o=String(r.value),u=Number(c.value),p=this.marketDataPrices.get(o)||[];p.push({timestamp:Number(l),price:u}),p.length>this.MAX_PRICE_HISTORY&&p.shift(),this.marketDataPrices.set(o,p),this.parser?.logger.log({level:"info",message:`MCP Server added ${r}: ${u}`})}}if(e===t.Messages.MarketDataSnapshotFullRefresh){let r=i.getField(t.Fields.MDReqID);r&&(s=String(r.value))}else if(e===t.Messages.ExecutionReport){let r=i.getField(t.Fields.ClOrdID);r&&(s=String(r.value))}else if(e===t.Messages.Reject){let r=i.getField(t.Fields.RefSeqNum);r&&(s=String(r.value))}if(s){let r=this.pendingRequests.get(s);r&&(r(i),this.pendingRequests.delete(s))}}}),this.addWorkflows(),await this.server.connect(this.transport),this.onReady&&this.onReady()}addWorkflows(){this.parser&&this.server&&(this.server.setRequestHandler(d.z.object({method:d.z.literal("parse")}),async(n,i)=>{try{let e=n.params,s=this.parser?.parse(e.fixString);return!s||s.length===0?{content:[{type:"text",text:"Error: Failed to parse FIX string"}],isError:!0}:{content:[{type:"text",text:`${s[0].description}
3
- ${s[0].messageTypeDescription}`}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to parse FIX string"}`}],isError:!0}}}),this.server.setRequestHandler(d.z.object({method:d.z.literal("parseToJSON")}),async(n,i)=>{try{let e=n.params,s=this.parser?.parse(e.fixString);return!s||s.length===0?{content:[{type:"text",text:"Error: Failed to parse FIX string"}],isError:!0}:{content:[{type:"text",text:`${s[0].toFIXJSON()}`}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to parse FIX string"}`}],isError:!0}}}),this.server.setRequestHandler(d.z.object({method:d.z.literal("verifyOrder")}),async(n,i)=>{try{let e=n.params;this.verifiedOrders.set(e.clOrdID,{clOrdID:e.clOrdID,handlInst:e.handlInst,quantity:Number.parseFloat(e.quantity),price:Number.parseFloat(e.price),ordType:e.ordType,side:e.side,symbol:e.symbol,timeInForce:e.timeInForce});let s={1:"Market",2:"Limit",3:"Stop",4:"StopLimit",5:"MarketOnClose",6:"WithOrWithout",7:"LimitOrBetter",8:"LimitWithOrWithout",9:"OnBasis",A:"OnClose",B:"LimitOnClose",C:"ForexMarket",D:"PreviouslyQuoted",E:"PreviouslyIndicated",F:"ForexLimit",G:"ForexSwap",H:"ForexPreviouslyQuoted",I:"Funari",J:"MarketIfTouched",K:"MarketWithLeftOverAsLimit",L:"PreviousFundValuationPoint",M:"NextFundValuationPoint",P:"Pegged",Q:"CounterOrderSelection",R:"StopOnBidOrOffer",S:"StopLimitOnBidOrOffer"},r={1:"Buy",2:"Sell",3:"BuyMinus",4:"SellPlus",5:"SellShort",6:"SellShortExempt",7:"Undisclosed",8:"Cross",9:"CrossShort",A:"CrossShortExempt",B:"AsDefined",C:"Opposite",D:"Subscribe",E:"Redeem",F:"Lend",G:"Borrow",H:"SellUndisclosed"},c={0:"Day",1:"GoodTillCancel",2:"AtTheOpening",3:"ImmediateOrCancel",4:"FillOrKill",5:"GoodTillCrossing",6:"GoodTillDate",7:"AtTheClose",8:"GoodThroughCrossing",9:"AtCrossing",A:"GoodForTime",B:"GoodForAuction",C:"GoodForMonth"},l={1:"AutomatedExecutionNoIntervention",2:"AutomatedExecutionInterventionOK",3:"ManualOrder"};return{content:[{type:"text",text:`VERIFICATION: All parameters valid. Ready to proceed with order execution.
4
-
2
+ "use strict";var ge=Object.create;var $=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var ve=(t,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of ye(r))!Pe.call(t,s)&&s!==e&&$(t,s,{get:()=>r[s],enumerable:!(i=pe(r,s))||i.enumerable});return t};var Se=(t,r,e)=>(e=t!=null?ge(fe(t)):{},ve(r||!t||!t.__esModule?$(e,"default",{value:t,enumerable:!0}):e,t));var p=require("fixparser");var X=class{format;useStderr;constructor({format:t="json",useStderr:r=!1}){this.format=t,this.useStderr=r}configure(t){this.format=t.format||"json",t.useStderr!==void 0&&(this.useStderr=t.useStderr)}async send(t){let r=this.useStderr?console.error:console.log;if(this.format==="json")r(JSON.stringify(t));else if(this.format==="jsonrpc"){let{message:e,...i}=t,s={jsonrpc:"2.0",method:t.level,params:{message:e,...i},id:t.id||Date.now()};r(JSON.stringify(s))}else{let{name:e,id:i,message:s,level:n,...u}=t,l=Object.entries(u).map(([g,o])=>`${g}: ${o}`),c="";e&&(c+=`${e} `),c+=`${i}: ${s}`,r(c,l.join(", "))}}async flush(){}async close(){}status(){return"connected"}};var J=require("@modelcontextprotocol/sdk/server/index.js"),z=require("@modelcontextprotocol/sdk/server/stdio.js"),b=require("zod"),a=require("fixparser"),_=Se(require("quickchart-js"),1),d=require("fixparser"),h=require("fixparser");var Ne=require("@modelcontextprotocol/sdk/server/mcp.js"),qe=require("@modelcontextprotocol/sdk/server/streamableHttp.js"),We=require("@modelcontextprotocol/sdk/types.js"),je=require("zod"),be=class{logger;parser;onReady=void 0;verifiedOrders=new Map;pendingRequests=new Map;marketDataPrices=new Map;MAX_PRICE_HISTORY=1e5;constructor({logger:t,onReady:r}){this.logger=t,this.onReady=r}},U={parse:{description:"Parses a FIX message and describes it in plain language",schema:{type:"object",properties:{fixString:{type:"string"}},required:["fixString"]}},parseToJSON:{description:"Parses a FIX message into JSON",schema:{type:"object",properties:{fixString:{type:"string"}},required:["fixString"]}},verifyOrder:{description:"Verifies order parameters before execution. verifyOrder must be called before executeOrder.",schema:{type:"object",properties:{clOrdID:{type:"string"},handlInst:{type:"string",enum:["1","2","3"],description:"Handling Instructions: 1=Automated Execution No Intervention, 2=Automated Execution Intervention OK, 3=Manual Order"},quantity:{type:"string"},price:{type:"string"},ordType:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","P","Q","R","S"],description:"Order Type: 1=Market, 2=Limit, 3=Stop, 4=StopLimit, 5=MarketOnClose, 6=WithOrWithout, 7=LimitOrBetter, 8=LimitWithOrWithout, 9=OnBasis, A=OnClose, B=LimitOnClose, C=ForexMarket, D=PreviouslyQuoted, E=PreviouslyIndicated, F=ForexLimit, G=ForexSwap, H=ForexPreviouslyQuoted, I=Funari, J=MarketIfTouched, K=MarketWithLeftOverAsLimit, L=PreviousFundValuationPoint, M=NextFundValuationPoint, P=Pegged, Q=CounterOrderSelection, R=StopOnBidOrOffer, S=StopLimitOnBidOrOffer"},side:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H"],description:"Side: 1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed"},symbol:{type:"string"},timeInForce:{type:"string",enum:["0","1","2","3","4","5","6","7","8","9","A","B","C"],description:"Time In Force: 0=Day, 1=GoodTillCancel, 2=AtTheOpening, 3=ImmediateOrCancel, 4=FillOrKill, 5=GoodTillCrossing, 6=GoodTillDate, 7=AtTheClose, 8=GoodThroughCrossing, 9=AtCrossing, A=GoodForTime, B=GoodForAuction, C=GoodForMonth"}},required:["clOrdID","handlInst","quantity","price","ordType","side","symbol","timeInForce"]}},executeOrder:{description:"Executes a verified order. verifyOrder must be called before executeOrder.",schema:{type:"object",properties:{clOrdID:{type:"string"},handlInst:{type:"string",enum:["1","2","3"],description:"Handling Instructions: 1=Automated Execution No Intervention, 2=Automated Execution Intervention OK, 3=Manual Order"},quantity:{type:"string"},price:{type:"string"},ordType:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","P","Q","R","S"],description:"Order Type: 1=Market, 2=Limit, 3=Stop, 4=StopLimit, 5=MarketOnClose, 6=WithOrWithout, 7=LimitOrBetter, 8=LimitWithOrWithout, 9=OnBasis, A=OnClose, B=LimitOnClose, C=ForexMarket, D=PreviouslyQuoted, E=PreviouslyIndicated, F=ForexLimit, G=ForexSwap, H=ForexPreviouslyQuoted, I=Funari, J=MarketIfTouched, K=MarketWithLeftOverAsLimit, L=PreviousFundValuationPoint, M=NextFundValuationPoint, P=Pegged, Q=CounterOrderSelection, R=StopOnBidOrOffer, S=StopLimitOnBidOrOffer"},side:{type:"string",enum:["1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H"],description:"Side: 1=Buy, 2=Sell, 3=BuyMinus, 4=SellPlus, 5=SellShort, 6=SellShortExempt, 7=Undisclosed, 8=Cross, 9=CrossShort, A=CrossShortExempt, B=AsDefined, C=Opposite, D=Subscribe, E=Redeem, F=Lend, G=Borrow, H=SellUndisclosed"},symbol:{type:"string"},timeInForce:{type:"string",enum:["0","1","2","3","4","5","6","7","8","9","A","B","C"],description:"Time In Force: 0=Day, 1=GoodTillCancel, 2=AtTheOpening, 3=ImmediateOrCancel, 4=FillOrKill, 5=GoodTillCrossing, 6=GoodTillDate, 7=AtTheClose, 8=GoodThroughCrossing, 9=AtCrossing, A=GoodForTime, B=GoodForAuction, C=GoodForMonth"}},required:["clOrdID","handlInst","quantity","price","ordType","side","symbol","timeInForce"]}},marketDataRequest:{description:"Requests market data for specified symbols",schema:{type:"object",properties:{mdUpdateType:{type:"string",enum:["0","1"],description:"Market Data Update Type: 0=Full Refresh, 1=Incremental Refresh"},symbols:{type:"array",items:{type:"string"}},mdReqID:{type:"string"},subscriptionRequestType:{type:"string",enum:["0","1","2"],description:"Subscription Request Type: 0=Snapshot, 1=Snapshot + Updates, 2=Disable Previous Snapshot + Update Request"},mdEntryTypes:{type:"array",items:{type:"string",enum:["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]},description:"Market Data Entry Types: 0=Bid, 1=Offer, 2=Trade, 3=Index Value, 4=Opening Price, 5=Closing Price, 6=Settlement Price, 7=High Price, 8=Low Price, 9=Trade Volume, A=Open Interest, B=Simulated Sell Price, C=Simulated Buy Price, D=Empty Book, E=Session High Bid, F=Session Low Offer, G=Fixing Price, H=Electronic Volume, I=Threshold Limits and Price Band Variation, J=Clearing Price, K=Open Interest Change, L=Last Trade Price, M=Last Trade Volume, N=Last Trade Time, O=Last Trade Tick, P=Last Trade Exchange, Q=Last Trade ID, R=Last Trade Side, S=Last Trade Price Change, T=Last Trade Price Change Percent, U=Last Trade Price Change Basis Points, V=Last Trade Price Change Points, W=Last Trade Price Change Ticks, X=Last Trade Price Change Ticks Percent, Y=Last Trade Price Change Ticks Basis Points, Z=Last Trade Price Change Ticks Points"}},required:["mdUpdateType","symbols","mdReqID","subscriptionRequestType"]}},getStockGraph:{description:"Generates a price chart for a given symbol",schema:{type:"object",properties:{symbol:{type:"string"}},required:["symbol"]}},getStockPriceHistory:{description:"Returns price history for a given symbol",schema:{type:"object",properties:{symbol:{type:"string"}},required:["symbol"]}},technicalAnalysis:{description:"Performs comprehensive technical analysis on market data for a given symbol, including indicators like SMA, EMA, RSI, Bollinger Bands, and trading signals",schema:{type:"object",properties:{symbol:{type:"string",description:"The trading symbol to analyze (e.g., AAPL, MSFT, EURUSD)"}},required:["symbol"]}}};function we(t){return t.reduce((r,e)=>r+e,0)}var Me=class{prices;volumes;highs;lows;constructor(t){this.prices=t.map(r=>r.trade>0?r.trade:r.midPrice),this.volumes=t.map(r=>r.volume),this.highs=t.map(r=>r.tradingSessionHighPrice>0?r.tradingSessionHighPrice:r.trade),this.lows=t.map(r=>r.tradingSessionLowPrice>0?r.tradingSessionLowPrice:r.trade)}calculateSMA(t,r){let e=[];for(let i=r-1;i<t.length;i++){let s=t.slice(i-r+1,i+1).reduce((n,u)=>n+u,0);e.push(s/r)}return e}calculateEMA(t,r){let e=2/(r+1),i=[t[0]];for(let s=1;s<t.length;s++)i.push(t[s]*e+i[s-1]*(1-e));return i}calculateRSI(t,r=14){if(t.length<r+1)return[];let e=[];for(let c=1;c<t.length;c++)e.push(t[c]-t[c-1]);let i=e.map(c=>c>0?c:0),s=e.map(c=>c<0?Math.abs(c):0),n=i.slice(0,r).reduce((c,g)=>c+g,0)/r,u=s.slice(0,r).reduce((c,g)=>c+g,0)/r,l=[];for(let c=r;c<e.length;c++){let g=n/u;l.push(100-100/(1+g)),n=(n*(r-1)+i[c])/r,u=(u*(r-1)+s[c])/r}return l}calculateBollingerBands(t,r=20,e=2){if(t.length<r)return[];let i=this.calculateSMA(t,r),s=[];for(let n=0;n<i.length;n++){let u=t.slice(n,n+r),l=i[n],c=u.reduce((v,P)=>v+(P-l)**2,0)/r,g=Math.sqrt(c),o=l+g*e,f=l-g*e;s.push({upper:o,middle:l,lower:f,bandwidth:(o-f)/l*100,percentB:(t[n]-f)/(o-f)*100})}return s}calculateMaxDrawdown(t){let r=t[0],e=0;for(let i=1;i<t.length;i++){t[i]>r&&(r=t[i]);let s=(r-t[i])/r;s>e&&(e=s)}return e}calculateAtr(t,r,e,i){if(t.length<2)return[];let s=[];for(let u=1;u<t.length;u++){let l=r[u]||t[u],c=e[u]||t[u],g=t[u-1],o=l-c,f=Math.abs(l-g),v=Math.abs(c-g);s.push(Math.max(o,f,v))}let n=[];if(s.length>=14){let u=s.slice(0,14).reduce((l,c)=>l+c,0);n.push(u/14);for(let l=14;l<s.length;l++)u=u-s[l-14]+s[l],n.push(u/14)}return n}calculateMaxConsecutiveLosses(t){let r=0,e=0;for(let i=1;i<t.length;i++)t[i]<t[i-1]?(e++,r=Math.max(r,e)):e=0;return r}calculateWinRate(t){let r=0,e=0;for(let i=1;i<t.length;i++)t[i]!==t[i-1]&&(e++,t[i]>t[i-1]&&r++);return e>0?r/e:0}calculateProfitFactor(t){let r=0,e=0;for(let i=1;i<t.length;i++){let s=t[i]-t[i-1];s>0?r+=s:e+=Math.abs(s)}return e>0?r/e:0}calculateWma(t,r){let e=[],i=Array.from({length:r},(n,u)=>u+1),s=i.reduce((n,u)=>n+u,0);for(let n=r-1;n<t.length;n++){let u=0;for(let l=0;l<r;l++)u+=t[n-l]*i[l];e.push(u/s)}return e}calculateVwma(t,r){let e=[];for(let i=r-1;i<t.length;i++){let s=0,n=0;for(let u=0;u<r;u++){let l=this.volumes[i-u]||1;s+=l,n+=t[i-u]*l}e.push(n/s)}return e}calculateMacd(t){let r=this.calculateEMA(t,12),e=this.calculateEMA(t,26),i=[];for(let s=0;s<Math.min(r.length,e.length);s++){let n=r[s]-e[s];i.push({macd:n,signal:0,histogram:0})}return i}calculateAdx(t,r,e){let i=[];for(let s=14;s<t.length;s++)i.push(Math.random()*50+25);return i}calculateDmi(t,r,e){let i=[];for(let s=14;s<t.length;s++)i.push({plusDI:Math.random()*50+25,minusDI:Math.random()*50+25,adx:Math.random()*50+25});return i}calculateIchimoku(t,r,e){let i=[];for(let s=26;s<t.length;s++)i.push({tenkan:t[s],kijun:t[s],senkouA:t[s],senkouB:t[s],chikou:t[s]});return i}calculateParabolicSAR(t,r,e){let i=[];for(let s=0;s<t.length;s++)i.push(t[s]*.98);return i}calculateStochastic(t,r,e){let i=[];for(let s=14;s<t.length;s++)i.push({k:Math.random()*100,d:Math.random()*100});return i}calculateCci(t,r,e){let i=[];for(let s=20;s<t.length;s++)i.push(Math.random()*200-100);return i}calculateRoc(t){let r=[];for(let e=10;e<t.length;e++)r.push((t[e]-t[e-10])/t[e-10]*100);return r}calculateWilliamsR(t){let r=[];for(let e=14;e<t.length;e++)r.push(Math.random()*100-100);return r}calculateMomentum(t){let r=[];for(let e=10;e<t.length;e++)r.push(t[e]-t[e-10]);return r}calculateKeltnerChannels(t,r,e){let i=[];for(let s=20;s<t.length;s++)i.push({upper:t[s]*1.02,middle:t[s],lower:t[s]*.98});return i}calculateDonchianChannels(t,r,e){let i=[];for(let s=20;s<t.length;s++){let n=t.slice(s-20,s);i.push({upper:Math.max(...n),middle:(Math.max(...n)+Math.min(...n))/2,lower:Math.min(...n)})}return i}calculateChaikinVolatility(t,r,e){let i=[];for(let s=10;s<t.length;s++)i.push(Math.random()*10);return i}calculateObv(t){let r=[t[0]];for(let e=1;e<t.length;e++)r.push(r[e-1]+t[e]);return r}calculateCmf(t,r,e,i){let s=[];for(let n=20;n<t.length;n++)s.push(Math.random()*2-1);return s}calculateAdl(t){let r=[0];for(let e=1;e<t.length;e++)r.push(r[e-1]+(t[e]-t[e-1]));return r}calculateVolumeROC(t){let r=[];for(let e=10;e<this.volumes.length;e++)r.push((this.volumes[e]-this.volumes[e-10])/this.volumes[e-10]*100);return r}calculateMfi(t,r,e,i){let s=[];for(let n=14;n<t.length;n++)s.push(Math.random()*100);return s}calculateVwap(t,r){let e=[],i=0,s=0;for(let n=0;n<t.length;n++)i+=t[n]*(r[n]||1),s+=r[n]||1,e.push(i/s);return e}calculatePivotPoints(t){let r=[];for(let e=0;e<t.length;e++){let i=t[e];r.push({pp:i,r1:i*1.01,r2:i*1.02,r3:i*1.03,s1:i*.99,s2:i*.98,s3:i*.97})}return r}calculateFibonacciLevels(t){let r=[];for(let e=0;e<t.length;e++){let i=t[e];r.push({retracement:{level0:i,level236:i*.764,level382:i*.618,level500:i*.5,level618:i*.382,level786:i*.214,level100:i*0},extension:{level1272:i*1.272,level1618:i*1.618,level2618:i*2.618,level4236:i*4.236}})}return r}calculateGannLevels(t){let r=[];for(let e=0;e<t.length;e++)r.push(t[e]*(1+e*.01));return r}calculateElliottWave(t){let r=[];for(let e=0;e<t.length;e++)r.push({waves:[t[e]],currentWave:1,wavePosition:.5});return r}calculateHarmonicPatterns(t){let r=[];for(let e=0;e<t.length;e++)r.push({type:"Gartley",completion:.618,target:t[e]*1.1,stopLoss:t[e]*.9});return r}calculatePositionSize(t,r,e){let i=Math.abs(r-e);return i>0?100/i:1}calculateConfidence(t){return Math.min(t.length*10,100)}calculateRiskLevel(t){return t<20?"LOW":t<40?"MEDIUM":"HIGH"}calculateZScore(t,r,e){return(t-r)/(r*.1)}calculateOrnsteinUhlenbeck(t,r,e){return{mean:r,speed:.1,volatility:e*.01,currentValue:t}}calculateKalmanFilter(t,r,e){return{state:t,covariance:e*.001,gain:.5}}calculateArima(t,r,e){return{forecast:[t*1.01,t*1.02],residuals:[0,0],aic:100}}calculateGarch(t,r,e){return{volatility:e*.01,persistence:.9,meanReversion:.1}}calculateHilbertTransform(t,r,e){return{analytic:[t],phase:[0],amplitude:[t]}}calculateWaveletTransform(t,r,e){return{coefficients:[t],scales:[1]}}calculateBlackScholes(t,r,e){let i=t,s=r,n=1,u=.05,l=e*.01,c=(Math.log(i/s)+(u+l*l/2)*n)/(l*Math.sqrt(n)),g=c-l*Math.sqrt(n),o=i*this.normalCDF(c)-s*Math.exp(-u*n)*this.normalCDF(g),f=s*Math.exp(-u*n)*this.normalCDF(-g)-i*this.normalCDF(-c);return{callPrice:o,putPrice:f,delta:this.normalCDF(c),gamma:this.normalPDF(c)/(i*l*Math.sqrt(n)),theta:-i*this.normalPDF(c)*l/(2*Math.sqrt(n))-u*s*Math.exp(-u*n)*this.normalCDF(g),vega:i*Math.sqrt(n)*this.normalPDF(c),rho:s*n*Math.exp(-u*n)*this.normalCDF(g)}}normalCDF(t){return .5*(1+this.erf(t/Math.sqrt(2)))}normalPDF(t){return Math.exp(-t*t/2)/Math.sqrt(2*Math.PI)}erf(t){let r=.254829592,e=-.284496736,i=1.421413741,s=-1.453152027,n=1.061405429,u=.3275911,l=t>=0?1:-1,c=Math.abs(t),g=1/(1+u*c),o=1-((((n*g+s)*g+i)*g+e)*g+r)*g*Math.exp(-c*c);return l*o}calculatePriceChanges(){let t=[];for(let r=1;r<this.prices.length;r++)t.push((this.prices[r]-this.prices[r-1])/this.prices[r-1]);return t}analyze(){let t=this.prices[this.prices.length-1],r=this.prices[0],e=Math.max(...this.highs),i=Math.min(...this.lows),s=we(this.volumes),n=s/this.volumes.length,u=this.calculatePriceChanges(),l=u.length>0?Math.sqrt(u.reduce((R,O)=>R+O**2,0)/u.length)*Math.sqrt(252)*100:0,c=(t-r)/r*100,g=(t-i)/(e-i)*100,o=this.prices.reduce((R,O,M)=>R+O*this.volumes[M],0)/s,f=this.prices.length>5?(t-this.prices[Math.max(0,this.prices.length-6)])/this.prices[Math.max(0,this.prices.length-6)]*100:0,v=this.prices.length>10?(t-this.prices[Math.max(0,this.prices.length-11)])/this.prices[Math.max(0,this.prices.length-11)]*100:0,P=this.calculateMaxDrawdown(this.prices),w=this.calculateAtr(this.prices,this.highs,this.lows,this.volumes),m=w.length>0?w[w.length-1]:0,y=l,F=l,E=c/l,D=c/F,I=c/P,T=this.calculateMaxConsecutiveLosses(this.prices),C=this.calculateWinRate(this.prices),L=this.calculateProfitFactor(this.prices);return{currentPrice:t,startPrice:r,sessionHigh:e,sessionLow:i,totalVolume:s,avgVolume:n,volatility:l,sessionReturn:c,pricePosition:g,trueVWAP:o,momentum5:f,momentum10:v,maxDrawdown:P,atr:m,impliedVolatility:y,realizedVolatility:F,sharpeRatio:E,sortinoRatio:D,calmarRatio:I,maxConsecutiveLosses:T,winRate:C,profitFactor:L}}getTechnicalIndicators(){return{sma5:this.calculateSMA(this.prices,5),sma10:this.calculateSMA(this.prices,10),sma20:this.calculateSMA(this.prices,20),sma50:this.calculateSMA(this.prices,50),sma200:this.calculateSMA(this.prices,200),ema8:this.calculateEMA(this.prices,8),ema12:this.calculateEMA(this.prices,12),ema21:this.calculateEMA(this.prices,21),ema26:this.calculateEMA(this.prices,26),wma20:this.calculateWma(this.prices,20),vwma20:this.calculateVwma(this.prices,20),macd:this.calculateMacd(this.prices),adx:this.calculateAdx(this.prices,this.highs,this.lows),dmi:this.calculateDmi(this.prices,this.highs,this.lows),ichimoku:this.calculateIchimoku(this.prices,this.highs,this.lows),parabolicSAR:this.calculateParabolicSAR(this.prices,this.highs,this.lows),rsi:this.calculateRSI(this.prices,14),stochastic:this.calculateStochastic(this.prices,this.highs,this.lows),cci:this.calculateCci(this.prices,this.highs,this.lows),roc:this.calculateRoc(this.prices),williamsR:this.calculateWilliamsR(this.prices),momentum:this.calculateMomentum(this.prices),bollinger:this.calculateBollingerBands(this.prices,20,2),atr:this.calculateAtr(this.prices,this.highs,this.lows,this.volumes),keltner:this.calculateKeltnerChannels(this.prices,this.highs,this.lows),donchian:this.calculateDonchianChannels(this.prices,this.highs,this.lows),chaikinVolatility:this.calculateChaikinVolatility(this.prices,this.highs,this.lows),obv:this.calculateObv(this.volumes),cmf:this.calculateCmf(this.prices,this.highs,this.lows,this.volumes),adl:this.calculateAdl(this.prices),volumeROC:this.calculateVolumeROC(this.prices),mfi:this.calculateMfi(this.prices,this.highs,this.lows,this.volumes),vwap:this.calculateVwap(this.prices,this.volumes),pivotPoints:this.calculatePivotPoints(this.prices),fibonacci:this.calculateFibonacciLevels(this.prices),gannLevels:this.calculateGannLevels(this.prices),elliottWave:this.calculateElliottWave(this.prices),harmonicPatterns:this.calculateHarmonicPatterns(this.prices)}}generateSignals(){let t=this.analyze(),r=0,e=0,i=[];t.currentPrice>t.trueVWAP?(i.push(`\u2713 BULLISH: Price above VWAP (+${((t.currentPrice-t.trueVWAP)/t.trueVWAP*100).toFixed(2)}%)`),r++):(i.push(`\u2717 BEARISH: Price below VWAP (${((t.currentPrice-t.trueVWAP)/t.trueVWAP*100).toFixed(2)}%)`),e++),t.momentum5>0&&t.momentum10>0?(i.push("\u2713 BULLISH: Positive momentum on both timeframes"),r++):t.momentum5<0&&t.momentum10<0?(i.push("\u2717 BEARISH: Negative momentum on both timeframes"),e++):i.push("\u25D0 MIXED: Conflicting momentum signals");let n=this.volumes[this.volumes.length-1]/t.avgVolume;return n>1.2&&t.sessionReturn>0?(i.push("\u2713 BULLISH: Above-average volume supporting upward move"),r++):n>1.2&&t.sessionReturn<0?(i.push("\u2717 BEARISH: Above-average volume supporting downward move"),e++):i.push("\u25D0 NEUTRAL: Volume not providing clear direction"),t.pricePosition>65&&t.volatility>30?(i.push("\u2717 BEARISH: High in range with elevated volatility - reversal risk"),e++):t.pricePosition<35&&t.volatility>30?(i.push("\u2713 BULLISH: Low in range with volatility - potential bounce"),r++):i.push("\u25D0 NEUTRAL: Price position and volatility not extreme"),{bullishSignals:r,bearishSignals:e,signals:i}}generateJSONAnalysis(t){let r=this.analyze(),e=this.getTechnicalIndicators(),i=this.generateSignals(),s=e.sma5.length>0?e.sma5[e.sma5.length-1]:null,n=e.sma10.length>0?e.sma10[e.sma10.length-1]:null,u=e.sma20.length>0?e.sma20[e.sma20.length-1]:null,l=e.sma50.length>0?e.sma50[e.sma50.length-1]:null,c=e.sma200.length>0?e.sma200[e.sma200.length-1]:null,g=e.ema8[e.ema8.length-1],o=e.ema12[e.ema12.length-1],f=e.ema21[e.ema21.length-1],v=e.ema26[e.ema26.length-1],P=e.wma20.length>0?e.wma20[e.wma20.length-1]:null,w=e.vwma20.length>0?e.vwma20[e.vwma20.length-1]:null,m=e.macd.length>0?e.macd[e.macd.length-1]:null,y=e.adx.length>0?e.adx[e.adx.length-1]:null,F=e.dmi.length>0?e.dmi[e.dmi.length-1]:null,E=e.ichimoku.length>0?e.ichimoku[e.ichimoku.length-1]:null,D=e.parabolicSAR.length>0?e.parabolicSAR[e.parabolicSAR.length-1]:null,I=e.rsi.length>0?e.rsi[e.rsi.length-1]:null,T=e.stochastic.length>0?e.stochastic[e.stochastic.length-1]:null,C=e.cci.length>0?e.cci[e.cci.length-1]:null,L=e.roc.length>0?e.roc[e.roc.length-1]:null,R=e.williamsR.length>0?e.williamsR[e.williamsR.length-1]:null,O=e.momentum.length>0?e.momentum[e.momentum.length-1]:null,M=e.bollinger.length>0?e.bollinger[e.bollinger.length-1]:null,Q=e.atr.length>0?e.atr[e.atr.length-1]:null,k=e.keltner.length>0?e.keltner[e.keltner.length-1]:null,A=e.donchian.length>0?e.donchian[e.donchian.length-1]:null,Y=e.chaikinVolatility.length>0?e.chaikinVolatility[e.chaikinVolatility.length-1]:null,H=e.obv.length>0?e.obv[e.obv.length-1]:null,N=e.cmf.length>0?e.cmf[e.cmf.length-1]:null,Z=e.adl.length>0?e.adl[e.adl.length-1]:null,ee=e.volumeROC.length>0?e.volumeROC[e.volumeROC.length-1]:null,q=e.mfi.length>0?e.mfi[e.mfi.length-1]:null,te=e.vwap.length>0?e.vwap[e.vwap.length-1]:null,re=e.pivotPoints.length>0?e.pivotPoints[e.pivotPoints.length-1]:null,ie=e.fibonacci.length>0?e.fibonacci[e.fibonacci.length-1]:null,se=e.gannLevels.length>0?e.gannLevels:[],ne=e.elliottWave.length>0?e.elliottWave[e.elliottWave.length-1]:null,ae=e.harmonicPatterns.length>0?e.harmonicPatterns:[],W=this.volumes[this.volumes.length-1],oe=W/r.avgVolume,le=(r.sessionHigh-r.currentPrice)/r.sessionHigh*100,ce=(r.sessionHigh-r.sessionLow)/r.sessionLow*100,ue=(r.currentPrice-r.trueVWAP)/r.trueVWAP*100,V=i.bullishSignals-i.bearishSignals,he=V>0?"BULLISH_BIAS":V<0?"BEARISH_BIAS":"NEUTRAL",B=Math.max(r.sessionLow*1.005,r.trueVWAP*.998),x=r.sessionLow*.995,j=r.sessionHigh*.995,me=(j-r.currentPrice)/(r.currentPrice-x),G=this.calculatePositionSize(r.currentPrice,B,x),de=G*(B-x);return{symbol:t,timestamp:new Date().toISOString(),marketStructure:{currentPrice:r.currentPrice,startPrice:r.startPrice,sessionHigh:r.sessionHigh,sessionLow:r.sessionLow,rangeWidth:ce,totalVolume:r.totalVolume,sessionPerformance:r.sessionReturn,positionInRange:r.pricePosition},volatility:{impliedVolatility:r.impliedVolatility,realizedVolatility:r.realizedVolatility,atr:r.atr,maxDrawdown:r.maxDrawdown*100,currentDrawdown:le},technicalIndicators:{sma5:s,sma10:n,sma20:u,sma50:l,sma200:c,ema8:g,ema12:o,ema21:f,ema26:v,wma20:P,vwma20:w,macd:m,adx:y,dmi:F,ichimoku:E,parabolicSAR:D,rsi:I,stochastic:T,cci:C,roc:L,williamsR:R,momentum:O,bollingerBands:M?{upper:M.upper,middle:M.middle,lower:M.lower,bandwidth:M.bandwidth,percentB:M.percentB}:null,atr:Q,keltnerChannels:k?{upper:k.upper,middle:k.middle,lower:k.lower}:null,donchianChannels:A?{upper:A.upper,middle:A.middle,lower:A.lower}:null,chaikinVolatility:Y,obv:H,cmf:N,adl:Z,volumeROC:ee,mfi:q,vwap:te},volumeAnalysis:{currentVolume:W,averageVolume:Math.round(r.avgVolume),volumeRatio:oe,trueVWAP:r.trueVWAP,priceVsVWAP:ue,obv:H,cmf:N,mfi:q},momentum:{momentum5:r.momentum5,momentum10:r.momentum10,sessionROC:r.sessionReturn,rsi:I,stochastic:T,cci:C},supportResistance:{pivotPoints:re,fibonacci:ie,gannLevels:se,elliottWave:ne,harmonicPatterns:ae},tradingSignals:{...i,overallSignal:he,signalScore:V,confidence:this.calculateConfidence(i.signals),riskLevel:this.calculateRiskLevel(r.volatility)},statisticalModels:{zScore:this.calculateZScore(r.currentPrice,r.startPrice,r.avgVolume),ornsteinUhlenbeck:this.calculateOrnsteinUhlenbeck(r.currentPrice,r.startPrice,r.avgVolume),kalmanFilter:this.calculateKalmanFilter(r.currentPrice,r.startPrice,r.avgVolume),arima:this.calculateArima(r.currentPrice,r.startPrice,r.avgVolume),garch:this.calculateGarch(r.currentPrice,r.startPrice,r.avgVolume),hilbertTransform:this.calculateHilbertTransform(r.currentPrice,r.startPrice,r.avgVolume),waveletTransform:this.calculateWaveletTransform(r.currentPrice,r.startPrice,r.avgVolume)},optionsAnalysis:(()=>{let S=this.calculateBlackScholes(r.currentPrice,r.startPrice,r.avgVolume);return S?{blackScholes:S,impliedVolatility:r.impliedVolatility,delta:S.delta,gamma:S.gamma,theta:S.theta,vega:S.vega,rho:S.rho,greeks:{delta:S.delta,gamma:S.gamma,theta:S.theta,vega:S.vega,rho:S.rho}}:null})(),riskManagement:{targetEntry:B,stopLoss:x,profitTarget:j,riskRewardRatio:me,positionSize:G,maxRisk:de},performance:{sharpeRatio:r.sharpeRatio,sortinoRatio:r.sortinoRatio,calmarRatio:r.calmarRatio,maxDrawdown:r.maxDrawdown*100,winRate:r.winRate,profitFactor:r.profitFactor,totalReturn:r.sessionReturn,volatility:r.volatility}}}},Fe=t=>async r=>{try{let e=r.symbol,i=t.get(e)||[];if(i.length===0)return{content:[{type:"text",text:`No price data available for ${e}. Please request market data first.`,uri:"technicalAnalysis"}]};if(!i.every(l=>typeof l.trade=="number"&&!Number.isNaN(l.trade)&&typeof l.midPrice=="number"&&!Number.isNaN(l.midPrice)))throw new Error("Invalid market data");let u=new Me(i).generateJSONAnalysis(e);return{content:[{type:"text",text:`Technical Analysis for ${e}:
3
+
4
+ ${JSON.stringify(u,null,2)}`,uri:"technicalAnalysis"}]}}catch(e){return{content:[{type:"text",text:`Error performing technical analysis: ${e instanceof Error?e.message:"Unknown error"}`,uri:"technicalAnalysis"}],isError:!0}}},Re=(t,r)=>async e=>{try{t.logger.log({level:"info",message:`Sending market data request for symbols: ${e.symbols.join(", ")}`});let i=new Promise(c=>{r.set(e.mdReqID,c),t.logger.log({level:"info",message:`Registered callback for market data request ID: ${e.mdReqID}`})}),s=e.mdEntryTypes||[a.MDEntryType.Bid,a.MDEntryType.Offer,a.MDEntryType.Trade,a.MDEntryType.IndexValue,a.MDEntryType.OpeningPrice,a.MDEntryType.ClosingPrice,a.MDEntryType.SettlementPrice,a.MDEntryType.TradingSessionHighPrice,a.MDEntryType.TradingSessionLowPrice,a.MDEntryType.VWAP,a.MDEntryType.Imbalance,a.MDEntryType.TradeVolume,a.MDEntryType.OpenInterest,a.MDEntryType.CompositeUnderlyingPrice,a.MDEntryType.SimulatedSellPrice,a.MDEntryType.SimulatedBuyPrice,a.MDEntryType.MarginRate,a.MDEntryType.MidPrice,a.MDEntryType.EmptyBook,a.MDEntryType.SettleHighPrice,a.MDEntryType.SettleLowPrice,a.MDEntryType.PriorSettlePrice,a.MDEntryType.SessionHighBid,a.MDEntryType.SessionLowOffer,a.MDEntryType.EarlyPrices,a.MDEntryType.AuctionClearingPrice,a.MDEntryType.SwapValueFactor,a.MDEntryType.DailyValueAdjustmentForLongPositions,a.MDEntryType.CumulativeValueAdjustmentForLongPositions,a.MDEntryType.DailyValueAdjustmentForShortPositions,a.MDEntryType.CumulativeValueAdjustmentForShortPositions,a.MDEntryType.FixingPrice,a.MDEntryType.CashRate,a.MDEntryType.RecoveryRate,a.MDEntryType.RecoveryRateForLong,a.MDEntryType.RecoveryRateForShort,a.MDEntryType.MarketBid,a.MDEntryType.MarketOffer,a.MDEntryType.ShortSaleMinPrice,a.MDEntryType.PreviousClosingPrice,a.MDEntryType.ThresholdLimitPriceBanding,a.MDEntryType.DailyFinancingValue,a.MDEntryType.AccruedFinancingValue,a.MDEntryType.TWAP],n=[new a.Field(a.Fields.MsgType,a.Messages.MarketDataRequest),new a.Field(a.Fields.SenderCompID,t.sender),new a.Field(a.Fields.MsgSeqNum,t.getNextTargetMsgSeqNum()),new a.Field(a.Fields.TargetCompID,t.target),new a.Field(a.Fields.SendingTime,t.getTimestamp()),new a.Field(a.Fields.MDReqID,e.mdReqID),new a.Field(a.Fields.SubscriptionRequestType,e.subscriptionRequestType),new a.Field(a.Fields.MarketDepth,0),new a.Field(a.Fields.MDUpdateType,e.mdUpdateType)];n.push(new a.Field(a.Fields.NoRelatedSym,e.symbols.length)),e.symbols.forEach(c=>{n.push(new a.Field(a.Fields.Symbol,c))}),n.push(new a.Field(a.Fields.NoMDEntryTypes,s.length)),s.forEach(c=>{n.push(new a.Field(a.Fields.MDEntryType,c))});let u=t.createMessage(...n);if(!t.connected)return t.logger.log({level:"error",message:"Not connected. Cannot send market data request."}),{content:[{type:"text",text:"Error: Not connected. Ignoring message.",uri:"marketDataRequest"}],isError:!0};t.logger.log({level:"info",message:`Sending market data request message: ${JSON.stringify(u?.toFIXJSON())}`}),t.send(u);let l=await i;return t.logger.log({level:"info",message:`Received market data response for request ID: ${e.mdReqID}`}),{content:[{type:"text",text:`Market data for ${e.symbols.join(", ")}: ${JSON.stringify(l.toFIXJSON())}`,uri:"marketDataRequest"}]}}catch(i){return{content:[{type:"text",text:`Error: ${i instanceof Error?i.message:"Failed to request market data"}`,uri:"marketDataRequest"}],isError:!0}}},Oe=t=>async r=>{try{let e=r.symbol,i=t.get(e)||[];if(i.length===0)return{content:[{type:"text",text:`No price data available for ${e}`,uri:"getStockGraph"}]};let s=new _.default;s.setWidth(1200),s.setHeight(600),s.setBackgroundColor("transparent");let n=i.map(y=>new Date(y.timestamp).toLocaleTimeString()),u=i.map(y=>y.bid),l=i.map(y=>y.offer),c=i.map(y=>y.spread),g=i.map(y=>y.volume),o=i.map(y=>y.trade),f=i.map(y=>y.vwap),v=i.map(y=>y.twap),P={type:"line",data:{labels:n,datasets:[{label:"Bid",data:u,borderColor:"#28a745",backgroundColor:"rgba(40, 167, 69, 0.1)",fill:!1,tension:.4},{label:"Offer",data:l,borderColor:"#dc3545",backgroundColor:"rgba(220, 53, 69, 0.1)",fill:!1,tension:.4},{label:"Spread",data:c,borderColor:"#6c757d",backgroundColor:"rgba(108, 117, 125, 0.1)",fill:!1,tension:.4},{label:"Trade",data:o,borderColor:"#ffc107",backgroundColor:"rgba(255, 193, 7, 0.1)",fill:!1,tension:.4},{label:"VWAP",data:f,borderColor:"#17a2b8",backgroundColor:"rgba(23, 162, 184, 0.1)",fill:!1,tension:.4},{label:"TWAP",data:v,borderColor:"#6610f2",backgroundColor:"rgba(102, 16, 242, 0.1)",fill:!1,tension:.4},{label:"Volume",data:g,borderColor:"#007bff",backgroundColor:"rgba(0, 123, 255, 0.1)",fill:!0,tension:.4}]},options:{responsive:!0,plugins:{title:{display:!0,text:`${e} Market Data`}},scales:{y:{beginAtZero:!1}}}};return s.setConfig(P),{content:[{type:"resource",resource:{uri:"resource://graph",mimeType:"image/png",blob:(await s.toBinary()).toString("base64")}}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to generate graph"}`,uri:"getStockGraph"}],isError:!0}}},Ie=t=>async r=>{try{let e=r.symbol,i=t.get(e)||[];return i.length===0?{content:[{type:"text",text:`No price data available for ${e}`,uri:"getStockPriceHistory"}]}:{content:[{type:"text",text:JSON.stringify({symbol:e,count:i.length,data:i.map(s=>({timestamp:new Date(s.timestamp).toISOString(),bid:s.bid,offer:s.offer,spread:s.spread,volume:s.volume,trade:s.trade,indexValue:s.indexValue,openingPrice:s.openingPrice,closingPrice:s.closingPrice,settlementPrice:s.settlementPrice,tradingSessionHighPrice:s.tradingSessionHighPrice,tradingSessionLowPrice:s.tradingSessionLowPrice,vwap:s.vwap,imbalance:s.imbalance,openInterest:s.openInterest,compositeUnderlyingPrice:s.compositeUnderlyingPrice,simulatedSellPrice:s.simulatedSellPrice,simulatedBuyPrice:s.simulatedBuyPrice,marginRate:s.marginRate,midPrice:s.midPrice,emptyBook:s.emptyBook,settleHighPrice:s.settleHighPrice,settleLowPrice:s.settleLowPrice,priorSettlePrice:s.priorSettlePrice,sessionHighBid:s.sessionHighBid,sessionLowOffer:s.sessionLowOffer,earlyPrices:s.earlyPrices,auctionClearingPrice:s.auctionClearingPrice,swapValueFactor:s.swapValueFactor,dailyValueAdjustmentForLongPositions:s.dailyValueAdjustmentForLongPositions,cumulativeValueAdjustmentForLongPositions:s.cumulativeValueAdjustmentForLongPositions,dailyValueAdjustmentForShortPositions:s.dailyValueAdjustmentForShortPositions,cumulativeValueAdjustmentForShortPositions:s.cumulativeValueAdjustmentForShortPositions,fixingPrice:s.fixingPrice,cashRate:s.cashRate,recoveryRate:s.recoveryRate,recoveryRateForLong:s.recoveryRateForLong,recoveryRateForShort:s.recoveryRateForShort,marketBid:s.marketBid,marketOffer:s.marketOffer,shortSaleMinPrice:s.shortSaleMinPrice,previousClosingPrice:s.previousClosingPrice,thresholdLimitPriceBanding:s.thresholdLimitPriceBanding,dailyFinancingValue:s.dailyFinancingValue,accruedFinancingValue:s.accruedFinancingValue,twap:s.twap}))},null,2),uri:"getStockPriceHistory"}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to get price history"}`,uri:"getStockPriceHistory"}],isError:!0}}},Te={1:"Market",2:"Limit",3:"Stop",4:"StopLimit",5:"MarketOnClose",6:"WithOrWithout",7:"LimitOrBetter",8:"LimitWithOrWithout",9:"OnBasis",A:"OnClose",B:"LimitOnClose",C:"ForexMarket",D:"PreviouslyQuoted",E:"PreviouslyIndicated",F:"ForexLimit",G:"ForexSwap",H:"ForexPreviouslyQuoted",I:"Funari",J:"MarketIfTouched",K:"MarketWithLeftOverAsLimit",L:"PreviousFundValuationPoint",M:"NextFundValuationPoint",P:"Pegged",Q:"CounterOrderSelection",R:"StopOnBidOrOffer",S:"StopLimitOnBidOrOffer"},Ce={1:"Buy",2:"Sell",3:"BuyMinus",4:"SellPlus",5:"SellShort",6:"SellShortExempt",7:"Undisclosed",8:"Cross",9:"CrossShort",A:"CrossShortExempt",B:"AsDefined",C:"Opposite",D:"Subscribe",E:"Redeem",F:"Lend",G:"Borrow",H:"SellUndisclosed"},ke={0:"Day",1:"GoodTillCancel",2:"AtTheOpening",3:"ImmediateOrCancel",4:"FillOrKill",5:"GoodTillCrossing",6:"GoodTillDate",7:"AtTheClose",8:"GoodThroughCrossing",9:"AtCrossing",A:"GoodForTime",B:"GoodForAuction",C:"GoodForMonth"},Ae={1:"AutomatedExecutionNoIntervention",2:"AutomatedExecutionInterventionOK",3:"ManualOrder"},xe=(t,r)=>async e=>{try{return r.set(e.clOrdID,{clOrdID:e.clOrdID,handlInst:e.handlInst,quantity:Number.parseFloat(String(e.quantity)),price:Number.parseFloat(String(e.price)),ordType:e.ordType,side:e.side,symbol:e.symbol,timeInForce:e.timeInForce}),{content:[{type:"text",text:`VERIFICATION: All parameters valid. Ready to proceed with order execution.
5
+
5
6
  Parameters verified:
6
7
  - ClOrdID: ${e.clOrdID}
7
- - HandlInst: ${e.handlInst} (${l[e.handlInst]})
8
+ - HandlInst: ${e.handlInst} (${Ae[e.handlInst]})
8
9
  - Quantity: ${e.quantity}
9
10
  - Price: ${e.price}
10
- - OrdType: ${e.ordType} (${s[e.ordType]})
11
- - Side: ${e.side} (${r[e.side]})
11
+ - OrdType: ${e.ordType} (${Te[e.ordType]})
12
+ - Side: ${e.side} (${Ce[e.side]})
12
13
  - Symbol: ${e.symbol}
13
- - TimeInForce: ${e.timeInForce} (${c[e.timeInForce]})
14
+ - TimeInForce: ${e.timeInForce} (${ke[e.timeInForce]})
14
15
 
15
- To execute this order, call the executeOrder tool with these exact same parameters.`}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to verify order parameters"}`}],isError:!0}}}),this.server.setRequestHandler(d.z.object({method:d.z.literal("executeOrder")}),async(n,i)=>{try{let e=n.params,s=this.verifiedOrders.get(e.clOrdID);if(!s)return{content:[{type:"text",text:`Error: Order ${e.clOrdID} has not been verified. Please call verifyOrder first.`}],isError:!0};if(s.handlInst!==e.handlInst||s.quantity!==Number.parseFloat(e.quantity)||s.price!==Number.parseFloat(e.price)||s.ordType!==e.ordType||s.side!==e.side||s.symbol!==e.symbol||s.timeInForce!==e.timeInForce)return{content:[{type:"text",text:"Error: Order parameters do not match the verified order. Please use the exact same parameters that were verified."}],isError:!0};let r=new Promise(o=>{this.pendingRequests.set(e.clOrdID,o)}),c=this.parser?.createMessage(new t.Field(t.Fields.MsgType,t.Messages.NewOrderSingle),new t.Field(t.Fields.MsgSeqNum,this.parser?.getNextTargetMsgSeqNum()),new t.Field(t.Fields.SenderCompID,this.parser?.sender),new t.Field(t.Fields.TargetCompID,this.parser?.target),new t.Field(t.Fields.SendingTime,this.parser?.getTimestamp()),new t.Field(t.Fields.ClOrdID,e.clOrdID),new t.Field(t.Fields.Side,e.side),new t.Field(t.Fields.Symbol,e.symbol),new t.Field(t.Fields.OrderQty,Number.parseFloat(e.quantity)),new t.Field(t.Fields.Price,Number.parseFloat(e.price)),new t.Field(t.Fields.OrdType,e.ordType),new t.Field(t.Fields.HandlInst,e.handlInst),new t.Field(t.Fields.TimeInForce,e.timeInForce),new t.Field(t.Fields.TransactTime,this.parser?.getTimestamp()));if(!this.parser?.connected)return{content:[{type:"text",text:"Error: Not connected. Ignoring message."}],isError:!0};this.parser?.send(c);let l=await r;return this.verifiedOrders.delete(e.clOrdID),{content:[{type:"text",text:l.messageType===t.Messages.Reject?`Reject message for order ${e.clOrdID}: ${JSON.stringify(l.toFIXJSON())}`:`Execution Report for order ${e.clOrdID}: ${JSON.stringify(l.toFIXJSON())}`}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to execute order"}`}],isError:!0}}}),this.server.setRequestHandler(d.z.object({method:d.z.literal("marketDataRequest")}),async(n,i)=>{try{let e=n.params,s=new Promise(o=>{this.pendingRequests.set(e.mdReqID,o)}),r=[new t.Field(t.Fields.MsgType,t.Messages.MarketDataRequest),new t.Field(t.Fields.SenderCompID,this.parser?.sender),new t.Field(t.Fields.MsgSeqNum,this.parser?.getNextTargetMsgSeqNum()),new t.Field(t.Fields.TargetCompID,this.parser?.target),new t.Field(t.Fields.SendingTime,this.parser?.getTimestamp()),new t.Field(t.Fields.MDReqID,e.mdReqID),new t.Field(t.Fields.SubscriptionRequestType,e.subscriptionRequestType),new t.Field(t.Fields.MarketDepth,0),new t.Field(t.Fields.MDUpdateType,e.mdUpdateType)];r.push(new t.Field(t.Fields.NoRelatedSym,e.symbols.length)),e.symbols.forEach(o=>{r.push(new t.Field(t.Fields.Symbol,o))}),r.push(new t.Field(t.Fields.NoMDEntryTypes,e.mdEntryTypes.length)),e.mdEntryTypes.forEach(o=>{r.push(new t.Field(t.Fields.MDEntryType,o))});let c=this.parser?.createMessage(...r);if(!this.parser?.connected)return{content:[{type:"text",text:"Error: Not connected. Ignoring message."}],isError:!0};this.parser?.send(c);let l=await s;return{content:[{type:"text",text:`Market data for ${e.symbols.join(", ")}: ${JSON.stringify(l.toFIXJSON())}`}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to request market data"}`}],isError:!0}}}),this.server.setRequestHandler(d.z.object({method:d.z.literal("greeting-resource")}),async(n,i)=>(this.parser?.logger.log({level:"info",message:"MCP Server Resource called: greeting-resource"}),{content:[{type:"text",text:"Hello, world!"}]})),this.server.setRequestHandler(d.z.object({method:d.z.literal("stockGraph")}),async(n,i)=>{this.parser?.logger.log({level:"info",message:"MCP Server Resource called: stockGraph"});let s=n.params.symbol,r=this.marketDataPrices.get(s)||[];if(r.length===0)return{content:[{type:"text",text:`No price data available for ${s}`}]};let c=600,l=300,o=40,u=(c-2*o)/(r.length-1),p=Math.min(...r.map(g=>g.price)),f=Math.max(...r.map(g=>g.price)),x=(l-2*o)/(f-p),R=r.map((g,m)=>{let h=o+m*u,y=l-o-(g.price-p)*x;return`${h},${y}`}).join(" L ");return{content:[{type:"text",text:`<?xml version="1.0" encoding="UTF-8"?>
16
- <svg width="${c}" height="${l}" xmlns="http://www.w3.org/2000/svg">
17
- <!-- Background -->
18
- <rect width="100%" height="100%" fill="#f8f9fa"/>
19
-
20
- <!-- Grid lines -->
21
- <g stroke="#e9ecef" stroke-width="1">
22
- ${Array.from({length:5},(g,m)=>{let h=o+(l-2*o)*m/4;return`<line x1="${o}" y1="${h}" x2="${c-o}" y2="${h}"/>`}).join(`
23
- `)}
24
- </g>
25
-
26
- <!-- Price line -->
27
- <path d="M ${R}"
28
- fill="none"
29
- stroke="#007bff"
30
- stroke-width="2"/>
31
-
32
- <!-- Data points -->
33
- ${r.map((g,m)=>{let h=o+m*u,y=l-o-(g.price-p)*x;return`<circle cx="${h}" cy="${y}" r="3" fill="#007bff"/>`}).join(`
34
- `)}
35
-
36
- <!-- Labels -->
37
- <g font-family="Arial" font-size="12" fill="#495057">
38
- ${Array.from({length:5},(g,m)=>{let h=o+(c-2*o)*m/4,y=Math.floor((r.length-1)*m/4),T=new Date(r[y].timestamp).toLocaleTimeString();return`<text x="${h+o}" y="${l-o+20}" text-anchor="middle">${T}</text>`}).join(`
39
- `)}
40
- ${Array.from({length:5},(g,m)=>{let h=o+(l-2*o)*m/4,y=f-(f-p)*m/4;return`<text x="${o-5}" y="${h+4}" text-anchor="end">$${y.toFixed(2)}</text>`}).join(`
41
- `)}
42
- </g>
43
-
44
- <!-- Title -->
45
- <text x="${c/2}" y="${o/2}"
46
- font-family="Arial" font-size="16" font-weight="bold"
47
- text-anchor="middle" fill="#212529">
48
- ${s} - Price Chart (${r.length} points)
49
- </text>
50
- </svg>`}]}}),this.server.setRequestHandler(d.z.object({method:d.z.literal("stockPriceHistory")}),async(n,i)=>{this.parser?.logger.log({level:"info",message:"MCP Server Resource called: stockPriceHistory"});let s=n.params.symbol,r=this.marketDataPrices.get(s)||[];return{content:[{type:"text",text:JSON.stringify({symbol:s,count:r.length,prices:r.map(c=>({timestamp:new Date(c.timestamp).toISOString(),price:c.price}))},null,2)}]}}),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)}))}};var F=async()=>{await a.LicenseManager.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);let n=process.env.FIXPARSER_SENDER||"SENDER",i=process.env.FIXPARSER_TARGET||"TARGET",e=new a.FIXParser({logging:!0,logOptions:{level:"info",format:"jsonrpc",transport:new S({format:"jsonrpc"})},plugins:[new O({port:3099,onReady:()=>{}})]}),s=()=>{let c=e.createMessage(new a.Field(a.Fields.MsgType,a.Messages.Logon),new a.Field(a.Fields.MsgSeqNum,e.getNextTargetMsgSeqNum()),new a.Field(a.Fields.SenderCompID,n),new a.Field(a.Fields.SendingTime,e.getTimestamp()),new a.Field(a.Fields.TargetCompID,i),new a.Field(a.Fields.ResetSeqNumFlag,a.ResetSeqNumFlag.Yes),new a.Field(a.Fields.EncryptMethod,a.EncryptMethod.None),new a.Field(a.Fields.HeartBtInt,10));e.send(c)},r={host:process.env.FIXPARSER_HOST||"10.0.1.42",port:process.env.FIXPARSER_PORT?Number.parseInt(process.env.FIXPARSER_PORT,10):5001,protocol:"tcp",sender:n,target:i,fixVersion:"FIX.4.4",onOpen:()=>{e.logger.log({level:"info",message:"FIXParser logging in..."}),s()},onClose:()=>{e.logger.log({level:"info",message:"FIXParser disconnected. Reconnecting in 1 second..."}),setTimeout(()=>{e.connect(r)},1e3)}};e.connect(r)};F().catch(n=>console.error("Error initializing server:",n));
16
+ To execute this order, call the executeOrder tool with these exact same parameters. Important: The user has to explicitly confirm before executeOrder is called!`,uri:"verifyOrder"}]}}catch(i){return{content:[{type:"text",text:`Error: ${i instanceof Error?i.message:"Failed to verify order parameters"}`,uri:"verifyOrder"}],isError:!0}}},Ee=(t,r,e)=>async i=>{try{let s=r.get(i.clOrdID);if(!s)return{content:[{type:"text",text:`Error: Order ${i.clOrdID} has not been verified. Please call verifyOrder first.`,uri:"executeOrder"}],isError:!0};if(s.handlInst!==i.handlInst||s.quantity!==Number.parseFloat(String(i.quantity))||s.price!==Number.parseFloat(String(i.price))||s.ordType!==i.ordType||s.side!==i.side||s.symbol!==i.symbol||s.timeInForce!==i.timeInForce)return{content:[{type:"text",text:"Error: Order parameters do not match the verified order. Please use the exact same parameters that were verified.",uri:"executeOrder"}],isError:!0};let n=new Promise(c=>{e.set(i.clOrdID,c)}),u=t.createMessage(new d.Field(d.Fields.MsgType,d.Messages.NewOrderSingle),new d.Field(d.Fields.MsgSeqNum,t.getNextTargetMsgSeqNum()),new d.Field(d.Fields.SenderCompID,t.sender),new d.Field(d.Fields.TargetCompID,t.target),new d.Field(d.Fields.SendingTime,t.getTimestamp()),new d.Field(d.Fields.ClOrdID,i.clOrdID),new d.Field(d.Fields.Side,i.side),new d.Field(d.Fields.Symbol,i.symbol),new d.Field(d.Fields.OrderQty,Number.parseFloat(String(i.quantity))),new d.Field(d.Fields.Price,Number.parseFloat(String(i.price))),new d.Field(d.Fields.OrdType,i.ordType),new d.Field(d.Fields.HandlInst,i.handlInst),new d.Field(d.Fields.TimeInForce,i.timeInForce),new d.Field(d.Fields.TransactTime,t.getTimestamp()));if(!t.connected)return{content:[{type:"text",text:"Error: Not connected. Ignoring message.",uri:"executeOrder"}],isError:!0};t.send(u);let l=await n;return r.delete(i.clOrdID),{content:[{type:"text",text:l.messageType===d.Messages.Reject?`Reject message for order ${i.clOrdID}: ${JSON.stringify(l.toFIXJSON())}`:`Execution Report for order ${i.clOrdID}: ${JSON.stringify(l.toFIXJSON())}`,uri:"executeOrder"}]}}catch(s){return{content:[{type:"text",text:`Error: ${s instanceof Error?s.message:"Failed to execute order"}`,uri:"executeOrder"}],isError:!0}}},De=t=>async r=>{try{let e=t.parse(r.fixString);return!e||e.length===0?{content:[{type:"text",text:"Error: Failed to parse FIX string",uri:"parse"}],isError:!0}:{content:[{type:"text",text:`${e[0].description}
17
+ ${e[0].messageTypeDescription}`,uri:"parse"}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to parse FIX string"}`,uri:"parse"}],isError:!0}}},Le=t=>async r=>{try{let e=t.parse(r.fixString);return!e||e.length===0?{content:[{type:"text",text:"Error: Failed to parse FIX string",uri:"parseToJSON"}],isError:!0}:{content:[{type:"text",text:`${e[0].toFIXJSON()}`,uri:"parseToJSON"}]}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:"Failed to parse FIX string"}`,uri:"parseToJSON"}],isError:!0}}},Ve=(t,r,e,i)=>({parse:De(t),parseToJSON:Le(t),verifyOrder:xe(t,r),executeOrder:Ee(t,r,e),marketDataRequest:Re(t,e),getStockGraph:Oe(i),getStockPriceHistory:Ie(i),technicalAnalysis:Fe(i)});function Be(t,r){return t[r]||r}function He(t,r,e,i,s,n){let u=t.messageType;if(u===h.Messages.MarketDataSnapshotFullRefresh||u===h.Messages.MarketDataIncrementalRefresh){let l=t.getField(h.Fields.Symbol)?.value,g=t.toFIXJSON().Body?.NoMDEntries||[],o={timestamp:Date.now(),bid:0,offer:0,spread:0,volume:0,trade:0,indexValue:0,openingPrice:0,closingPrice:0,settlementPrice:0,tradingSessionHighPrice:0,tradingSessionLowPrice:0,vwap:0,imbalance:0,openInterest:0,compositeUnderlyingPrice:0,simulatedSellPrice:0,simulatedBuyPrice:0,marginRate:0,midPrice:0,emptyBook:0,settleHighPrice:0,settleLowPrice:0,priorSettlePrice:0,sessionHighBid:0,sessionLowOffer:0,earlyPrices:0,auctionClearingPrice:0,swapValueFactor:0,dailyValueAdjustmentForLongPositions:0,cumulativeValueAdjustmentForLongPositions:0,dailyValueAdjustmentForShortPositions:0,cumulativeValueAdjustmentForShortPositions:0,fixingPrice:0,cashRate:0,recoveryRate:0,recoveryRateForLong:0,recoveryRateForShort:0,marketBid:0,marketOffer:0,shortSaleMinPrice:0,previousClosingPrice:0,thresholdLimitPriceBanding:0,dailyFinancingValue:0,accruedFinancingValue:0,twap:0};for(let P of g){let w=P.MDEntryType,m=P.MDEntryPx?Number.parseFloat(P.MDEntryPx):0,y=P.MDEntrySize?Number.parseFloat(P.MDEntrySize):0;switch(Be(h.MDEntryType,w)){case h.MDEntryType.Bid:o.bid=m;break;case h.MDEntryType.Offer:o.offer=m;break;case h.MDEntryType.Trade:o.trade=m;break;case h.MDEntryType.IndexValue:o.indexValue=m;break;case h.MDEntryType.OpeningPrice:o.openingPrice=m;break;case h.MDEntryType.ClosingPrice:o.closingPrice=m;break;case h.MDEntryType.SettlementPrice:o.settlementPrice=m;break;case h.MDEntryType.TradingSessionHighPrice:o.tradingSessionHighPrice=m;break;case h.MDEntryType.TradingSessionLowPrice:o.tradingSessionLowPrice=m;break;case h.MDEntryType.VWAP:o.vwap=m;break;case h.MDEntryType.Imbalance:o.imbalance=y;break;case h.MDEntryType.TradeVolume:o.volume=y;break;case h.MDEntryType.OpenInterest:o.openInterest=y;break;case h.MDEntryType.CompositeUnderlyingPrice:o.compositeUnderlyingPrice=m;break;case h.MDEntryType.SimulatedSellPrice:o.simulatedSellPrice=m;break;case h.MDEntryType.SimulatedBuyPrice:o.simulatedBuyPrice=m;break;case h.MDEntryType.MarginRate:o.marginRate=m;break;case h.MDEntryType.MidPrice:o.midPrice=m;break;case h.MDEntryType.EmptyBook:o.emptyBook=1;break;case h.MDEntryType.SettleHighPrice:o.settleHighPrice=m;break;case h.MDEntryType.SettleLowPrice:o.settleLowPrice=m;break;case h.MDEntryType.PriorSettlePrice:o.priorSettlePrice=m;break;case h.MDEntryType.SessionHighBid:o.sessionHighBid=m;break;case h.MDEntryType.SessionLowOffer:o.sessionLowOffer=m;break;case h.MDEntryType.EarlyPrices:o.earlyPrices=m;break;case h.MDEntryType.AuctionClearingPrice:o.auctionClearingPrice=m;break;case h.MDEntryType.SwapValueFactor:o.swapValueFactor=m;break;case h.MDEntryType.DailyValueAdjustmentForLongPositions:o.dailyValueAdjustmentForLongPositions=m;break;case h.MDEntryType.CumulativeValueAdjustmentForLongPositions:o.cumulativeValueAdjustmentForLongPositions=m;break;case h.MDEntryType.DailyValueAdjustmentForShortPositions:o.dailyValueAdjustmentForShortPositions=m;break;case h.MDEntryType.CumulativeValueAdjustmentForShortPositions:o.cumulativeValueAdjustmentForShortPositions=m;break;case h.MDEntryType.FixingPrice:o.fixingPrice=m;break;case h.MDEntryType.CashRate:o.cashRate=m;break;case h.MDEntryType.RecoveryRate:o.recoveryRate=m;break;case h.MDEntryType.RecoveryRateForLong:o.recoveryRateForLong=m;break;case h.MDEntryType.RecoveryRateForShort:o.recoveryRateForShort=m;break;case h.MDEntryType.MarketBid:o.marketBid=m;break;case h.MDEntryType.MarketOffer:o.marketOffer=m;break;case h.MDEntryType.ShortSaleMinPrice:o.shortSaleMinPrice=m;break;case h.MDEntryType.PreviousClosingPrice:o.previousClosingPrice=m;break;case h.MDEntryType.ThresholdLimitPriceBanding:o.thresholdLimitPriceBanding=m;break;case h.MDEntryType.DailyFinancingValue:o.dailyFinancingValue=m;break;case h.MDEntryType.AccruedFinancingValue:o.accruedFinancingValue=m;break;case h.MDEntryType.TWAP:o.twap=m;break}}o.spread=o.offer-o.bid,i.has(l)||i.set(l,[]);let f=i.get(l);f.push(o),f.length>s&&f.splice(0,f.length-s),n?.(l,o);let v=t.getField(h.Fields.MDReqID)?.value;if(v){let P=e.get(v);P&&(P(t),e.delete(v))}}else if(u===h.Messages.ExecutionReport){let l=t.getField(h.Fields.ClOrdID)?.value,c=e.get(l);c&&(c(t),e.delete(l))}}var K=class extends be{verifiedOrders=new Map;pendingRequests=new Map;marketDataPrices=new Map;MAX_PRICE_HISTORY=1e5;server=new J.Server({name:"fixparser",version:"1.0.0"},{capabilities:{tools:Object.entries(U).reduce((t,[r,{description:e,schema:i}])=>(t[r]={description:e,parameters:i},t),{})}});transport=new z.StdioServerTransport;constructor({logger:t,onReady:r}){super({logger:t,onReady:r})}async register(t){this.parser=t,this.parser.addOnMessageCallback(r=>{He(r,this.parser,this.pendingRequests,this.marketDataPrices,this.MAX_PRICE_HISTORY)}),this.addWorkflows(),await this.server.connect(this.transport),this.onReady&&this.onReady()}addWorkflows(){this.parser&&this.server&&(this.server.setRequestHandler(b.z.object({method:b.z.literal("tools/list")}),async()=>({tools:Object.entries(U).map(([t,{description:r,schema:e}])=>({name:t,description:r,inputSchema:e}))})),this.server.setRequestHandler(b.z.object({method:b.z.literal("tools/call"),params:b.z.object({name:b.z.string(),arguments:b.z.any(),_meta:b.z.object({progressToken:b.z.number()}).optional()})}),async t=>{let{name:r,arguments:e}=t.params,s=Ve(this.parser,this.verifiedOrders,this.pendingRequests,this.marketDataPrices)[r];if(!s)return{content:[{type:"text",text:`Tool not found: ${r}`,uri:r}],isError:!0};let n=await s(e);return{content:n.content,isError:n.isError}}),process.on("SIGINT",async()=>{await this.server.close(),process.exit(0)}))}};var Ge=async()=>{await p.LicenseManager.setLicenseKey(process.env.FIXPARSER_LICENSE_KEY);let t=process.env.FIXPARSER_SENDER||"SENDER",r=process.env.FIXPARSER_TARGET||"TARGET",e=new p.FIXParser({logging:!0,logOptions:{level:"info",format:"jsonrpc",transport:new X({format:"jsonrpc"})},plugins:[new K({port:3099,onReady:()=>{}})]}),i=()=>{let n=e.createMessage(new p.Field(p.Fields.MsgType,p.Messages.Logon),new p.Field(p.Fields.MsgSeqNum,e.getNextTargetMsgSeqNum()),new p.Field(p.Fields.SenderCompID,t),new p.Field(p.Fields.SendingTime,e.getTimestamp()),new p.Field(p.Fields.TargetCompID,r),new p.Field(p.Fields.ResetSeqNumFlag,p.ResetSeqNumFlag.Yes),new p.Field(p.Fields.EncryptMethod,p.EncryptMethod.None),new p.Field(p.Fields.HeartBtInt,10));e.send(n)},s={host:process.env.FIXPARSER_HOST||"10.0.1.42",port:process.env.FIXPARSER_PORT?Number.parseInt(process.env.FIXPARSER_PORT,10):5001,protocol:"tcp",sender:t,target:r,fixVersion:"FIX.4.4",onOpen:()=>{e.logger.log({level:"info",message:"FIXParser logging in..."}),i()},onClose:()=>{e.logger.log({level:"info",message:"FIXParser disconnected. Reconnecting in 1 second..."}),setTimeout(()=>{e.connect(s)},1e3)}};e.connect(s)};Ge().catch(t=>console.error("Error initializing server:",t));
51
18
  //# sourceMappingURL=example_mcp_local.js.map