@megatao/sdk 1.1.0
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.
- package/.env.example +37 -0
- package/CHANGELOG.md +19 -0
- package/README.md +199 -0
- package/bin/alf +4 -0
- package/cli/README.md +198 -0
- package/cli/TEST_MANUAL.md +577 -0
- package/cli/commands/account.ts +545 -0
- package/cli/commands/funding.ts +481 -0
- package/cli/commands/liquidation.ts +523 -0
- package/cli/commands/market.ts +590 -0
- package/cli/commands/orders.ts +395 -0
- package/cli/commands/position.ts +1085 -0
- package/cli/commands/shared/positionUtils.ts +239 -0
- package/cli/commands/trading.ts +483 -0
- package/cli/commands/utils.ts +281 -0
- package/cli/commands/vault.ts +522 -0
- package/cli/index.ts +169 -0
- package/cli/interactive.ts +530 -0
- package/cli/utils/client.ts +457 -0
- package/cli/utils/config.ts +226 -0
- package/cli/utils/display.ts +258 -0
- package/cli/utils/index.ts +10 -0
- package/cli/utils/prompts.ts +364 -0
- package/config.example.json +23 -0
- package/dist/AlphaFuturesClient.d.ts +36 -0
- package/dist/AlphaFuturesClient.d.ts.map +1 -0
- package/dist/AlphaFuturesClient.js +116 -0
- package/dist/AlphaFuturesClient.js.map +1 -0
- package/dist/abi/Alpha.json +5987 -0
- package/dist/abi/abis.d.ts +319 -0
- package/dist/abi/abis.d.ts.map +1 -0
- package/dist/abi/abis.js +128 -0
- package/dist/abi/abis.js.map +1 -0
- package/dist/abi/index.d.ts +11 -0
- package/dist/abi/index.d.ts.map +1 -0
- package/dist/abi/index.js +15 -0
- package/dist/abi/index.js.map +1 -0
- package/dist/config/contracts.config.d.ts +70 -0
- package/dist/config/contracts.config.d.ts.map +1 -0
- package/dist/config/contracts.config.js +137 -0
- package/dist/config/contracts.config.js.map +1 -0
- package/dist/config/environments/alpha.config.d.ts +17 -0
- package/dist/config/environments/alpha.config.d.ts.map +1 -0
- package/dist/config/environments/alpha.config.js +140 -0
- package/dist/config/environments/alpha.config.js.map +1 -0
- package/dist/config/environments/beta.config.d.ts +16 -0
- package/dist/config/environments/beta.config.d.ts.map +1 -0
- package/dist/config/environments/beta.config.js +131 -0
- package/dist/config/environments/beta.config.js.map +1 -0
- package/dist/config/environments/dev.config.d.ts +13 -0
- package/dist/config/environments/dev.config.d.ts.map +1 -0
- package/dist/config/environments/dev.config.js +123 -0
- package/dist/config/environments/dev.config.js.map +1 -0
- package/dist/config/environments/index.d.ts +48 -0
- package/dist/config/environments/index.d.ts.map +1 -0
- package/dist/config/environments/index.js +81 -0
- package/dist/config/environments/index.js.map +1 -0
- package/dist/config/environments/localhost.config.d.ts +16 -0
- package/dist/config/environments/localhost.config.d.ts.map +1 -0
- package/dist/config/environments/localhost.config.js +152 -0
- package/dist/config/environments/localhost.config.js.map +1 -0
- package/dist/config/environments/prod.config.d.ts +20 -0
- package/dist/config/environments/prod.config.d.ts.map +1 -0
- package/dist/config/environments/prod.config.js +143 -0
- package/dist/config/environments/prod.config.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +41 -0
- package/dist/config/index.js.map +1 -0
- package/dist/constants/assets.d.ts +76 -0
- package/dist/constants/assets.d.ts.map +1 -0
- package/dist/constants/assets.js +277 -0
- package/dist/constants/assets.js.map +1 -0
- package/dist/constants/contracts.d.ts +41 -0
- package/dist/constants/contracts.d.ts.map +1 -0
- package/dist/constants/contracts.js +57 -0
- package/dist/constants/contracts.js.map +1 -0
- package/dist/constants/index.d.ts +36 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +75 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/networks.d.ts +32 -0
- package/dist/constants/networks.d.ts.map +1 -0
- package/dist/constants/networks.js +174 -0
- package/dist/constants/networks.js.map +1 -0
- package/dist/contracts/index.d.ts +5 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +21 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/viem/AlphaViem.d.ts +518 -0
- package/dist/contracts/viem/AlphaViem.d.ts.map +1 -0
- package/dist/contracts/viem/AlphaViem.js +1287 -0
- package/dist/contracts/viem/AlphaViem.js.map +1 -0
- package/dist/contracts/viem/PriceOracleViem.d.ts +71 -0
- package/dist/contracts/viem/PriceOracleViem.d.ts.map +1 -0
- package/dist/contracts/viem/PriceOracleViem.js +212 -0
- package/dist/contracts/viem/PriceOracleViem.js.map +1 -0
- package/dist/contracts/viem/index.d.ts +9 -0
- package/dist/contracts/viem/index.d.ts.map +1 -0
- package/dist/contracts/viem/index.js +17 -0
- package/dist/contracts/viem/index.js.map +1 -0
- package/dist/errors/index.d.ts +44 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +83 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/types/alpha.d.ts +299 -0
- package/dist/types/alpha.d.ts.map +1 -0
- package/dist/types/alpha.js +6 -0
- package/dist/types/alpha.js.map +1 -0
- package/dist/types/client.d.ts +24 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.js +13 -0
- package/dist/types/client.js.map +1 -0
- package/dist/types/contracts.d.ts +48 -0
- package/dist/types/contracts.d.ts.map +1 -0
- package/dist/types/contracts.js +6 -0
- package/dist/types/contracts.js.map +1 -0
- package/dist/types/funding.d.ts +27 -0
- package/dist/types/funding.d.ts.map +1 -0
- package/dist/types/funding.js +6 -0
- package/dist/types/funding.js.map +1 -0
- package/dist/types/index.d.ts +92 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +47 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/liquidation.d.ts +20 -0
- package/dist/types/liquidation.d.ts.map +1 -0
- package/dist/types/liquidation.js +6 -0
- package/dist/types/liquidation.js.map +1 -0
- package/dist/types/margin.d.ts +29 -0
- package/dist/types/margin.d.ts.map +1 -0
- package/dist/types/margin.js +6 -0
- package/dist/types/margin.js.map +1 -0
- package/dist/types/oracle.d.ts +21 -0
- package/dist/types/oracle.d.ts.map +1 -0
- package/dist/types/oracle.js +6 -0
- package/dist/types/oracle.js.map +1 -0
- package/dist/types/positions.d.ts +43 -0
- package/dist/types/positions.d.ts.map +1 -0
- package/dist/types/positions.js +13 -0
- package/dist/types/positions.js.map +1 -0
- package/dist/utils/calculations.d.ts +84 -0
- package/dist/utils/calculations.d.ts.map +1 -0
- package/dist/utils/calculations.js +155 -0
- package/dist/utils/calculations.js.map +1 -0
- package/dist/utils/errors.d.ts +24 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +129 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/events.d.ts +40 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/events.js +73 -0
- package/dist/utils/events.js.map +1 -0
- package/dist/utils/format.d.ts +40 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +86 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +26 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/network.d.ts +52 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +192 -0
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/positionCalculations.d.ts +145 -0
- package/dist/utils/positionCalculations.d.ts.map +1 -0
- package/dist/utils/positionCalculations.js +278 -0
- package/dist/utils/positionCalculations.js.map +1 -0
- package/dist/utils/validation.d.ts +28 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +68 -0
- package/dist/utils/validation.js.map +1 -0
- package/docs/README.md +40 -0
- package/docs/api/API.md +831 -0
- package/docs/guides/GETTING_STARTED.md +316 -0
- package/docs/guides/TRADING_GUIDE.md +677 -0
- package/docs/integration/INTEGRATION_GUIDE.md +1679 -0
- package/docs/integration/VIEM_INTEGRATION.md +294 -0
- package/docs/reference/CLI_QUICK_REFERENCE.md +197 -0
- package/docs/reference/TROUBLESHOOTING.md +922 -0
- package/package.json +113 -0
- package/src/AlphaFuturesClient.ts +158 -0
- package/src/abi/.gitkeep +1 -0
- package/src/abi/Alpha.json +5987 -0
- package/src/abi/README.md +99 -0
- package/src/abi/abis.ts +131 -0
- package/src/abi/index.ts +13 -0
- package/src/config/contracts.config.ts +186 -0
- package/src/config/environments/alpha.config.ts +139 -0
- package/src/config/environments/beta.config.ts +130 -0
- package/src/config/environments/dev.config.ts +122 -0
- package/src/config/environments/index.ts +87 -0
- package/src/config/environments/localhost.config.ts +153 -0
- package/src/config/environments/prod.config.ts +142 -0
- package/src/config/index.ts +29 -0
- package/src/constants/assets.ts +299 -0
- package/src/constants/contracts.ts +64 -0
- package/src/constants/index.ts +69 -0
- package/src/constants/networks.ts +182 -0
- package/src/contracts/index.ts +5 -0
- package/src/contracts/viem/AlphaViem.ts +1615 -0
- package/src/contracts/viem/PriceOracleViem.ts +272 -0
- package/src/contracts/viem/index.ts +11 -0
- package/src/errors/index.ts +87 -0
- package/src/index.ts +59 -0
- package/src/types/VIEM_TYPES_README.md +70 -0
- package/src/types/alpha.ts +358 -0
- package/src/types/client.ts +27 -0
- package/src/types/contracts.ts +74 -0
- package/src/types/funding.ts +31 -0
- package/src/types/index.ts +108 -0
- package/src/types/liquidation.ts +23 -0
- package/src/types/margin.ts +34 -0
- package/src/types/oracle.ts +24 -0
- package/src/types/positions.ts +48 -0
- package/src/utils/calculations.ts +175 -0
- package/src/utils/errors.ts +147 -0
- package/src/utils/events.ts +98 -0
- package/src/utils/format.ts +84 -0
- package/src/utils/index.ts +10 -0
- package/src/utils/network.ts +212 -0
- package/src/utils/positionCalculations.ts +317 -0
- package/src/utils/validation.ts +76 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Commands - Helper commands for CLI usage
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import Table from 'cli-table3';
|
|
8
|
+
import { listAvailableMarketAddresses } from '../utils/client';
|
|
9
|
+
|
|
10
|
+
export function utilityCommands(program: Command) {
|
|
11
|
+
const utils = program.command('utils').alias('u').description('Utility commands and helpers');
|
|
12
|
+
|
|
13
|
+
// Command overview - shows all available commands
|
|
14
|
+
utils
|
|
15
|
+
.command('commands')
|
|
16
|
+
.alias('help-all')
|
|
17
|
+
.description('Show overview of all CLI commands')
|
|
18
|
+
.action(() => {
|
|
19
|
+
console.log(chalk.bold('\nš Alpha Futures CLI - Complete Command Reference\n'));
|
|
20
|
+
|
|
21
|
+
const sections = [
|
|
22
|
+
{
|
|
23
|
+
title: 'š° Account Management',
|
|
24
|
+
commands: [
|
|
25
|
+
['account deposit <amount>', 'Deposit TAO to margin account'],
|
|
26
|
+
['account withdraw <amount>', 'Withdraw TAO from margin account'],
|
|
27
|
+
['account balance [address]', 'Check balances (enhanced with TAO wallet)'],
|
|
28
|
+
['account transfer <recipient> <amount>', 'š Transfer TAO tokens'],
|
|
29
|
+
['account info [address]', 'Get detailed account information'],
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: 'š Position Management',
|
|
34
|
+
commands: [
|
|
35
|
+
['position open', 'Open a new position'],
|
|
36
|
+
['position close <positionId>', 'Close an existing position (bytes16 format)'],
|
|
37
|
+
['position list [address]', 'List all positions'],
|
|
38
|
+
['position info <positionId>', 'Get detailed position information (bytes16 format)'],
|
|
39
|
+
['position id <trader> [asset]', 'š Get position ID for trader+asset'],
|
|
40
|
+
['position find [trader]', 'š Find all position IDs for a trader'],
|
|
41
|
+
['position modify <positionId>', 'Add/remove margin from position (bytes16 format)'],
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: 'š Trading',
|
|
46
|
+
commands: [
|
|
47
|
+
['trade market', 'Execute a market order'],
|
|
48
|
+
['trade limit', 'Place a limit order (coming soon)'],
|
|
49
|
+
['trade quick', 'Quick trade with interactive prompts'],
|
|
50
|
+
['trade close-all', 'Close all open positions'],
|
|
51
|
+
['trade calc', 'Trading calculator for position sizing'],
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
title: 'šø Funding Rates',
|
|
56
|
+
commands: [
|
|
57
|
+
['funding rate [asset]', 'š Get current funding rate'],
|
|
58
|
+
['funding payment <positionId>', 'š Calculate funding payment (bytes16 format)'],
|
|
59
|
+
['funding history [asset]', 'š Show funding rate history (coming soon)'],
|
|
60
|
+
['funding simulate', 'š Simulate funding rate scenarios'],
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: 'šŖ Market Data',
|
|
65
|
+
commands: [
|
|
66
|
+
['market price <asset>', 'Get current price and statistics'],
|
|
67
|
+
['market list', 'List all available markets'],
|
|
68
|
+
['market config', 'Check market configuration'],
|
|
69
|
+
['market stats', 'View protocol-wide statistics'],
|
|
70
|
+
['market oi [asset]', 'View open interest data'],
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: 'ā” Liquidation',
|
|
75
|
+
commands: [
|
|
76
|
+
['liquidation scan', 'Scan for liquidatable positions'],
|
|
77
|
+
['liquidation execute <positionId>', 'Execute liquidation (bytes16 format)'],
|
|
78
|
+
['liquidation monitor', 'Monitor liquidation opportunities'],
|
|
79
|
+
['liquidation stats', 'View liquidation statistics'],
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: 'š¦ Protocol Vault',
|
|
84
|
+
commands: [
|
|
85
|
+
['vault status', 'View vault status and reserves'],
|
|
86
|
+
['vault exposure [asset]', 'View vault exposure by asset'],
|
|
87
|
+
['vault stats', 'View vault statistics'],
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
sections.forEach((section) => {
|
|
93
|
+
console.log(chalk.bold(section.title));
|
|
94
|
+
const table = new Table({
|
|
95
|
+
head: ['Command', 'Description'],
|
|
96
|
+
colWidths: [40, 50],
|
|
97
|
+
style: { head: [] },
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
section.commands.forEach(([command, description]) => {
|
|
101
|
+
const displayCommand = command.includes('š') ? command.replace('š', '') : command;
|
|
102
|
+
const displayDescription = description.includes('š')
|
|
103
|
+
? chalk.green(description)
|
|
104
|
+
: description;
|
|
105
|
+
|
|
106
|
+
table.push([chalk.cyan('alpha-futures ' + displayCommand), displayDescription]);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
console.log(table.toString());
|
|
110
|
+
console.log();
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
console.log(chalk.bold('š New Features Added:'));
|
|
114
|
+
console.log(' ⢠TAO token transfers');
|
|
115
|
+
console.log(' ⢠Enhanced balance checking (wallet + margin)');
|
|
116
|
+
console.log(' ⢠Position ID lookup and search');
|
|
117
|
+
console.log(' ⢠Comprehensive funding rate management');
|
|
118
|
+
console.log(' ⢠Market configuration validation');
|
|
119
|
+
console.log();
|
|
120
|
+
|
|
121
|
+
console.log(chalk.bold('š Quick Start:'));
|
|
122
|
+
console.log(' 1. Check configuration: ' + chalk.cyan('alpha-futures market config'));
|
|
123
|
+
console.log(' 2. Check your balance: ' + chalk.cyan('alpha-futures account balance'));
|
|
124
|
+
console.log(' 3. View market data: ' + chalk.cyan('alpha-futures market list'));
|
|
125
|
+
console.log(
|
|
126
|
+
' 4. Open a position: ' +
|
|
127
|
+
chalk.cyan('alpha-futures position open -a BITMIND -d long -s 1000 -m 333'),
|
|
128
|
+
);
|
|
129
|
+
console.log();
|
|
130
|
+
|
|
131
|
+
console.log(chalk.bold('š§ Global Options:'));
|
|
132
|
+
console.log(' -n, --network <network> Network to connect to (default: localhost)');
|
|
133
|
+
console.log(' -r, --rpc <url> Custom RPC URL');
|
|
134
|
+
console.log(' -k, --key <privateKey> Private key for transactions');
|
|
135
|
+
console.log(' --json Output in JSON format');
|
|
136
|
+
console.log(' --no-color Disable color output');
|
|
137
|
+
console.log();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Environment check command
|
|
141
|
+
utils
|
|
142
|
+
.command('env-check')
|
|
143
|
+
.description('Check environment setup and configuration')
|
|
144
|
+
.action(() => {
|
|
145
|
+
console.log(chalk.bold('\nš Environment Configuration Check\n'));
|
|
146
|
+
|
|
147
|
+
// Check if .env.anvil file exists
|
|
148
|
+
const fs = require('fs');
|
|
149
|
+
const path = require('path');
|
|
150
|
+
const envFilePath = path.resolve(process.cwd(), '.env.anvil');
|
|
151
|
+
|
|
152
|
+
console.log(chalk.bold('š Configuration Files:'));
|
|
153
|
+
if (fs.existsSync(envFilePath)) {
|
|
154
|
+
console.log(chalk.green(' ā
.env.anvil file found'));
|
|
155
|
+
} else {
|
|
156
|
+
console.log(chalk.red(' ā .env.anvil file not found'));
|
|
157
|
+
console.log(chalk.yellow(' Run: cp .env.example .env.anvil'));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Check essential environment variables
|
|
161
|
+
console.log(chalk.bold('\nš Essential Environment Variables:'));
|
|
162
|
+
const essentialVars = ['PRIVATE_KEY', 'TAO_TOKEN'];
|
|
163
|
+
|
|
164
|
+
essentialVars.forEach((varName) => {
|
|
165
|
+
if (process.env[varName]) {
|
|
166
|
+
console.log(chalk.green(` ā
${varName} is set`));
|
|
167
|
+
} else {
|
|
168
|
+
console.log(chalk.red(` ā ${varName} is missing`));
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// Check market addresses
|
|
173
|
+
console.log(chalk.bold('\nšŖ Market Addresses:'));
|
|
174
|
+
const markets = listAvailableMarketAddresses();
|
|
175
|
+
if (Object.keys(markets).length > 0) {
|
|
176
|
+
console.log(chalk.green(` ā
${Object.keys(markets).length} markets configured`));
|
|
177
|
+
Object.keys(markets).forEach((asset) => {
|
|
178
|
+
console.log(` ⢠${asset}`);
|
|
179
|
+
});
|
|
180
|
+
} else {
|
|
181
|
+
console.log(chalk.red(' ā No market addresses configured'));
|
|
182
|
+
console.log(chalk.yellow(' Available subnet markets: BITMIND, CHUTES, AFFINE, RIDGES'));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Network connectivity check
|
|
186
|
+
console.log(chalk.bold('\nš Network Settings:'));
|
|
187
|
+
const rpcUrl = process.env.RPC_URL || 'http://127.0.0.1:8545';
|
|
188
|
+
console.log(` RPC URL: ${chalk.cyan(rpcUrl)}`);
|
|
189
|
+
|
|
190
|
+
console.log(chalk.bold('\nš” Next Steps:'));
|
|
191
|
+
if (!process.env.PRIVATE_KEY) {
|
|
192
|
+
console.log(' 1. Set your PRIVATE_KEY in .env.anvil');
|
|
193
|
+
}
|
|
194
|
+
if (Object.keys(markets).length === 0) {
|
|
195
|
+
console.log(' 2. Subnet markets are pre-configured in constants');
|
|
196
|
+
}
|
|
197
|
+
console.log(' 3. Test connection: alpha-futures market config');
|
|
198
|
+
console.log(' 4. Check balance: alpha-futures account balance');
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Quick examples command
|
|
202
|
+
utils
|
|
203
|
+
.command('examples')
|
|
204
|
+
.description('Show common usage examples')
|
|
205
|
+
.action(() => {
|
|
206
|
+
console.log(chalk.bold('\nš Alpha Futures CLI - Usage Examples\n'));
|
|
207
|
+
|
|
208
|
+
const examples = [
|
|
209
|
+
{
|
|
210
|
+
title: 'š Getting Started',
|
|
211
|
+
commands: [
|
|
212
|
+
'alpha-futures market config # Check configuration',
|
|
213
|
+
'alpha-futures account balance # Check your balances',
|
|
214
|
+
'alpha-futures market list # View available markets',
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
title: 'š° Account Management',
|
|
219
|
+
commands: [
|
|
220
|
+
'alpha-futures account deposit 100 # Deposit 100 TAO',
|
|
221
|
+
'alpha-futures account withdraw 50 # Withdraw 50 TAO',
|
|
222
|
+
'alpha-futures account transfer 0x123... 10 # Transfer 10 TAO',
|
|
223
|
+
'alpha-futures account balance --detailed # Detailed balance view',
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
title: 'š Position Trading',
|
|
228
|
+
commands: [
|
|
229
|
+
'alpha-futures position open -a BITMIND -d long -s 1000 -m 333',
|
|
230
|
+
'alpha-futures position list --active # Show active positions',
|
|
231
|
+
'alpha-futures position info 0x00000000000000000000000000000001 # Position details',
|
|
232
|
+
'alpha-futures position close 0x00000000000000000000000000000001 # Close position',
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
title: 'š Position Discovery',
|
|
237
|
+
commands: [
|
|
238
|
+
'alpha-futures position id 0xa3A00185748B64eDA4149745415080cBA720E720 BITMIND # Get position ID',
|
|
239
|
+
'alpha-futures position find 0xa3A00185748B64eDA4149745415080cBA720E720 # Find all positions',
|
|
240
|
+
'alpha-futures position find --asset BITMIND # Find BITMIND position',
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
title: 'šø Funding Rate Analysis',
|
|
245
|
+
commands: [
|
|
246
|
+
'alpha-futures funding rate BITMIND # Get BITMIND funding rate',
|
|
247
|
+
'alpha-futures funding rate --all # All funding rates',
|
|
248
|
+
'alpha-futures funding payment <positionId> # Calculate funding payment',
|
|
249
|
+
'alpha-futures funding simulate -s 1000 --long # Simulate scenarios',
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
title: 'ā” Quick Trading',
|
|
254
|
+
commands: [
|
|
255
|
+
'alpha-futures trade quick # Interactive trading',
|
|
256
|
+
'alpha-futures trade market -a BITMIND -s buy -z 1000 -l 3',
|
|
257
|
+
'alpha-futures trade calc # Position calculator',
|
|
258
|
+
'alpha-futures trade close-all # Emergency close',
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
];
|
|
262
|
+
|
|
263
|
+
examples.forEach((section) => {
|
|
264
|
+
console.log(chalk.bold(section.title));
|
|
265
|
+
section.commands.forEach((command) => {
|
|
266
|
+
const [cmd, comment] = command.split('#');
|
|
267
|
+
console.log(
|
|
268
|
+
chalk.cyan(' ' + cmd.trim()) + (comment ? chalk.gray(' # ' + comment.trim()) : ''),
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
console.log();
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
console.log(chalk.bold('šÆ Pro Tips:'));
|
|
275
|
+
console.log(' ⢠Use --yes flag to skip confirmations in scripts');
|
|
276
|
+
console.log(' ⢠Use --json flag for machine-readable output');
|
|
277
|
+
console.log(' ⢠Use interactive mode: alpha-futures interactive');
|
|
278
|
+
console.log(' ⢠Set aliases: alias af="alpha-futures"');
|
|
279
|
+
console.log();
|
|
280
|
+
});
|
|
281
|
+
}
|