|
using OKX.Api; |
|
|
|
class MigrationScript |
|
{ |
|
static async Task Main(string[] args) |
|
{ |
|
|
|
string okxApiKey = "33bfe871-b6a5-4391-aeeb-cca4ce971548"; |
|
string okxApiSecret = "0F1A96741B083277007AA84F61A716C5"; |
|
string okxApiPassphrase = ""; |
|
|
|
|
|
var okxClient = new OKXRestApiClient(); |
|
okxClient.SetApiCredentials(okxApiKey, okxApiSecret, okxApiPassphrase); |
|
|
|
|
|
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) |
|
{ |
|
|
|
var instrument = await okxClient.Public.GetInstrumentAsync(OkxInstrumentType.Spot, assetSymbol + "-USDT"); |
|
if (instrument == null) |
|
{ |
|
Console.WriteLine($"Error: Instrument {assetSymbol}-USDT not found"); |
|
return; |
|
} |
|
|
|
|
|
var asset = await okxClient.Asset.CreateAssetAsync(assetSymbol, amount); |
|
|
|
|
|
await okxClient.Connection.CreateConnectionAsync("connections", asset.Id, assetSymbol); |
|
|
|
Console.WriteLine($"Migrated {amount} {assetSymbol} to OKX API"); |
|
} |
|
} |