There is a websocket application made in c # of ftx stock exchange. It works fine on Console, but with WindowsForms, I can't transfer data onto textbox.
Is there a way to do this?
The code below receives data via websocket. But I can't import it into textBox in form1
In short, it needs to be integrated on the form. I don't want with console
namespace FtxApi_Test
{
class Program
{
static void Main()
{
var client = new Client("_T68V7HmuHoiHlKmpUcOcbNOXkNWpzL-FvpO1VMa", "TsmQWQ4bXrOHzCVbD7vFzZtI-gs7j8tvh684hPY6");
var api = new FtxRestApi(client);
var wsApi = new FtxWebSocketApi("wss://ftx.com/ws/");
WebSocketTests(wsApi, client).Wait();
Console.ReadLine();
}
private static async Task WebSocketTests(FtxWebSocketApi wsApi, Client client)
{
var ins = "BTC-PERP";
wsApi.OnWebSocketConnect += () =>
{
wsApi.SendCommand(FtxWebSockerRequestGenerator.GetAuthRequest(client));
wsApi.SendCommand(FtxWebSockerRequestGenerator.GetSubscribeRequest("orderbook", ins));
wsApi.SendCommand(FtxWebSockerRequestGenerator.GetSubscribeRequest("trades", ins));
wsApi.SendCommand(FtxWebSockerRequestGenerator.GetSubscribeRequest("ticker", ins));
wsApi.SendCommand(FtxWebSockerRequestGenerator.GetSubscribeRequest("fills"));
wsApi.SendCommand(FtxWebSockerRequestGenerator.GetSubscribeRequest("orders"));
};
await wsApi.Connect();
}
}
}
Declare
private static async **void** WebSocketTests(FtxWebSocketApi wsApi, Client client)
instead of
private static async **Task** WebSocketTests(FtxWebSocketApi wsApi, Client client)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.