我试图使用 c# 手动将数据推送到 NT,但出现错误:“无法初始化 COM 库(0x80010106)。” 我已经添加了参考'Ninjatrader.Client.dll' 我发布我的代码如下:
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
namespace read_file
{
public static class Program
{
[DllImport("NtDirect.dll", EntryPoint = "Connected", SetLastError = true)]
public extern static int Connected(int showMessage);
[DllImport("NtDirect.dll", SetLastError = true)]
public static extern int Last(string instrument, double price, int size);
public static void Main(string[] args)
{
NinjaTrader.Client.Client NTClient = new NinjaTrader.Client.Client();
int ConnectStatus = Connected(1);
NTClient.Command("PLACE", "Sim101", "ES 03-08", "BUY", 1, "LIMIT", 1245.00, 0, "GTC", "ax1234", "", "", "");
int k;
for (int i = 0; i < 100; i++)
{
k = 10 * (i + 1);
Last("AUDUSD", k, 4);
for (int j = 0; j < 999999999; j++)
{
}
Console.WriteLine(k);
}
}
}
}
请告诉我正确的建议。