transferAsset
Move cryptocurrency funds between futures and spot trading accounts on the Aster exchange to manage trading positions and capital allocation.
Instructions
Transfer between futures and spot.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | ||
| asset | Yes | ||
| clientTranId | Yes | ||
| kindType | Yes |
Implementation Reference
- src/index.ts:633-634 (handler)Handler implementation for the 'transferAsset' tool. It invokes the shared makeRequest function with POST method to '/fapi/v1/asset/wallet/transfer' endpoint, passing arguments and requiring signing.case 'transferAsset': return makeRequest('POST', '/fapi/v1/asset/wallet/transfer', args, true);
- src/index.ts:285-294 (schema)Input schema definition for the transferAsset tool, specifying required parameters: asset (string), amount (number), clientTranId (string), kindType (enum: 'FUTURE_SPOT' or 'SPOT_FUTURE').inputSchema: { type: 'object', properties: { asset: { type: 'string' }, amount: { type: 'number' }, clientTranId: { type: 'string' }, kindType: { type: 'string', enum: ['FUTURE_SPOT', 'SPOT_FUTURE'] }, }, required: ['asset', 'amount', 'clientTranId', 'kindType'], },
- src/index.ts:282-295 (registration)Registration of the transferAsset tool in the tools list returned by the ListToolsRequestSchema handler.{ name: 'transferAsset', description: 'Transfer between futures and spot.', inputSchema: { type: 'object', properties: { asset: { type: 'string' }, amount: { type: 'number' }, clientTranId: { type: 'string' }, kindType: { type: 'string', enum: ['FUTURE_SPOT', 'SPOT_FUTURE'] }, }, required: ['asset', 'amount', 'clientTranId', 'kindType'], }, },
- src/index.ts:542-579 (helper)Shared helper function 'makeRequest' that handles API requests to AsterDEX (fapi endpoints), including signing with API key/secret for authenticated endpoints like transferAsset.const makeRequest = async (method: 'GET' | 'POST' | 'DELETE', path: string, params: any, isSigned = false) => { try { let config: any = { method, url: path, }; if (isSigned) { if (!API_KEY || !API_SECRET) { throw new McpError(ErrorCode.InvalidRequest, 'API_KEY and API_SECRET must be configured.'); } params.timestamp = Date.now(); const queryString = new URLSearchParams(params).toString(); const signature = crypto.createHmac('sha256', API_SECRET).update(queryString).digest('hex'); params.signature = signature; config.headers = { 'X-MBX-APIKEY': API_KEY }; } if (method === 'GET' || method === 'DELETE') { config.params = params; } else { // POST config.data = new URLSearchParams(params).toString(); config.headers = { ...config.headers, 'Content-Type': 'application/x-www-form-urlencoded' }; } const response = await this.axiosInstance.request(config); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] }; } catch (error) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Aster API error: ${error.response?.data?.msg || error.message}` ); } throw error; } };