File size: 1,454 Bytes
a03f954 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
using OKX.Api;
class MigrationScript
{
static async Task Main(string[] args)
{
// Set API credentials
string okxApiKey = "33bfe871-b6a5-4391-aeeb-cca4ce971548";
string okxApiSecret = "0F1A96741B083277007AA84F61A716C5";
string okxApiPassphrase = ""; // Set your API passphrase
// Create OKX API client
var okxClient = new OKXRestApiClient();
okxClient.SetApiCredentials(okxApiKey, okxApiSecret, okxApiPassphrase);
// Migrate assets
await MigrateAsset(okxClient, "BTC", 10);
await MigrateAsset(okxClient, "ETH", 10);
await MigrateAsset(okxClient, "USDT", 50);
await MigrateAsset(okxClient, "WBTC", 20);
}
static async Task MigrateAsset(OKXRestApiClient okxClient, string assetSymbol, decimal amount)
{
// Get asset details
var instrument = await okxClient.Public.GetInstrumentAsync(OkxInstrumentType.Spot, assetSymbol + "-USDT");
if (instrument == null)
{
Console.WriteLine($"Error: Instrument {assetSymbol}-USDT not found");
return;
}
// Create asset on OKX API
var asset = await okxClient.Asset.CreateAssetAsync(assetSymbol, amount);
// Create connection on OKX API
await okxClient.Connection.CreateConnectionAsync("connections", asset.Id, assetSymbol);
Console.WriteLine($"Migrated {amount} {assetSymbol} to OKX API");
}
} |