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