{"_id":"@a3mercados/trading","name":"@a3mercados/trading","dist-tags":{"latest":"1.21.0"},"versions":{"1.21.0":{"name":"@a3mercados/trading","version":"1.21.0","private":false,"repository":{"type":"git","url":"git+https://github.com/fern-starter/a3-trading-typescript-sdk.git"},"type":"commonjs","main":"./dist/cjs/index.js","module":"./dist/esm/index.mjs","types":"./dist/cjs/index.d.ts","exports":{".":{"import":{"types":"./dist/esm/index.d.mts","default":"./dist/esm/index.mjs"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"},"default":"./dist/cjs/index.js"},"./auth":{"import":{"types":"./dist/esm/api/resources/auth/exports.d.mts","default":"./dist/esm/api/resources/auth/exports.mjs"},"require":{"types":"./dist/cjs/api/resources/auth/exports.d.ts","default":"./dist/cjs/api/resources/auth/exports.js"},"default":"./dist/cjs/api/resources/auth/exports.js"},"./segmentos":{"import":{"types":"./dist/esm/api/resources/segmentos/exports.d.mts","default":"./dist/esm/api/resources/segmentos/exports.mjs"},"require":{"types":"./dist/cjs/api/resources/segmentos/exports.d.ts","default":"./dist/cjs/api/resources/segmentos/exports.js"},"default":"./dist/cjs/api/resources/segmentos/exports.js"},"./instrumentos":{"import":{"types":"./dist/esm/api/resources/instrumentos/exports.d.mts","default":"./dist/esm/api/resources/instrumentos/exports.mjs"},"require":{"types":"./dist/cjs/api/resources/instrumentos/exports.d.ts","default":"./dist/cjs/api/resources/instrumentos/exports.js"},"default":"./dist/cjs/api/resources/instrumentos/exports.js"},"./ordenes":{"import":{"types":"./dist/esm/api/resources/ordenes/exports.d.mts","default":"./dist/esm/api/resources/ordenes/exports.mjs"},"require":{"types":"./dist/cjs/api/resources/ordenes/exports.d.ts","default":"./dist/cjs/api/resources/ordenes/exports.js"},"default":"./dist/cjs/api/resources/ordenes/exports.js"},"./marketData":{"import":{"types":"./dist/esm/api/resources/marketData/exports.d.mts","default":"./dist/esm/api/resources/marketData/exports.mjs"},"require":{"types":"./dist/cjs/api/resources/marketData/exports.d.ts","default":"./dist/cjs/api/resources/marketData/exports.js"},"default":"./dist/cjs/api/resources/marketData/exports.js"},"./risk":{"import":{"types":"./dist/esm/api/resources/risk/exports.d.mts","default":"./dist/esm/api/resources/risk/exports.mjs"},"require":{"types":"./dist/cjs/api/resources/risk/exports.d.ts","default":"./dist/cjs/api/resources/risk/exports.js"},"default":"./dist/cjs/api/resources/risk/exports.js"},"./websocket":{"import":{"types":"./dist/esm/api/resources/websocket/exports.d.mts","default":"./dist/esm/api/resources/websocket/exports.mjs"},"require":{"types":"./dist/cjs/api/resources/websocket/exports.d.ts","default":"./dist/cjs/api/resources/websocket/exports.js"},"default":"./dist/cjs/api/resources/websocket/exports.js"},"./package.json":"./package.json"},"scripts":{"format":"biome format --write --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","format:check":"biome format --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","lint":"biome lint --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","lint:fix":"biome lint --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","check":"biome check --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","check:fix":"biome check --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none","build":"pnpm build:cjs && pnpm build:esm","build:cjs":"tsc --project ./tsconfig.cjs.json","build:esm":"tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm","test":"vitest","test:unit":"vitest --project unit","test:wire":"vitest --project wire"},"dependencies":{"ws":"^8.20.0"},"devDependencies":{"webpack":"^5.105.4","ts-loader":"^9.5.4","@types/ws":"^8.18.1","vitest":"^4.1.1","msw":"2.11.2","@types/node":"^20.0.0","typescript":"~5.9.3","@biomejs/biome":"2.4.10"},"browser":{"fs":false,"os":false,"path":false,"stream":false,"crypto":false},"packageManager":"pnpm@10.33.0","engines":{"node":">=18"},"sideEffects":false,"description":"SDK TypeScript para la API Trading de A3 Mercados (REST + WebSocket).","license":"UNLICENSED","author":{"name":"A3 Mercados","email":"mpi@primary.com.ar"},"keywords":["a3-mercados","trading","market-data","fix"],"_id":"@a3mercados/trading@1.21.0","gitHead":"4fc52107719c223f2edb25e3cccc9cd919c143d0","bugs":{"url":"https://github.com/fern-starter/a3-trading-typescript-sdk/issues"},"homepage":"https://github.com/fern-starter/a3-trading-typescript-sdk#readme","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-9uC8wMuY6u9JHppb+SeHhXwT2NxYSxSRrhS0OYZ6GSGldGUSTo1U6GlZkcNVrzIHmbj3nA+Eotgla+1AJ3Z0Qw==","shasum":"4949f6bb8efc44e3cfcb436e86d56efff6e410ce","tarball":"https://registry.npmjs.org/@a3mercados/trading/-/trading-1.21.0.tgz","fileCount":635,"unpackedSize":656376,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDz/akp9NT9+ggQ5dx6tfnrp9EILHaZAkgoKXWXhqtp9AiEA2lI0vJ6Y73iDsngrB36RbeB7RiWDgsg09Pq7cIVucYs="}]},"_npmUser":{"name":"juliansodo","email":"mpi@primary.com.ar"},"directories":{},"maintainers":[{"name":"juliansodo","email":"mpi@primary.com.ar"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/trading_1.21.0_1783394283274_0.6788729760160515"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-07T03:18:03.084Z","1.21.0":"2026-07-07T03:18:03.507Z","modified":"2026-07-07T03:18:03.722Z"},"maintainers":[{"name":"juliansodo","email":"mpi@primary.com.ar"}],"description":"SDK TypeScript para la API Trading de A3 Mercados (REST + WebSocket).","homepage":"https://github.com/fern-starter/a3-trading-typescript-sdk#readme","keywords":["a3-mercados","trading","market-data","fix"],"repository":{"type":"git","url":"git+https://github.com/fern-starter/a3-trading-typescript-sdk.git"},"author":{"name":"A3 Mercados","email":"mpi@primary.com.ar"},"bugs":{"url":"https://github.com/fern-starter/a3-trading-typescript-sdk/issues"},"license":"UNLICENSED","readme":"# A3 TypeScript Library\n\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Ffern-starter%2Fa3-509447)\n[![npm shield](https://img.shields.io/npm/v/@a3mercados/trading)](https://www.npmjs.com/package/@a3mercados/trading)\n\nThe A3 TypeScript library provides convenient access to the A3 APIs from TypeScript.\n\n## Table of Contents\n\n- [Making Changes to This Template](#making-changes-to-this-template)\n- [Installation](#installation)\n- [Reference](#reference)\n- [Usage](#usage)\n- [Environments](#environments)\n- [Request and Response Types](#request-and-response-types)\n- [Exception Handling](#exception-handling)\n- [Advanced](#advanced)\n  - [Subpackage Exports](#subpackage-exports)\n  - [Additional Headers](#additional-headers)\n  - [Additional Query String Parameters](#additional-query-string-parameters)\n  - [Retries](#retries)\n  - [Timeouts](#timeouts)\n  - [Aborting Requests](#aborting-requests)\n  - [Access Raw Response Data](#access-raw-response-data)\n  - [Logging](#logging)\n  - [Custom Fetch](#custom-fetch)\n  - [Runtime Compatibility](#runtime-compatibility)\n- [Contributing](#contributing)\n\n## Making changes to this template\n\nAny changes here affect what every new user gets when they create a docs site from the dashboard. Test locally with `fern docs dev` and `fern check` before merging.\n\n## Installation\n\n```sh\nnpm i -s @a3mercados/trading\n```\n\n## Reference\n\nA full reference for this library is available [here](https://github.com/fern-starter/a3-509447/blob/HEAD/./reference.md).\n\n## Usage\n\nInstantiate and use the client with the following:\n\n```typescript\nimport { A3TradingClient } from \"@a3mercados/trading\";\n\nconst client = new A3TradingClient({ apiKey: \"YOUR_API_KEY\" });\nawait client.auth.getToken({\n    \"X-Username\": \"X-Username\",\n    \"X-Password\": \"X-Password\"\n});\n```\n\n## Environments\n\nThis SDK allows you to configure different environments for API requests.\n\n```typescript\nimport { A3TradingClient, A3TradingEnvironment } from \"@a3mercados/trading\";\n\nconst client = new A3TradingClient({\n    environment: A3TradingEnvironment.Default,\n});\n```\n\n## Request and Response Types\n\nThe SDK exports all request and response types as TypeScript interfaces. Simply import them with the\nfollowing namespace:\n\n```typescript\nimport { A3Trading } from \"@a3mercados/trading\";\n\nconst request: A3Trading.GetTokenRequest = {\n    ...\n};\n```\n\n## Exception Handling\n\nWhen the API returns a non-success status code (4xx or 5xx response), a subclass of the following error\nwill be thrown.\n\n```typescript\nimport { A3TradingError } from \"@a3mercados/trading\";\n\ntry {\n    await client.auth.getToken(...);\n} catch (err) {\n    if (err instanceof A3TradingError) {\n        console.log(err.statusCode);\n        console.log(err.message);\n        console.log(err.body);\n        console.log(err.rawResponse);\n    }\n}\n```\n\n## Advanced\n\n### Subpackage Exports\n\nThis SDK supports direct imports of subpackage clients, which allows JavaScript bundlers to tree-shake and include only the imported subpackage code. This results in much smaller bundle sizes.\n\n```typescript\nimport { AuthClient } from '@a3mercados/trading/auth';\n\nconst client = new AuthClient({...});\n```\n\n### Additional Headers\n\nIf you would like to send additional headers as part of the request, use the `headers` request option.\n\n```typescript\nimport { A3TradingClient } from \"@a3mercados/trading\";\n\nconst client = new A3TradingClient({\n    ...\n    headers: {\n        'X-Custom-Header': 'custom value'\n    }\n});\n\nconst response = await client.auth.getToken(..., {\n    headers: {\n        'X-Custom-Header': 'custom value'\n    }\n});\n```\n\n### Additional Query String Parameters\n\nIf you would like to send additional query string parameters as part of the request, use the `queryParams` request option.\n\n```typescript\nconst response = await client.auth.getToken(..., {\n    queryParams: {\n        'customQueryParamKey': 'custom query param value'\n    }\n});\n```\n\n### Retries\n\nThe SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long\nas the request is deemed retryable and the number of retry attempts has not grown larger than the configured\nretry limit (default: 2).\n\nWhich status codes are retried depends on the `retryStatusCodes` generator configuration:\n\n**`legacy`** (current default): retries on\n- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)\n- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)\n- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)\n\n**`recommended`**: retries on\n- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)\n- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)\n- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)\n- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)\n- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)\n\nUse the `maxRetries` request option to configure this behavior.\n\n```typescript\nconst response = await client.auth.getToken(..., {\n    maxRetries: 0 // override maxRetries at the request level\n});\n```\n\n### Timeouts\n\nThe SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.\n\n```typescript\nconst response = await client.auth.getToken(..., {\n    timeoutInSeconds: 30 // override timeout to 30s\n});\n```\n\n### Aborting Requests\n\nThe SDK allows users to abort requests at any point by passing in an abort signal.\n\n```typescript\nconst controller = new AbortController();\nconst response = await client.auth.getToken(..., {\n    abortSignal: controller.signal\n});\ncontroller.abort(); // aborts the request\n```\n\n### Access Raw Response Data\n\nThe SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.\nThe `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.\n\n```typescript\nconst { data, rawResponse } = await client.auth.getToken(...).withRawResponse();\n\nconsole.log(data);\nconsole.log(rawResponse.headers['X-My-Header']);\n```\n\n### Logging\n\nThe SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.\n\n```typescript\nimport { A3TradingClient, logging } from \"@a3mercados/trading\";\n\nconst client = new A3TradingClient({\n    ...\n    logging: {\n        level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info\n        logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger\n        silent: false, // defaults to true, set to false to enable logging\n    }\n});\n```\nThe `logging` object can have the following properties:\n- `level`: The log level to use. Defaults to `logging.LogLevel.Info`.\n- `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.\n- `silent`: Whether to silence the logger. Defaults to `true`.\n\nThe `level` property can be one of the following values:\n- `logging.LogLevel.Debug`\n- `logging.LogLevel.Info`\n- `logging.LogLevel.Warn`\n- `logging.LogLevel.Error`\n\nTo provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.\n\n<details>\n<summary>Custom logger examples</summary>\n\nHere's an example using the popular `winston` logging library.\n```ts\nimport winston from 'winston';\n\nconst winstonLogger = winston.createLogger({...});\n\nconst logger: logging.ILogger = {\n    debug: (msg, ...args) => winstonLogger.debug(msg, ...args),\n    info: (msg, ...args) => winstonLogger.info(msg, ...args),\n    warn: (msg, ...args) => winstonLogger.warn(msg, ...args),\n    error: (msg, ...args) => winstonLogger.error(msg, ...args),\n};\n```\n\nHere's an example using the popular `pino` logging library.\n\n```ts\nimport pino from 'pino';\n\nconst pinoLogger = pino({...});\n\nconst logger: logging.ILogger = {\n  debug: (msg, ...args) => pinoLogger.debug(args, msg),\n  info: (msg, ...args) => pinoLogger.info(args, msg),\n  warn: (msg, ...args) => pinoLogger.warn(args, msg),\n  error: (msg, ...args) => pinoLogger.error(args, msg),\n};\n```\n</details>\n\n\n### Custom Fetch\n\nThe SDK provides a low-level `fetch` method for making custom HTTP requests while still\nbenefiting from SDK-level configuration like authentication, retries, timeouts, and logging.\nThis is useful for calling API endpoints not yet supported in the SDK.\n\n```typescript\nconst response = await client.fetch(\"/v1/custom/endpoint\", {\n    method: \"GET\",\n}, {\n    timeoutInSeconds: 30,\n    maxRetries: 3,\n    headers: {\n        \"X-Custom-Header\": \"custom-value\",\n    },\n});\n\nconst data = await response.json();\n```\n\n### Runtime Compatibility\n\n\nThe SDK works in the following runtimes:\n\n\n\n- Node.js 18+\n- Vercel\n- Cloudflare Workers\n- Deno v1.25+\n- Bun 1.0+\n- React Native\n\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nAdditions made directly to this library would have to be moved over to our generation code,\notherwise they would be overwritten upon the next generated release. Feel free to open a PR as\na proof of concept, but know that we will not be able to merge it as-is. We suggest opening\nan issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n","readmeFilename":"README.md","_rev":"1-0e0f3694c9d1ba574f886ec70062ed53"}