UNPKG

@dbotx/copy-trading-mcp-server

Version:

Copy Trading MCP Server - Supports creating and managing complex copy trading tasks, automatically following other users' trading strategies

95 lines 2.99 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DbotCopyTradingClient = void 0; const axios_1 = __importDefault(require("axios")); class DbotCopyTradingClient { client; apiKey; baseUrl; constructor(apiKey, baseUrl = 'https://api-bot-v1.dbotx.com') { this.apiKey = apiKey || process.env.DBOT_API_KEY; if (!this.apiKey) { throw new Error('Please set the DBOT_API_KEY environment variable'); } this.baseUrl = baseUrl; this.client = axios_1.default.create({ baseURL: this.baseUrl, headers: { 'X-API-KEY': this.apiKey, 'Content-Type': 'application/json', }, timeout: 30000, }); } /** * Create a copy trading task */ async createCopyTrading(request) { const url = '/automation/follow_order'; const response = await this.client.post(url, request); return response.data; } /** * Edit a copy trading task */ async editCopyTrading(request) { const url = '/automation/follow_order'; const response = await this.client.post(url, request); return response.data; } /** * Enable/disable a copy trading task */ async switchCopyTrading(request) { const url = '/automation/follow_order'; const data = { id: request.id, enabled: request.enabled, closePnlOrder: request.closePnlOrder }; const response = await this.client.patch(url, data); return response.data; } /** * Delete a copy trading task */ async deleteCopyTrading(request) { const url = `/automation/follow_order/${request.id}`; const params = { deletePnlOrder: request.deletePnlOrder }; const response = await this.client.delete(url, { params }); return response.data; } /** * Get the list of copy trading tasks (if supported by the API) */ async getCopyTradingTasks(page = 0, size = 20) { const url = '/automation/follow_orders'; const params = { page, size, }; const response = await this.client.get(url, { params }); return response.data; } // --- Wallet Management Methods --- /** * Get user wallets */ async getWallets(params = {}) { const url = '/account/wallets'; const queryParams = { type: params.type || 'solana', page: params.page || 0, size: params.size || 20, }; const response = await this.client.get(url, { params: queryParams }); return response.data; } } exports.DbotCopyTradingClient = DbotCopyTradingClient; //# sourceMappingURL=client.js.map